<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jaber</id>
	<title>Multi Theft Auto: Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jaber"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Jaber"/>
	<updated>2026-04-26T05:00:41Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/%D9%85%D9%82%D8%AF%D9%85%D9%87_%D9%81%D9%8A_%D8%A7%D9%84%D8%A8%D8%B1%D9%85%D8%AC%D9%87&amp;diff=49198</id>
		<title>AR/مقدمه في البرمجه</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/%D9%85%D9%82%D8%AF%D9%85%D9%87_%D9%81%D9%8A_%D8%A7%D9%84%D8%A8%D8%B1%D9%85%D8%AC%D9%87&amp;diff=49198"/>
		<updated>2016-09-19T15:59:53Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p align=&amp;quot;right&amp;quot;&amp;gt;&lt;br /&gt;
==بداية ==  &lt;br /&gt;
&lt;br /&gt;
 تختلف أنواع السكربتات فمنها خريطة أو وضع للعب &lt;br /&gt;
&lt;br /&gt;
MTA السكربتات جزء اساسي في تشغيل&lt;br /&gt;
&lt;br /&gt;
...وغيرها &amp;quot; freeroam , race , deathmatch &amp;quot; فتستطيع بإستخدامهم إنشاء تطبيقات لتحسين اللعب &lt;br /&gt;
&lt;br /&gt;
(Lua) [www.lua.org] برمجة السكربتات تعتمد على لغة البرمجة&lt;br /&gt;
&lt;br /&gt;
لغة البرمجة تعتمد إعتماداً كلياً على اللغة الإنجليزية , فيجب أن تكون لديك خلفية في اللغة الإنجليزية قبل المتابعة.&lt;br /&gt;
&lt;br /&gt;
لبرمجة سكربت ما تحتاج لمحرر .. ويفضل إستخدام محرر إحترافي لكي يسهل عليك البرمجة مثل :&lt;br /&gt;
*Notepad++ [http://notepad-plus-plus.org/download]&lt;br /&gt;
*Lua Edit [http://luaedit.sourceforge.net/ LuaEdit]&lt;br /&gt;
&lt;br /&gt;
 فهو يسهل برمجتها MTASE لكن يفضل استخدام برنامج :&lt;br /&gt;
* [[MTASE|MTA Script Editor]].'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==إنشاء سكربت ==&lt;br /&gt;
&lt;br /&gt;
سوف نتعلم كيف نقوم بإنشاء سكربت يدخل اللاعب إلى اللعبة .. خطوة بحطوة&lt;br /&gt;
&lt;br /&gt;
اولا لا بد من معرفة انواع ملفات السكربت    &lt;br /&gt;
                                                                                                          &lt;br /&gt;
1-Meta.xml -- يقوم هذا الملف بتعرف الملفات الموجود في السكربت للسيرفر               &lt;br /&gt;
                                                                                          &lt;br /&gt;
2-Client -- يقوم هذا الملف بتشغيل جميع أوامر المتعلقة بالاعب فقط                                       &lt;br /&gt;
&lt;br /&gt;
3-Server -- يقوم هذا الملف بتشغيل جميع الاوامر سواء كانت للسيرفر او الاعب&lt;br /&gt;
&lt;br /&gt;
===أين مسار كل البرامج النصية (السكريبتات أو المودات)؟===&lt;br /&gt;
الان نتعرف على مجلد المودات أو السكربتات.&lt;br /&gt;
اذهب إلى مجلد Multi Theft Auto واتبع المسار التالي:&lt;br /&gt;
&lt;br /&gt;
	/Your MTA Server/mods/deathmatch/resources/&lt;br /&gt;
&lt;br /&gt;
. أو مجلد عادي zip سترى الكثير من الملفات. ربما ترى مجلدات صيغتها , MTA .. وجميعها يقبله الـ&lt;br /&gt;
&lt;br /&gt;
وهو الذي سنستخدمه بالبرنامج التعليمي &amp;quot;myserver&amp;quot; ولإنشاء المودات الخاصة بك: قم بعمل مجلد جديد واجعل اسمه كما تريد فمثلاً قم بتسميته &lt;br /&gt;
&lt;br /&gt;
والان يجب أن يكون مسار المجلد الذي قمت بعمله هذا:&lt;br /&gt;
&lt;br /&gt;
	/Your MTA Server/mods/deathmatch/resources/myserver/&lt;br /&gt;
&lt;br /&gt;
* myserver: اسم المجلد الذي قمت بتسميته&lt;br /&gt;
&lt;br /&gt;
=== meta.xml تعريف السكربت اضافة ملف===&lt;br /&gt;
حتى يستطيع السيرفر من معرفة المودات, يجب علينا إنشاء ملف meta.xml &lt;br /&gt;
&lt;br /&gt;
&amp;quot; ويكون بداخل مجلد السكربت الذي قمنا بإنشائه وهو &amp;quot;myserver&amp;quot; &lt;br /&gt;
&lt;br /&gt;
ولإنشاء ملف meta.xml :&lt;br /&gt;
&lt;br /&gt;
وافتحه باستخدام المفكرة =) meta.xml أفتح ملف نصي جديد وقم بتسميته&lt;br /&gt;
&lt;br /&gt;
ولا تنسى ان يكون بداخل مجلد السكربت .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
أدخل الكود التالي في ملف ''meta.xml'':&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
     &amp;lt;info author=&amp;quot;إسمك&amp;quot; type=&amp;quot;gamemode&amp;quot; name=&amp;quot;إسم السكربت&amp;quot; description=&amp;quot;وصف بسيط للسكربت&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;script src=&amp;quot;script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
هنا يتم تعريف أجزاء السكربت فمثلاً :&lt;br /&gt;
* &amp;lt;info ..&amp;gt;&lt;br /&gt;
تضع فيه بيانات السكربت .. مثل الإسم والنوع والوصف&lt;br /&gt;
* type=&amp;quot;gamemode&amp;quot;&lt;br /&gt;
تعني أن نوع السكربت هو مود لعب وتوجد أنواع عديدة مثل :&lt;br /&gt;
**gamemode&lt;br /&gt;
**map&lt;br /&gt;
**script&lt;br /&gt;
&lt;br /&gt;
===إنشاء ملف السكربت Lua===&lt;br /&gt;
قمنا بوضع هذا السطر في :&lt;br /&gt;
*meta.xml&lt;br /&gt;
:&lt;br /&gt;
		&amp;lt;script src=&amp;quot;script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
الآن نقوم بإنشاء ملف نصي بنفس الإسم&lt;br /&gt;
**script.lua&lt;br /&gt;
بإستخدام برنامج التحرير لديك .. نقوم بإنشاء الكود&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function joinHandler() -- الوظيفة .. وبعدها نقوم بكتابة الإسم&lt;br /&gt;
	local x = 1959.55 -- تعريف x&lt;br /&gt;
	local y = -1714.46 -- تعريف y&lt;br /&gt;
	local z = 10 -- تعريف z&lt;br /&gt;
	spawnPlayer(source, x, y, z) -- نقوم بإستخدام هذه الوظيفة لإنتاج اللاعب ونقوم بتحديد اللاعب وهو المصدر : source&lt;br /&gt;
	fadeCamera(source, true) -- نقوم بعمل fade للكاميرا&lt;br /&gt;
	setCameraTarget(source, source) -- نجعل هدف الكاميرا هو اللاعب &lt;br /&gt;
	outputChatBox(&amp;quot;مرحباً بك في السيرفر&amp;quot;, source) -- نقوم بإخراج نص في الدردشة&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, getRootElement(), joinHandler) -- نقوم بإضافة المعالج حيث سيتم تشغيله بعد الحدث المحدد وهو عند دخول اللا&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
وصف وشرح الكود اعلاه : &lt;br /&gt;
	سيقوم السكربت بوضع اللاعب في الاحداثيات (x,y,z) المحدده اعلاه, عند دخوله الى السيرفر&lt;br /&gt;
	لاحظ انه يجب استخدام  وظيفة [ ''fadeCamera'' ] ستكون الشاشة سوداء وأيضاً يجب تعيين الكاميرا ( setTargetCamera ) ..&lt;br /&gt;
&lt;br /&gt;
نرى أن '''source''' هو المصدر وهو اللاعب الذي يقوم بالدخول &lt;br /&gt;
&lt;br /&gt;
*[[addEventHandler]] - الاحداث وهي ما يجب فعله من قبل المستخدم او السيرفر&lt;br /&gt;
*[[function]] - وظيفة تعمل عند حدث من الاحداث وتحتوي على امر او أوامر&lt;br /&gt;
أيضاً لو رأينا في المعالج &lt;br /&gt;
*[[addEventHandler]] - إضافة معالج للحدث&lt;br /&gt;
نرى 3 أشياء&lt;br /&gt;
*: onPlayerJoin - عند دخول اللاعب&lt;br /&gt;
وهو الحدث .. حيث يحدد متى يتم تشغيل المعالج - في هذه الحالة عند دخول اللاعب&lt;br /&gt;
*getRootElement() - جلب العنصر الحالي&lt;br /&gt;
هذا يقوم بتعيين العنصر الذي يقوم بتشغيل الحدث &lt;br /&gt;
*joinHandler &lt;br /&gt;
وهو إسم الوظيفة التي قمنا بصناعتها &lt;br /&gt;
&lt;br /&gt;
يمكنك التوسع أكثر في : [[addEventHandler]]&lt;br /&gt;
&lt;br /&gt;
===تشغيل السكربت===&lt;br /&gt;
بعد أن تقوم بحفظ أجزاء السكربت في ملف واحد ويمكن حفظه في الملفات التالية :&lt;br /&gt;
* مجلد&lt;br /&gt;
* أرشيف .zip&lt;br /&gt;
ونقوم بنسخه إلى مجلد السكربتات داخل سيرفرك ونقوم بتشغيله بالطريقة العادية.&lt;br /&gt;
&lt;br /&gt;
الآن إنتهينا من صنع السكربت .. بعد هذا سنقوم بصنع سكربت مع أمر &lt;br /&gt;
* command&lt;br /&gt;
يمكنك المتابعة أو الذهاب إلى دورة صناعة النوافذ&lt;br /&gt;
*[[Introduction to Scripting GUI]]&lt;br /&gt;
&lt;br /&gt;
===إنشاء سكربت بطريقة مفصلة===&lt;br /&gt;
&lt;br /&gt;
==صناعة أمر بسيط==&lt;br /&gt;
لنعد الآن إلى ملف&lt;br /&gt;
*script.lua&lt;br /&gt;
ونقوم بتعديله قليلاً لإنشاء أمر بسيط يقوم بإنشاء سيارة بجانب اللاعب&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- في البداية نقوم بكتب وظيفة إنشاء السيارة&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
   -- هنا نقوم بكتابة وظيفة إنشاء السيارة كـ&lt;br /&gt;
   -- createVehicle&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- نقوم بإضافة الأمر&lt;br /&gt;
addCommandHandler(&amp;quot;createvehicle&amp;quot;, createVehicleForPlayer) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
''ملاحظة: يمكنك الضغط على الوظائف والتعمق فيها بداخل الويكي.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== الوظيفة ==&lt;br /&gt;
الوظيفة هي شيء يسمى&lt;br /&gt;
&lt;br /&gt;
function&lt;br /&gt;
&lt;br /&gt;
الوظيفة هي الشيء التي يتكون عليها الحدث&lt;br /&gt;
&lt;br /&gt;
يمكنك ان تسمي الوظيفة كما شئت ويمكنك أيضاً عدم وضع اسم للوظيفة&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''مثال لـ وظيفة لها إسم'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function arabs( ) -- الوظيفة&lt;br /&gt;
    outputChatBox(&amp;quot;مرحباً بك&amp;quot;) --s  ستلاحظ بـ أن كلمة &amp;quot; مرحباً بك &amp;quot; ظهرت في الشات عند دخول الاعب &lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, root, arabs) -- .الحدث مع اسم الوظيفة&lt;br /&gt;
-- root = getRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''مثال لـ وظيفة ليس لها إسم'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerWasted&amp;quot;, root,&lt;br /&gt;
function(_,killer)&lt;br /&gt;
    outputChatBox( killer .. &amp;quot; من قبل&amp;quot; .. getPlayerName(source) .. &amp;quot; لقد قُتل الاعب&amp;quot; )&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
كما تلاحظ ووضع قوس قريباً من&lt;br /&gt;
&lt;br /&gt;
end)&lt;br /&gt;
&lt;br /&gt;
هذا القوس يكمل القوس الآخر كما نلاحظ في الحدث &lt;br /&gt;
&lt;br /&gt;
addEventHandler(&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== الحدث ==&lt;br /&gt;
الحدث هو شيء يسمى&lt;br /&gt;
&lt;br /&gt;
event&lt;br /&gt;
&lt;br /&gt;
الحدث هو الذي يتكون على بناء الوظيفة&lt;br /&gt;
فـ اذا رجعنا الى الامثلة التي في الاعلى سوف نرى عدة احداث ومنها&lt;br /&gt;
&lt;br /&gt;
[[onPlayerWasted]]&lt;br /&gt;
&lt;br /&gt;
الحدث ببساطة يحدد متى سوف تحدث او كيف سوف تحدث الوظائف التي ادخلتها&lt;br /&gt;
&lt;br /&gt;
onPlayerWasted&lt;br /&gt;
&lt;br /&gt;
عند موت الاعب&lt;br /&gt;
&lt;br /&gt;
'''مثال للحدث'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onJoin()&lt;br /&gt;
    x, y, z = getElementPosition(source) -- s يآتي بمكان الاعب x, y, z&lt;br /&gt;
	    local theVehicle = createVehicle(445, x, y, z) -- s السيارة التي سـ تصنع بمكان الاعب الذي تم تحديده مسبقاً&lt;br /&gt;
		    warpPedIntoVehicle(source, theVehicle) -- s يجعل الاعب داخل السيارة&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, root, onJoin) -- s الحدث&lt;br /&gt;
-- root = getRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
هذه الوظيفة مع هذا الحدث سوف يعطون الاعب سيارة عند دخوله السيرفر&lt;br /&gt;
&lt;br /&gt;
ملاحظة الحدث ليس دائم على الوظيفة فـ أيصاً يمكنك تكوين هذه الوظيفة على حدث آخر&lt;br /&gt;
&lt;br /&gt;
'''مثال'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onJoin()&lt;br /&gt;
    x, y, z = getElementPosition(source)&lt;br /&gt;
	    local theVehicle = createVehicle(445, x, y, z)&lt;br /&gt;
		    warpPedIntoVehicle(source, theVehicle)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerLogin&amp;quot;, root, onJoin)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
هذا سوف يعطي الاعب سيارة لاكن ليس عند دخوله السيرفر , إنما عند دخوله حسابه&lt;br /&gt;
&lt;br /&gt;
'''Edit'''&lt;br /&gt;
&lt;br /&gt;
مثال آخر&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onVehicleExplode&amp;quot;,root, -- نضيف حدث عند إنفجار اي سيارة&lt;br /&gt;
    function() -- الوظيفة&lt;br /&gt;
        setTimer(destroyElement,5000,1,source) -- يخفي السيارة بعد 5 ثواني من انفاجرها &lt;br /&gt;
    end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
يمكنك ان تجد&lt;br /&gt;
الاحداث&lt;br /&gt;
والوظائف &lt;br /&gt;
كلنت وسيرفر&lt;br /&gt;
هنا&lt;br /&gt;
&lt;br /&gt;
كلنت:&lt;br /&gt;
&lt;br /&gt;
'''وظائف كلنت'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Client_Scripting_Functions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''احداث كلنت'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Client_Scripting_Events&lt;br /&gt;
&lt;br /&gt;
سيرفر:&lt;br /&gt;
&lt;br /&gt;
'''وظائف سيرفر'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Server_Scripting_Functions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''احداث سيرفر'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Server_Scripting_Events&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== String الـ ==&lt;br /&gt;
السترنج هو شيء يوجد في بعض الوظايف التي توجد داخل الام تي اي&lt;br /&gt;
&lt;br /&gt;
مثلاً&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onResourceStart&amp;quot;,resourceRoot, -- الايفنت هنا يجب ان تكون بين سترنق كما الموضح هنا&lt;br /&gt;
    function()&lt;br /&gt;
        outputChatBox(&amp;quot;تم بدء السكربت&amp;quot;) -- s هنا سوف يظهر رسالة بالشات &amp;quot; تم بدء السكربت &amp;quot; عند بدء السكربت ويجب ان تكون سترنق&lt;br /&gt;
    end&lt;br /&gt;
) -- نهاية قوس الحدث&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
السترنق له عدة أشكال , فيمكن ان يكون كالآتي&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
أو&lt;br /&gt;
&lt;br /&gt;
' '&lt;br /&gt;
&lt;br /&gt;
أو&lt;br /&gt;
&lt;br /&gt;
[[]]&lt;br /&gt;
&lt;br /&gt;
فمثلاً اذا نريد ان نخرج رسالة بعلبة الشات&lt;br /&gt;
&lt;br /&gt;
يمكن ان تكون كذلك &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
outputChatBox([[مرحباً]])&lt;br /&gt;
&lt;br /&gt;
-- أو كذلك&lt;br /&gt;
outputChatBox('مرحباً')&lt;br /&gt;
&lt;br /&gt;
-- أو كذلك&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;مرحباً&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Command handlerعن الـ====&lt;br /&gt;
.(`) أو زر F8 التي يمكن للاعب ان يعرضها باستخدام زر Consoleهو اسم الامر الذي يمكن للاعب ان يدخله في الـ [[addCommandHandler]] في argument أول&lt;br /&gt;
&lt;br /&gt;
.&amp;quot;createVehicleForPlayer&amp;quot;هي وظيفة تُنفذ عند كتابة اللاعب الامر في هذه الحالة لـ [[addCommandHandler]] في argument ثاني&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:اذا كنت متمرس في البرمجة, ستعرف انك ستحتاج ان تنفذ وظيفة مثل&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
functionName(argument1, argument2, argument3, ..)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
functionName(thePlayer, commandName, argument3, ..)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If we have a closer look on the lower example above, we can see argument1 is thePlayer and argument2 the commandName. thePlayer is simply the one who typed the command, so whatever you call it, the variable will contain the player who activated the command. commandName is simply the command they typed. So if they typed &amp;quot;/greet&amp;quot;, this argument will contain &amp;quot;greet&amp;quot;. Argument 3 is something extra the player typed, you'll learn it a little bit further in the tutorial. Never forget that the first 2 arguments are standard arguments, but you can name them to anything you want.&lt;br /&gt;
&lt;br /&gt;
We called the [[addCommandHandler]] function this way already and since ''createVehicleForPlayer'' is a function too, it can be called that way as well. But we are using a command handler for that, which calls it in a similiar manner, internally.&lt;br /&gt;
&lt;br /&gt;
For example: Someone types &amp;quot;createvehicle 468&amp;quot; ingame in the console to spawn a Sanchez, the command handler calls the createVehicleForPlayer function, as '''if''' we would have this line of code in the script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
createVehicleForPlayer(thePlayer,&amp;quot;createvehicle&amp;quot;,&amp;quot;468&amp;quot;) -- thePlayer هو الشيء الي كتب الكومند&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
As we can see, it provides several parameters: the player who called the command, the command he entered and whatever text he had after that, in this case &amp;quot;468&amp;quot; as vehicle id for the Sanchez. The first two parameters are the same with all command handlers, which you can read on the [[addEventHandler]] page. For this fact, you always have to define at least those two parameters to use any after that (for example to process text that was entered after the command, like in our example the vehicle model id).&lt;br /&gt;
&lt;br /&gt;
''Note: You have to add the command handler AFTER you defined the handler function, else it can't find it. The order of execution matters.''&lt;br /&gt;
&lt;br /&gt;
====Writing the function====&lt;br /&gt;
In order to fill the function we created, we need to think about what we have to do:&lt;br /&gt;
* Get the players position, so we know where to spawn the vehicle (we want it to appear right beside the player)&lt;br /&gt;
* Calculate the position we want to spawn the vehicle at (we don't want it to appear in the player)&lt;br /&gt;
* Spawn the vehicle&lt;br /&gt;
* Check if it has been spawned successfully, or output a message&lt;br /&gt;
&lt;br /&gt;
In order to achieve our goals, we have to use several functions. To find function we need to use, we should visit the [[Scripting Functions|Server Functions List]]. First we need a function to get the players position. Since players are Elements, we first jump to the '''Element functions''' where we find the [[getElementPosition]] function. By clicking on the function name in the list, you get to the function description. There we can see the syntax, what it returns and usually an example. The syntax shows us what arguments we can or have to submit.&lt;br /&gt;
&lt;br /&gt;
For [[getElementPosition]], the syntax is:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float, float, float getElementPosition ( element theElement )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three ''float'' in front of the function name are the return type. In this case it means the function returns three floating point numbers. (x, y and z) Within the parentheses, you can see what arguments you have to submit. In this case only the element whose position you want to get, which is the player in our example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	-- نأتي باحداثيات المكان الي نبغي نضع فيه السيارة بشكل x, y, z&lt;br /&gt;
	-- (local  تعني ان هاد الاختصار ما رح يشغل غير في هاد الفنكشن)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we want to ensure that the vehicle won't spawn directly in the player, so we add a few units to the ''x'' variable, which will make it spawn east from the player.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) -- نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- add 5 units to the x position&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we need another function, one to spawn a vehicle. We once again search for it on the [[Scripting Functions|Server Functions List]], this time - since we are talking about vehicles - in the '''Vehicle functions''' section, where we will choose [[createVehicle]]. In this function's syntax, we only have one return type (which is more common), a vehicle element that points to the vehicle we just created. Also, we see that some arguments are enclosed within [ ] which means that those are optional.&lt;br /&gt;
&lt;br /&gt;
We already have all arguments we need for [[createVehicle]] in our function: The position we just calculated in the ''x,y,z'' variables and the model id that we provided through the command (&amp;quot;createvehicle 468&amp;quot;) and can access in the function as ''vehicleModel'' variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) --  نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- add 5 units to the x position&lt;br /&gt;
	-- create the vehicle and store the returned vehicle element in the ''createdVehicle'' variable&lt;br /&gt;
	local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course this code can be improved in many ways, but at least we want to add a check whether the vehicle was created successfully or not. As we can read on the [[createVehicle]] page under '''Returns''', the function returns ''false'' when it was unable to create the vehicle. Thus, we check the value of the ''createVehicle'' variable.&lt;br /&gt;
&lt;br /&gt;
Now we have our complete script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) --  نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- نضيف 5 وحد ل الاحداثيات X&lt;br /&gt;
	local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z)&lt;br /&gt;
	-- نشوف لو السيارة اتعملت ام لا&lt;br /&gt;
	if (createdVehicle == false) then&lt;br /&gt;
		-- لو السياره اتعملت يبقي نعمل رسالة,لكن للاعب فقط&lt;br /&gt;
		outputChatBox(&amp;quot;Failed to create vehicle.&amp;quot;,thePlayer)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;createvehicle&amp;quot;, createVehicleForPlayer)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, we introduced another function with [[outputChatBox]]. By now, you should be able to explore the function's documentation page yourself. For more advanced scripting, please check out the [[Map manager|Map Manager]].&lt;br /&gt;
&lt;br /&gt;
==What you need to know==&lt;br /&gt;
You already read some things about resources, command handlers and finding functions in the documentation in the first paragraph, but there is much more to learn. This section will give you a rather short overview over some of these things, while linking to related pages if possible.&lt;br /&gt;
===Clientside and Serverside scripts===&lt;br /&gt;
You may have already noticed these or similiar terms (Server/Client) somewhere on this wiki, mostly in conjunction with functions. MTA not only supports scripts that run on the server and provide commands (like the one we wrote above) or other features, but also scripts that run on the MTA client the players use to connect to the server. The reason for this is, that some features MTA provides have to be clientside (like a GUI - Graphical User Interface), others should be because they work better and still others are better off to be serverside or just don't work clientside.&lt;br /&gt;
&lt;br /&gt;
Most scripts you will make (gamemodes, maps) will probably be serverside, like the one we wrote in the first section. If you run into something that can't be solved serverside, you will probably have to make it clientside. For a clientside script for example, you would create a ordinary script file (for example called ''client.lua'') and specify it in the meta.xml, like this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;client.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The ''type'' attribute defaults to 'server', so you only need to specify it for clientside scripts. When you do this, the clientside script will be downloaded to the player's computer once he connects to the server. Read more about [[Client side scripts]].&lt;br /&gt;
&lt;br /&gt;
===More complex resources===&lt;br /&gt;
The previous section showed briefly how to add clientside scripts to the resource, but there is also much more possible. As mentioned at the very top of this page, resources can be pretty much everything. Their purpose is defined by what they do. Let's have some theoretical resources, by looking at the files it contains, the ''meta.xml'' and what they might do:&lt;br /&gt;
&lt;br /&gt;
====First example - A utility script====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/admin_commands&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/commands.lua&lt;br /&gt;
	/client.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;admin commands&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;commands.lua&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;client.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''commands.lua'' provides some admin commands, like banning a player, muting or something else that can be used to admin the server&lt;br /&gt;
* The ''client.lua'' provides a GUI to be able to perform the mentioned actions easily&lt;br /&gt;
&lt;br /&gt;
This example might be running all the time (maybe even auto-started when the server starts) as it's useful during the whole gaming experience and also wont interfere with the gameplay, unless an admin decides to take some action of course.&lt;br /&gt;
&lt;br /&gt;
====Second example - A gamemode====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/counterstrike&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/counterstrike.lua&lt;br /&gt;
	/buymenu.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;Counterstrike remake&amp;quot; type=&amp;quot;gamemode&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;counterstrike.lua&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;buymenu.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''counterstrike.lua'' contains similiar to the following features:&lt;br /&gt;
** Let players choose their team and spawn them&lt;br /&gt;
** Provide them with weapons, targets and instructions (maybe read from a Map, see below)&lt;br /&gt;
** Define the game's rules, e.g. when does the round end, what happens when a player dies&lt;br /&gt;
** .. and maybe some more&lt;br /&gt;
* The ''buymenu.lua'' is a clientside script and creates a menu to buy weapons&lt;br /&gt;
&lt;br /&gt;
This example can be called a gamemode, since it not only intereferes with the gameplay, but actually defines the rules of it. The ''type'' attribute indicates that this example works with the [[Map manager]], yet another resource that was written by the QA Team to manage gamemodes and map loading. It is highly recommended that you base your gamemodes on the techniques it provides.&lt;br /&gt;
&lt;br /&gt;
This also means that the gamemode probably won't run without a map. Gamemodes should always be as generic as possible. An example for a map is stated in the next example.&lt;br /&gt;
&lt;br /&gt;
====Third example - A Map====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/cs-airport&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/airport.map&lt;br /&gt;
	/airport.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;Counterstrike airport map&amp;quot; type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;counterstrike&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;map src=&amp;quot;airport.map&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;airport.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''airport.map'' in a XML file that provides information about the map to the gamemode, these may include:&lt;br /&gt;
** Where the players should spawn, with what weapons, what teams there are&lt;br /&gt;
** What the targets are&lt;br /&gt;
** Weather, World Time, Timelimit&lt;br /&gt;
** Provide vehicles&lt;br /&gt;
* The ''airport.lua'' might contain map-specific features, that may include:&lt;br /&gt;
** Opening some door/make something explode when something specific happens&lt;br /&gt;
** Create or move some custom objects, or manipulate objects that are created through the .map file&lt;br /&gt;
** .. anything else map-specific you can think of&lt;br /&gt;
&lt;br /&gt;
As you can see, the ''type'' attribute changed to 'map', telling the [[Map manager]] that this resource is a map, while the ''gamemodes'' attribute tells it for which gamemodes this map is valid, in this case the gamemode from the above example.&lt;br /&gt;
What may come as a surprise is that there is also a script in the Map resource. Of course this is not necessarily needed in a map, but opens a wide range of possibilities for map makers to create their own world within the rules of the gamemode they create it for.&lt;br /&gt;
&lt;br /&gt;
The ''airport.map'' file might look similiar to this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map mode=&amp;quot;deathmatch&amp;quot; version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;terrorists&amp;gt;&lt;br /&gt;
		&amp;lt;spawnpoint posX=&amp;quot;2332.23&amp;quot; posY=&amp;quot;-12232.33&amp;quot; posZ=&amp;quot;4.42223&amp;quot; skins=&amp;quot;23-40&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/terrorists&amp;gt;&lt;br /&gt;
	&amp;lt;counterterrorists&amp;gt;&lt;br /&gt;
		&amp;lt;spawnpoint posX=&amp;quot;2334.23443&amp;quot; posY=&amp;quot;-12300.233&amp;quot; posZ=&amp;quot;10.2344&amp;quot; skins=&amp;quot;40-50&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/counterterrorists&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;bomb posX=&amp;quot;23342.23&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
	&amp;lt;vehicle posX=&amp;quot;&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; model=&amp;quot;602&amp;quot; /&amp;gt;	&lt;br /&gt;
	&amp;lt;vehicle posX=&amp;quot;&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; model=&amp;quot;603&amp;quot; /&amp;gt;	&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When a gamemode is started with a map, the map resources is automatically started by the mapmanager and the information it contains can be read by the gamemode resource. When the map changes, the current map resource is stopped and the next map resource is started. For a more in-depth explanation and examples of how map resources are utilized in the main script, please visit the [[Writing Gamemodes]] page.&lt;br /&gt;
&lt;br /&gt;
===Events===&lt;br /&gt;
Events are the way MTA tells scripts about things that happen. For example when a player dies, the [[onPlayerWasted]] event is triggered. In order to perform any actions when a player dies, you have to prepare yourself similiar to adding a command handler, as shown in [[#Writing_the_script|the first chapter]].&lt;br /&gt;
&lt;br /&gt;
This example will output a message with the name of the player who died:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function playerDied(totalAmmo, killer, killerWeapon, bodypart)&lt;br /&gt;
	outputChatBox(getPlayerName(source)..&amp;quot; died!&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerWasted&amp;quot;,getRootElement(),playerDied)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead of showing what arguments are needed, the documentation page for Events shows what parameters are passed to the handler function, similiar to the way a [[#About_command_handlers|command handler]] does, just that it is different from event to event. Another important point is the ''source'' variable, that exists in handler functions. It doesn't have to be added to the parameter list of the function, but it still exists. It has a different value from event to event, for player events (as in the example above) it is the player element. As another example, you can take a look at the basic spawning player script in the first section to get an idea how ''source'' is used.&lt;br /&gt;
&lt;br /&gt;
==Where to go from here==&lt;br /&gt;
You should now be familiar with the most basic aspects of MTA scripting and also a bit with the documentation. The [[Main Page]] provides you with links to more information, Tutorials and References that allow a deeper look into the topics you desire to learn about.&lt;br /&gt;
&lt;br /&gt;
From here we recommend reading the [[debugging]] tutorial. Good debugging skills are an absolute necessity when you are making scripts.&lt;br /&gt;
&lt;br /&gt;
[[ru:Scripting Introduction]]&lt;br /&gt;
[[it:Introduzione allo scripting]]&lt;br /&gt;
[[es:Introducción a la Programación]]&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/%D9%85%D9%82%D8%AF%D9%85%D9%87_%D9%81%D9%8A_%D8%A7%D9%84%D8%A8%D8%B1%D9%85%D8%AC%D9%87&amp;diff=49197</id>
		<title>AR/مقدمه في البرمجه</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/%D9%85%D9%82%D8%AF%D9%85%D9%87_%D9%81%D9%8A_%D8%A7%D9%84%D8%A8%D8%B1%D9%85%D8%AC%D9%87&amp;diff=49197"/>
		<updated>2016-09-19T15:58:31Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p align=&amp;quot;right&amp;quot;&amp;gt;&lt;br /&gt;
==بداية ==  &lt;br /&gt;
 تختلف أنواع السكربتات فمنها خريطة أو وضع للعب &lt;br /&gt;
&lt;br /&gt;
MTA السكربتات جزء اساسي في تشغيل&lt;br /&gt;
&lt;br /&gt;
...وغيرها &amp;quot; freeroam , race , deathmatch &amp;quot; فتستطيع بإستخدامهم إنشاء تطبيقات لتحسين اللعب &lt;br /&gt;
&lt;br /&gt;
(Lua) [www.lua.org] برمجة السكربتات تعتمد على لغة البرمجة&lt;br /&gt;
&lt;br /&gt;
لغة البرمجة تعتمد إعتماداً كلياً على اللغة الإنجليزية , فيجب أن تكون لديك خلفية في اللغة الإنجليزية قبل المتابعة.&lt;br /&gt;
&lt;br /&gt;
لبرمجة سكربت ما تحتاج لمحرر .. ويفضل إستخدام محرر إحترافي لكي يسهل عليك البرمجة مثل :&lt;br /&gt;
*Notepad++ [http://notepad-plus-plus.org/download]&lt;br /&gt;
*Lua Edit [http://luaedit.sourceforge.net/ LuaEdit]&lt;br /&gt;
&lt;br /&gt;
 فهو يسهل برمجتها MTASE لكن يفضل استخدام برنامج :&lt;br /&gt;
* [[MTASE|MTA Script Editor]].'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==إنشاء سكربت ==&lt;br /&gt;
&lt;br /&gt;
سوف نتعلم كيف نقوم بإنشاء سكربت يدخل اللاعب إلى اللعبة .. خطوة بحطوة&lt;br /&gt;
&lt;br /&gt;
اولا لا بد من معرفة انواع ملفات السكربت    &lt;br /&gt;
                                                                                                          &lt;br /&gt;
1-Meta.xml -- يقوم هذا الملف بتعرف الملفات الموجود في السكربت للسيرفر               &lt;br /&gt;
                                                                                          &lt;br /&gt;
2-Client -- يقوم هذا الملف بتشغيل جميع أوامر المتعلقة بالاعب فقط                                       &lt;br /&gt;
&lt;br /&gt;
3-Server -- يقوم هذا الملف بتشغيل جميع الاوامر سواء كانت للسيرفر او الاعب&lt;br /&gt;
&lt;br /&gt;
===أين مسار كل البرامج النصية (السكريبتات أو المودات)؟===&lt;br /&gt;
الان نتعرف على مجلد المودات أو السكربتات.&lt;br /&gt;
اذهب إلى مجلد Multi Theft Auto واتبع المسار التالي:&lt;br /&gt;
&lt;br /&gt;
	/Your MTA Server/mods/deathmatch/resources/&lt;br /&gt;
&lt;br /&gt;
. أو مجلد عادي zip سترى الكثير من الملفات. ربما ترى مجلدات صيغتها , MTA .. وجميعها يقبله الـ&lt;br /&gt;
&lt;br /&gt;
وهو الذي سنستخدمه بالبرنامج التعليمي &amp;quot;myserver&amp;quot; ولإنشاء المودات الخاصة بك: قم بعمل مجلد جديد واجعل اسمه كما تريد فمثلاً قم بتسميته &lt;br /&gt;
&lt;br /&gt;
والان يجب أن يكون مسار المجلد الذي قمت بعمله هذا:&lt;br /&gt;
&lt;br /&gt;
	/Your MTA Server/mods/deathmatch/resources/myserver/&lt;br /&gt;
&lt;br /&gt;
* myserver: اسم المجلد الذي قمت بتسميته&lt;br /&gt;
&lt;br /&gt;
=== meta.xml تعريف السكربت اضافة ملف===&lt;br /&gt;
حتى يستطيع السيرفر من معرفة المودات, يجب علينا إنشاء ملف meta.xml &lt;br /&gt;
&lt;br /&gt;
&amp;quot; ويكون بداخل مجلد السكربت الذي قمنا بإنشائه وهو &amp;quot;myserver&amp;quot; &lt;br /&gt;
&lt;br /&gt;
ولإنشاء ملف meta.xml :&lt;br /&gt;
&lt;br /&gt;
وافتحه باستخدام المفكرة =) meta.xml أفتح ملف نصي جديد وقم بتسميته&lt;br /&gt;
&lt;br /&gt;
ولا تنسى ان يكون بداخل مجلد السكربت .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
أدخل الكود التالي في ملف ''meta.xml'':&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
     &amp;lt;info author=&amp;quot;إسمك&amp;quot; type=&amp;quot;gamemode&amp;quot; name=&amp;quot;إسم السكربت&amp;quot; description=&amp;quot;وصف بسيط للسكربت&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;script src=&amp;quot;script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
هنا يتم تعريف أجزاء السكربت فمثلاً :&lt;br /&gt;
* &amp;lt;info ..&amp;gt;&lt;br /&gt;
تضع فيه بيانات السكربت .. مثل الإسم والنوع والوصف&lt;br /&gt;
* type=&amp;quot;gamemode&amp;quot;&lt;br /&gt;
تعني أن نوع السكربت هو مود لعب وتوجد أنواع عديدة مثل :&lt;br /&gt;
**gamemode&lt;br /&gt;
**map&lt;br /&gt;
**script&lt;br /&gt;
&lt;br /&gt;
===إنشاء ملف السكربت Lua===&lt;br /&gt;
قمنا بوضع هذا السطر في :&lt;br /&gt;
*meta.xml&lt;br /&gt;
:&lt;br /&gt;
		&amp;lt;script src=&amp;quot;script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
الآن نقوم بإنشاء ملف نصي بنفس الإسم&lt;br /&gt;
**script.lua&lt;br /&gt;
بإستخدام برنامج التحرير لديك .. نقوم بإنشاء الكود&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function joinHandler() -- الوظيفة .. وبعدها نقوم بكتابة الإسم&lt;br /&gt;
	local x = 1959.55 -- تعريف x&lt;br /&gt;
	local y = -1714.46 -- تعريف y&lt;br /&gt;
	local z = 10 -- تعريف z&lt;br /&gt;
	spawnPlayer(source, x, y, z) -- نقوم بإستخدام هذه الوظيفة لإنتاج اللاعب ونقوم بتحديد اللاعب وهو المصدر : source&lt;br /&gt;
	fadeCamera(source, true) -- نقوم بعمل fade للكاميرا&lt;br /&gt;
	setCameraTarget(source, source) -- نجعل هدف الكاميرا هو اللاعب &lt;br /&gt;
	outputChatBox(&amp;quot;مرحباً بك في السيرفر&amp;quot;, source) -- نقوم بإخراج نص في الدردشة&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, getRootElement(), joinHandler) -- نقوم بإضافة المعالج حيث سيتم تشغيله بعد الحدث المحدد وهو عند دخول اللا&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
وصف وشرح الكود اعلاه : &lt;br /&gt;
	سيقوم السكربت بوضع اللاعب في الاحداثيات (x,y,z) المحدده اعلاه, عند دخوله الى السيرفر&lt;br /&gt;
	لاحظ انه يجب استخدام  وظيفة [ ''fadeCamera'' ] ستكون الشاشة سوداء وأيضاً يجب تعيين الكاميرا ( setTargetCamera ) ..&lt;br /&gt;
&lt;br /&gt;
نرى أن '''source''' هو المصدر وهو اللاعب الذي يقوم بالدخول &lt;br /&gt;
&lt;br /&gt;
*[[addEventHandler]] - الاحداث وهي ما يجب فعله من قبل المستخدم او السيرفر&lt;br /&gt;
*[[function]] - وظيفة تعمل عند حدث من الاحداث وتحتوي على امر او أوامر&lt;br /&gt;
أيضاً لو رأينا في المعالج &lt;br /&gt;
*[[addEventHandler]] - إضافة معالج للحدث&lt;br /&gt;
نرى 3 أشياء&lt;br /&gt;
*: onPlayerJoin - عند دخول اللاعب&lt;br /&gt;
وهو الحدث .. حيث يحدد متى يتم تشغيل المعالج - في هذه الحالة عند دخول اللاعب&lt;br /&gt;
*getRootElement() - جلب العنصر الحالي&lt;br /&gt;
هذا يقوم بتعيين العنصر الذي يقوم بتشغيل الحدث &lt;br /&gt;
*joinHandler &lt;br /&gt;
وهو إسم الوظيفة التي قمنا بصناعتها &lt;br /&gt;
&lt;br /&gt;
يمكنك التوسع أكثر في : [[addEventHandler]]&lt;br /&gt;
&lt;br /&gt;
===تشغيل السكربت===&lt;br /&gt;
بعد أن تقوم بحفظ أجزاء السكربت في ملف واحد ويمكن حفظه في الملفات التالية :&lt;br /&gt;
* مجلد&lt;br /&gt;
* أرشيف .zip&lt;br /&gt;
ونقوم بنسخه إلى مجلد السكربتات داخل سيرفرك ونقوم بتشغيله بالطريقة العادية.&lt;br /&gt;
&lt;br /&gt;
الآن إنتهينا من صنع السكربت .. بعد هذا سنقوم بصنع سكربت مع أمر &lt;br /&gt;
* command&lt;br /&gt;
يمكنك المتابعة أو الذهاب إلى دورة صناعة النوافذ&lt;br /&gt;
*[[Introduction to Scripting GUI]]&lt;br /&gt;
&lt;br /&gt;
===إنشاء سكربت بطريقة مفصلة===&lt;br /&gt;
&lt;br /&gt;
==صناعة أمر بسيط==&lt;br /&gt;
لنعد الآن إلى ملف&lt;br /&gt;
*script.lua&lt;br /&gt;
ونقوم بتعديله قليلاً لإنشاء أمر بسيط يقوم بإنشاء سيارة بجانب اللاعب&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- في البداية نقوم بكتب وظيفة إنشاء السيارة&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
   -- هنا نقوم بكتابة وظيفة إنشاء السيارة كـ&lt;br /&gt;
   -- createVehicle&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- نقوم بإضافة الأمر&lt;br /&gt;
addCommandHandler(&amp;quot;createvehicle&amp;quot;, createVehicleForPlayer) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
''ملاحظة: يمكنك الضغط على الوظائف والتعمق فيها بداخل الويكي.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== الوظيفة ==&lt;br /&gt;
الوظيفة هي شيء يسمى&lt;br /&gt;
&lt;br /&gt;
function&lt;br /&gt;
&lt;br /&gt;
الوظيفة هي الشيء التي يتكون عليها الحدث&lt;br /&gt;
&lt;br /&gt;
يمكنك ان تسمي الوظيفة كما شئت ويمكنك أيضاً عدم وضع اسم للوظيفة&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''مثال لـ وظيفة لها إسم'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function arabs( ) -- الوظيفة&lt;br /&gt;
    outputChatBox(&amp;quot;مرحباً بك&amp;quot;) --s  ستلاحظ بـ أن كلمة &amp;quot; مرحباً بك &amp;quot; ظهرت في الشات عند دخول الاعب &lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, root, arabs) -- .الحدث مع اسم الوظيفة&lt;br /&gt;
-- root = getRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''مثال لـ وظيفة ليس لها إسم'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerWasted&amp;quot;, root,&lt;br /&gt;
function(_,killer)&lt;br /&gt;
    outputChatBox( killer .. &amp;quot; من قبل&amp;quot; .. getPlayerName(source) .. &amp;quot; لقد قُتل الاعب&amp;quot; )&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
كما تلاحظ ووضع قوس قريباً من&lt;br /&gt;
&lt;br /&gt;
end)&lt;br /&gt;
&lt;br /&gt;
هذا القوس يكمل القوس الآخر كما نلاحظ في الحدث &lt;br /&gt;
&lt;br /&gt;
addEventHandler(&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== الحدث ==&lt;br /&gt;
الحدث هو شيء يسمى&lt;br /&gt;
&lt;br /&gt;
event&lt;br /&gt;
&lt;br /&gt;
الحدث هو الذي يتكون على بناء الوظيفة&lt;br /&gt;
فـ اذا رجعنا الى الامثلة التي في الاعلى سوف نرى عدة احداث ومنها&lt;br /&gt;
&lt;br /&gt;
[[onPlayerWasted]]&lt;br /&gt;
&lt;br /&gt;
الحدث ببساطة يحدد متى سوف تحدث او كيف سوف تحدث الوظائف التي ادخلتها&lt;br /&gt;
&lt;br /&gt;
onPlayerWasted&lt;br /&gt;
&lt;br /&gt;
عند موت الاعب&lt;br /&gt;
&lt;br /&gt;
'''مثال للحدث'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onJoin()&lt;br /&gt;
    x, y, z = getElementPosition(source) -- s يآتي بمكان الاعب x, y, z&lt;br /&gt;
	    local theVehicle = createVehicle(445, x, y, z) -- s السيارة التي سـ تصنع بمكان الاعب الذي تم تحديده مسبقاً&lt;br /&gt;
		    warpPedIntoVehicle(source, theVehicle) -- s يجعل الاعب داخل السيارة&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, root, onJoin) -- s الحدث&lt;br /&gt;
-- root = getRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
هذه الوظيفة مع هذا الحدث سوف يعطون الاعب سيارة عند دخوله السيرفر&lt;br /&gt;
&lt;br /&gt;
ملاحظة الحدث ليس دائم على الوظيفة فـ أيصاً يمكنك تكوين هذه الوظيفة على حدث آخر&lt;br /&gt;
&lt;br /&gt;
'''مثال'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onJoin()&lt;br /&gt;
    x, y, z = getElementPosition(source)&lt;br /&gt;
	    local theVehicle = createVehicle(445, x, y, z)&lt;br /&gt;
		    warpPedIntoVehicle(source, theVehicle)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerLogin&amp;quot;, root, onJoin)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
هذا سوف يعطي الاعب سيارة لاكن ليس عند دخوله السيرفر , إنما عند دخوله حسابه&lt;br /&gt;
&lt;br /&gt;
'''Edit'''&lt;br /&gt;
&lt;br /&gt;
مثال آخر&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onVehicleExplode&amp;quot;,root, -- نضيف حدث عند إنفجار اي سيارة&lt;br /&gt;
    function() -- الوظيفة&lt;br /&gt;
        setTimer(destroyElement,5000,1,source) -- يخفي السيارة بعد 5 ثواني من انفاجرها &lt;br /&gt;
    end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
يمكنك ان تجد&lt;br /&gt;
الاحداث&lt;br /&gt;
والوظائف &lt;br /&gt;
كلنت وسيرفر&lt;br /&gt;
هنا&lt;br /&gt;
&lt;br /&gt;
كلنت:&lt;br /&gt;
&lt;br /&gt;
'''وظائف كلنت'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Client_Scripting_Functions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''احداث كلنت'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Client_Scripting_Events&lt;br /&gt;
&lt;br /&gt;
سيرفر:&lt;br /&gt;
&lt;br /&gt;
'''وظائف سيرفر'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Server_Scripting_Functions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''احداث سيرفر'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Server_Scripting_Events&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== String الـ ==&lt;br /&gt;
السترنج هو شيء يوجد في بعض الوظايف التي توجد داخل الام تي اي&lt;br /&gt;
&lt;br /&gt;
مثلاً&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onResourceStart&amp;quot;,resourceRoot, -- الايفنت هنا يجب ان تكون بين سترنق كما الموضح هنا&lt;br /&gt;
    function()&lt;br /&gt;
        outputChatBox(&amp;quot;تم بدء السكربت&amp;quot;) -- s هنا سوف يظهر رسالة بالشات &amp;quot; تم بدء السكربت &amp;quot; عند بدء السكربت ويجب ان تكون سترنق&lt;br /&gt;
    end&lt;br /&gt;
) -- نهاية قوس الحدث&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
السترنق له عدة أشكال , فيمكن ان يكون كالآتي&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
أو&lt;br /&gt;
&lt;br /&gt;
' '&lt;br /&gt;
&lt;br /&gt;
أو&lt;br /&gt;
&lt;br /&gt;
[[]]&lt;br /&gt;
&lt;br /&gt;
فمثلاً اذا نريد ان نخرج رسالة بعلبة الشات&lt;br /&gt;
&lt;br /&gt;
يمكن ان تكون كذلك &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
outputChatBox([[مرحباً]])&lt;br /&gt;
&lt;br /&gt;
-- أو كذلك&lt;br /&gt;
outputChatBox('مرحباً')&lt;br /&gt;
&lt;br /&gt;
-- أو كذلك&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;مرحباً&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Command handlerعن الـ====&lt;br /&gt;
.(`) أو زر F8 التي يمكن للاعب ان يعرضها باستخدام زر Consoleهو اسم الامر الذي يمكن للاعب ان يدخله في الـ [[addCommandHandler]] في argument أول&lt;br /&gt;
&lt;br /&gt;
.&amp;quot;createVehicleForPlayer&amp;quot;هي وظيفة تُنفذ عند كتابة اللاعب الامر في هذه الحالة لـ [[addCommandHandler]] في argument ثاني&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:اذا كنت متمرس في البرمجة, ستعرف انك ستحتاج ان تنفذ وظيفة مثل&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
functionName(argument1, argument2, argument3, ..)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
functionName(thePlayer, commandName, argument3, ..)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If we have a closer look on the lower example above, we can see argument1 is thePlayer and argument2 the commandName. thePlayer is simply the one who typed the command, so whatever you call it, the variable will contain the player who activated the command. commandName is simply the command they typed. So if they typed &amp;quot;/greet&amp;quot;, this argument will contain &amp;quot;greet&amp;quot;. Argument 3 is something extra the player typed, you'll learn it a little bit further in the tutorial. Never forget that the first 2 arguments are standard arguments, but you can name them to anything you want.&lt;br /&gt;
&lt;br /&gt;
We called the [[addCommandHandler]] function this way already and since ''createVehicleForPlayer'' is a function too, it can be called that way as well. But we are using a command handler for that, which calls it in a similiar manner, internally.&lt;br /&gt;
&lt;br /&gt;
For example: Someone types &amp;quot;createvehicle 468&amp;quot; ingame in the console to spawn a Sanchez, the command handler calls the createVehicleForPlayer function, as '''if''' we would have this line of code in the script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
createVehicleForPlayer(thePlayer,&amp;quot;createvehicle&amp;quot;,&amp;quot;468&amp;quot;) -- thePlayer هو الشيء الي كتب الكومند&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
As we can see, it provides several parameters: the player who called the command, the command he entered and whatever text he had after that, in this case &amp;quot;468&amp;quot; as vehicle id for the Sanchez. The first two parameters are the same with all command handlers, which you can read on the [[addEventHandler]] page. For this fact, you always have to define at least those two parameters to use any after that (for example to process text that was entered after the command, like in our example the vehicle model id).&lt;br /&gt;
&lt;br /&gt;
''Note: You have to add the command handler AFTER you defined the handler function, else it can't find it. The order of execution matters.''&lt;br /&gt;
&lt;br /&gt;
====Writing the function====&lt;br /&gt;
In order to fill the function we created, we need to think about what we have to do:&lt;br /&gt;
* Get the players position, so we know where to spawn the vehicle (we want it to appear right beside the player)&lt;br /&gt;
* Calculate the position we want to spawn the vehicle at (we don't want it to appear in the player)&lt;br /&gt;
* Spawn the vehicle&lt;br /&gt;
* Check if it has been spawned successfully, or output a message&lt;br /&gt;
&lt;br /&gt;
In order to achieve our goals, we have to use several functions. To find function we need to use, we should visit the [[Scripting Functions|Server Functions List]]. First we need a function to get the players position. Since players are Elements, we first jump to the '''Element functions''' where we find the [[getElementPosition]] function. By clicking on the function name in the list, you get to the function description. There we can see the syntax, what it returns and usually an example. The syntax shows us what arguments we can or have to submit.&lt;br /&gt;
&lt;br /&gt;
For [[getElementPosition]], the syntax is:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float, float, float getElementPosition ( element theElement )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three ''float'' in front of the function name are the return type. In this case it means the function returns three floating point numbers. (x, y and z) Within the parentheses, you can see what arguments you have to submit. In this case only the element whose position you want to get, which is the player in our example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	-- نأتي باحداثيات المكان الي نبغي نضع فيه السيارة بشكل x, y, z&lt;br /&gt;
	-- (local  تعني ان هاد الاختصار ما رح يشغل غير في هاد الفنكشن)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we want to ensure that the vehicle won't spawn directly in the player, so we add a few units to the ''x'' variable, which will make it spawn east from the player.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) -- نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- add 5 units to the x position&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we need another function, one to spawn a vehicle. We once again search for it on the [[Scripting Functions|Server Functions List]], this time - since we are talking about vehicles - in the '''Vehicle functions''' section, where we will choose [[createVehicle]]. In this function's syntax, we only have one return type (which is more common), a vehicle element that points to the vehicle we just created. Also, we see that some arguments are enclosed within [ ] which means that those are optional.&lt;br /&gt;
&lt;br /&gt;
We already have all arguments we need for [[createVehicle]] in our function: The position we just calculated in the ''x,y,z'' variables and the model id that we provided through the command (&amp;quot;createvehicle 468&amp;quot;) and can access in the function as ''vehicleModel'' variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) --  نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- add 5 units to the x position&lt;br /&gt;
	-- create the vehicle and store the returned vehicle element in the ''createdVehicle'' variable&lt;br /&gt;
	local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course this code can be improved in many ways, but at least we want to add a check whether the vehicle was created successfully or not. As we can read on the [[createVehicle]] page under '''Returns''', the function returns ''false'' when it was unable to create the vehicle. Thus, we check the value of the ''createVehicle'' variable.&lt;br /&gt;
&lt;br /&gt;
Now we have our complete script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) --  نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- نضيف 5 وحد ل الاحداثيات X&lt;br /&gt;
	local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z)&lt;br /&gt;
	-- نشوف لو السيارة اتعملت ام لا&lt;br /&gt;
	if (createdVehicle == false) then&lt;br /&gt;
		-- لو السياره اتعملت يبقي نعمل رسالة,لكن للاعب فقط&lt;br /&gt;
		outputChatBox(&amp;quot;Failed to create vehicle.&amp;quot;,thePlayer)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;createvehicle&amp;quot;, createVehicleForPlayer)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, we introduced another function with [[outputChatBox]]. By now, you should be able to explore the function's documentation page yourself. For more advanced scripting, please check out the [[Map manager|Map Manager]].&lt;br /&gt;
&lt;br /&gt;
==What you need to know==&lt;br /&gt;
You already read some things about resources, command handlers and finding functions in the documentation in the first paragraph, but there is much more to learn. This section will give you a rather short overview over some of these things, while linking to related pages if possible.&lt;br /&gt;
===Clientside and Serverside scripts===&lt;br /&gt;
You may have already noticed these or similiar terms (Server/Client) somewhere on this wiki, mostly in conjunction with functions. MTA not only supports scripts that run on the server and provide commands (like the one we wrote above) or other features, but also scripts that run on the MTA client the players use to connect to the server. The reason for this is, that some features MTA provides have to be clientside (like a GUI - Graphical User Interface), others should be because they work better and still others are better off to be serverside or just don't work clientside.&lt;br /&gt;
&lt;br /&gt;
Most scripts you will make (gamemodes, maps) will probably be serverside, like the one we wrote in the first section. If you run into something that can't be solved serverside, you will probably have to make it clientside. For a clientside script for example, you would create a ordinary script file (for example called ''client.lua'') and specify it in the meta.xml, like this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;client.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The ''type'' attribute defaults to 'server', so you only need to specify it for clientside scripts. When you do this, the clientside script will be downloaded to the player's computer once he connects to the server. Read more about [[Client side scripts]].&lt;br /&gt;
&lt;br /&gt;
===More complex resources===&lt;br /&gt;
The previous section showed briefly how to add clientside scripts to the resource, but there is also much more possible. As mentioned at the very top of this page, resources can be pretty much everything. Their purpose is defined by what they do. Let's have some theoretical resources, by looking at the files it contains, the ''meta.xml'' and what they might do:&lt;br /&gt;
&lt;br /&gt;
====First example - A utility script====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/admin_commands&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/commands.lua&lt;br /&gt;
	/client.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;admin commands&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;commands.lua&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;client.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''commands.lua'' provides some admin commands, like banning a player, muting or something else that can be used to admin the server&lt;br /&gt;
* The ''client.lua'' provides a GUI to be able to perform the mentioned actions easily&lt;br /&gt;
&lt;br /&gt;
This example might be running all the time (maybe even auto-started when the server starts) as it's useful during the whole gaming experience and also wont interfere with the gameplay, unless an admin decides to take some action of course.&lt;br /&gt;
&lt;br /&gt;
====Second example - A gamemode====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/counterstrike&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/counterstrike.lua&lt;br /&gt;
	/buymenu.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;Counterstrike remake&amp;quot; type=&amp;quot;gamemode&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;counterstrike.lua&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;buymenu.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''counterstrike.lua'' contains similiar to the following features:&lt;br /&gt;
** Let players choose their team and spawn them&lt;br /&gt;
** Provide them with weapons, targets and instructions (maybe read from a Map, see below)&lt;br /&gt;
** Define the game's rules, e.g. when does the round end, what happens when a player dies&lt;br /&gt;
** .. and maybe some more&lt;br /&gt;
* The ''buymenu.lua'' is a clientside script and creates a menu to buy weapons&lt;br /&gt;
&lt;br /&gt;
This example can be called a gamemode, since it not only intereferes with the gameplay, but actually defines the rules of it. The ''type'' attribute indicates that this example works with the [[Map manager]], yet another resource that was written by the QA Team to manage gamemodes and map loading. It is highly recommended that you base your gamemodes on the techniques it provides.&lt;br /&gt;
&lt;br /&gt;
This also means that the gamemode probably won't run without a map. Gamemodes should always be as generic as possible. An example for a map is stated in the next example.&lt;br /&gt;
&lt;br /&gt;
====Third example - A Map====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/cs-airport&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/airport.map&lt;br /&gt;
	/airport.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;Counterstrike airport map&amp;quot; type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;counterstrike&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;map src=&amp;quot;airport.map&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;airport.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''airport.map'' in a XML file that provides information about the map to the gamemode, these may include:&lt;br /&gt;
** Where the players should spawn, with what weapons, what teams there are&lt;br /&gt;
** What the targets are&lt;br /&gt;
** Weather, World Time, Timelimit&lt;br /&gt;
** Provide vehicles&lt;br /&gt;
* The ''airport.lua'' might contain map-specific features, that may include:&lt;br /&gt;
** Opening some door/make something explode when something specific happens&lt;br /&gt;
** Create or move some custom objects, or manipulate objects that are created through the .map file&lt;br /&gt;
** .. anything else map-specific you can think of&lt;br /&gt;
&lt;br /&gt;
As you can see, the ''type'' attribute changed to 'map', telling the [[Map manager]] that this resource is a map, while the ''gamemodes'' attribute tells it for which gamemodes this map is valid, in this case the gamemode from the above example.&lt;br /&gt;
What may come as a surprise is that there is also a script in the Map resource. Of course this is not necessarily needed in a map, but opens a wide range of possibilities for map makers to create their own world within the rules of the gamemode they create it for.&lt;br /&gt;
&lt;br /&gt;
The ''airport.map'' file might look similiar to this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map mode=&amp;quot;deathmatch&amp;quot; version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;terrorists&amp;gt;&lt;br /&gt;
		&amp;lt;spawnpoint posX=&amp;quot;2332.23&amp;quot; posY=&amp;quot;-12232.33&amp;quot; posZ=&amp;quot;4.42223&amp;quot; skins=&amp;quot;23-40&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/terrorists&amp;gt;&lt;br /&gt;
	&amp;lt;counterterrorists&amp;gt;&lt;br /&gt;
		&amp;lt;spawnpoint posX=&amp;quot;2334.23443&amp;quot; posY=&amp;quot;-12300.233&amp;quot; posZ=&amp;quot;10.2344&amp;quot; skins=&amp;quot;40-50&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/counterterrorists&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;bomb posX=&amp;quot;23342.23&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
	&amp;lt;vehicle posX=&amp;quot;&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; model=&amp;quot;602&amp;quot; /&amp;gt;	&lt;br /&gt;
	&amp;lt;vehicle posX=&amp;quot;&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; model=&amp;quot;603&amp;quot; /&amp;gt;	&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When a gamemode is started with a map, the map resources is automatically started by the mapmanager and the information it contains can be read by the gamemode resource. When the map changes, the current map resource is stopped and the next map resource is started. For a more in-depth explanation and examples of how map resources are utilized in the main script, please visit the [[Writing Gamemodes]] page.&lt;br /&gt;
&lt;br /&gt;
===Events===&lt;br /&gt;
Events are the way MTA tells scripts about things that happen. For example when a player dies, the [[onPlayerWasted]] event is triggered. In order to perform any actions when a player dies, you have to prepare yourself similiar to adding a command handler, as shown in [[#Writing_the_script|the first chapter]].&lt;br /&gt;
&lt;br /&gt;
This example will output a message with the name of the player who died:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function playerDied(totalAmmo, killer, killerWeapon, bodypart)&lt;br /&gt;
	outputChatBox(getPlayerName(source)..&amp;quot; died!&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerWasted&amp;quot;,getRootElement(),playerDied)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead of showing what arguments are needed, the documentation page for Events shows what parameters are passed to the handler function, similiar to the way a [[#About_command_handlers|command handler]] does, just that it is different from event to event. Another important point is the ''source'' variable, that exists in handler functions. It doesn't have to be added to the parameter list of the function, but it still exists. It has a different value from event to event, for player events (as in the example above) it is the player element. As another example, you can take a look at the basic spawning player script in the first section to get an idea how ''source'' is used.&lt;br /&gt;
&lt;br /&gt;
==Where to go from here==&lt;br /&gt;
You should now be familiar with the most basic aspects of MTA scripting and also a bit with the documentation. The [[Main Page]] provides you with links to more information, Tutorials and References that allow a deeper look into the topics you desire to learn about.&lt;br /&gt;
&lt;br /&gt;
From here we recommend reading the [[debugging]] tutorial. Good debugging skills are an absolute necessity when you are making scripts.&lt;br /&gt;
&lt;br /&gt;
[[ru:Scripting Introduction]]&lt;br /&gt;
[[it:Introduzione allo scripting]]&lt;br /&gt;
[[es:Introducción a la Programación]]&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/%D9%85%D9%82%D8%AF%D9%85%D9%87_%D9%81%D9%8A_%D8%A7%D9%84%D8%A8%D8%B1%D9%85%D8%AC%D9%87&amp;diff=49196</id>
		<title>AR/مقدمه في البرمجه</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/%D9%85%D9%82%D8%AF%D9%85%D9%87_%D9%81%D9%8A_%D8%A7%D9%84%D8%A8%D8%B1%D9%85%D8%AC%D9%87&amp;diff=49196"/>
		<updated>2016-09-19T15:57:05Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p align=&amp;quot;right&amp;quot;&amp;gt;  &lt;br /&gt;
 تختلف أنواع السكربتات فمنها خريطة أو وضع للعب &lt;br /&gt;
&lt;br /&gt;
MTA السكربتات جزء اساسي في تشغيل&lt;br /&gt;
&lt;br /&gt;
...وغيرها &amp;quot; freeroam , race , deathmatch &amp;quot; فتستطيع بإستخدامهم إنشاء تطبيقات لتحسين اللعب &lt;br /&gt;
&lt;br /&gt;
(Lua) [www.lua.org] برمجة السكربتات تعتمد على لغة البرمجة&lt;br /&gt;
&lt;br /&gt;
لغة البرمجة تعتمد إعتماداً كلياً على اللغة الإنجليزية , فيجب أن تكون لديك خلفية في اللغة الإنجليزية قبل المتابعة.&lt;br /&gt;
&lt;br /&gt;
لبرمجة سكربت ما تحتاج لمحرر .. ويفضل إستخدام محرر إحترافي لكي يسهل عليك البرمجة مثل :&lt;br /&gt;
*Notepad++ [http://notepad-plus-plus.org/download]&lt;br /&gt;
*Lua Edit [http://luaedit.sourceforge.net/ LuaEdit]&lt;br /&gt;
&lt;br /&gt;
 فهو يسهل برمجتها MTASE لكن يفضل استخدام برنامج :&lt;br /&gt;
* [[MTASE|MTA Script Editor]].'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==إنشاء سكربت ==&lt;br /&gt;
&lt;br /&gt;
سوف نتعلم كيف نقوم بإنشاء سكربت يدخل اللاعب إلى اللعبة .. خطوة بحطوة&lt;br /&gt;
&lt;br /&gt;
اولا لا بد من معرفة انواع ملفات السكربت    &lt;br /&gt;
                                                                                                          &lt;br /&gt;
1-Meta.xml -- يقوم هذا الملف بتعرف الملفات الموجود في السكربت للسيرفر               &lt;br /&gt;
                                                                                          &lt;br /&gt;
2-Client -- يقوم هذا الملف بتشغيل جميع أوامر المتعلقة بالاعب فقط                                       &lt;br /&gt;
&lt;br /&gt;
3-Server -- يقوم هذا الملف بتشغيل جميع الاوامر سواء كانت للسيرفر او الاعب&lt;br /&gt;
&lt;br /&gt;
===أين مسار كل البرامج النصية (السكريبتات أو المودات)؟===&lt;br /&gt;
الان نتعرف على مجلد المودات أو السكربتات.&lt;br /&gt;
اذهب إلى مجلد Multi Theft Auto واتبع المسار التالي:&lt;br /&gt;
&lt;br /&gt;
	/Your MTA Server/mods/deathmatch/resources/&lt;br /&gt;
&lt;br /&gt;
. أو مجلد عادي zip سترى الكثير من الملفات. ربما ترى مجلدات صيغتها , MTA .. وجميعها يقبله الـ&lt;br /&gt;
&lt;br /&gt;
وهو الذي سنستخدمه بالبرنامج التعليمي &amp;quot;myserver&amp;quot; ولإنشاء المودات الخاصة بك: قم بعمل مجلد جديد واجعل اسمه كما تريد فمثلاً قم بتسميته &lt;br /&gt;
&lt;br /&gt;
والان يجب أن يكون مسار المجلد الذي قمت بعمله هذا:&lt;br /&gt;
&lt;br /&gt;
	/Your MTA Server/mods/deathmatch/resources/myserver/&lt;br /&gt;
&lt;br /&gt;
* myserver: اسم المجلد الذي قمت بتسميته&lt;br /&gt;
&lt;br /&gt;
=== meta.xml تعريف السكربت اضافة ملف===&lt;br /&gt;
حتى يستطيع السيرفر من معرفة المودات, يجب علينا إنشاء ملف meta.xml &lt;br /&gt;
&lt;br /&gt;
&amp;quot; ويكون بداخل مجلد السكربت الذي قمنا بإنشائه وهو &amp;quot;myserver&amp;quot; &lt;br /&gt;
&lt;br /&gt;
ولإنشاء ملف meta.xml :&lt;br /&gt;
&lt;br /&gt;
وافتحه باستخدام المفكرة =) meta.xml أفتح ملف نصي جديد وقم بتسميته&lt;br /&gt;
&lt;br /&gt;
ولا تنسى ان يكون بداخل مجلد السكربت .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
أدخل الكود التالي في ملف ''meta.xml'':&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
     &amp;lt;info author=&amp;quot;إسمك&amp;quot; type=&amp;quot;gamemode&amp;quot; name=&amp;quot;إسم السكربت&amp;quot; description=&amp;quot;وصف بسيط للسكربت&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;script src=&amp;quot;script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
هنا يتم تعريف أجزاء السكربت فمثلاً :&lt;br /&gt;
* &amp;lt;info ..&amp;gt;&lt;br /&gt;
تضع فيه بيانات السكربت .. مثل الإسم والنوع والوصف&lt;br /&gt;
* type=&amp;quot;gamemode&amp;quot;&lt;br /&gt;
تعني أن نوع السكربت هو مود لعب وتوجد أنواع عديدة مثل :&lt;br /&gt;
**gamemode&lt;br /&gt;
**map&lt;br /&gt;
**script&lt;br /&gt;
&lt;br /&gt;
===إنشاء ملف السكربت Lua===&lt;br /&gt;
قمنا بوضع هذا السطر في :&lt;br /&gt;
*meta.xml&lt;br /&gt;
:&lt;br /&gt;
		&amp;lt;script src=&amp;quot;script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
الآن نقوم بإنشاء ملف نصي بنفس الإسم&lt;br /&gt;
**script.lua&lt;br /&gt;
بإستخدام برنامج التحرير لديك .. نقوم بإنشاء الكود&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function joinHandler() -- الوظيفة .. وبعدها نقوم بكتابة الإسم&lt;br /&gt;
	local x = 1959.55 -- تعريف x&lt;br /&gt;
	local y = -1714.46 -- تعريف y&lt;br /&gt;
	local z = 10 -- تعريف z&lt;br /&gt;
	spawnPlayer(source, x, y, z) -- نقوم بإستخدام هذه الوظيفة لإنتاج اللاعب ونقوم بتحديد اللاعب وهو المصدر : source&lt;br /&gt;
	fadeCamera(source, true) -- نقوم بعمل fade للكاميرا&lt;br /&gt;
	setCameraTarget(source, source) -- نجعل هدف الكاميرا هو اللاعب &lt;br /&gt;
	outputChatBox(&amp;quot;مرحباً بك في السيرفر&amp;quot;, source) -- نقوم بإخراج نص في الدردشة&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, getRootElement(), joinHandler) -- نقوم بإضافة المعالج حيث سيتم تشغيله بعد الحدث المحدد وهو عند دخول اللا&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
وصف وشرح الكود اعلاه : &lt;br /&gt;
	سيقوم السكربت بوضع اللاعب في الاحداثيات (x,y,z) المحدده اعلاه, عند دخوله الى السيرفر&lt;br /&gt;
	لاحظ انه يجب استخدام  وظيفة [ ''fadeCamera'' ] ستكون الشاشة سوداء وأيضاً يجب تعيين الكاميرا ( setTargetCamera ) ..&lt;br /&gt;
&lt;br /&gt;
نرى أن '''source''' هو المصدر وهو اللاعب الذي يقوم بالدخول &lt;br /&gt;
&lt;br /&gt;
*[[addEventHandler]] - الاحداث وهي ما يجب فعله من قبل المستخدم او السيرفر&lt;br /&gt;
*[[function]] - وظيفة تعمل عند حدث من الاحداث وتحتوي على امر او أوامر&lt;br /&gt;
أيضاً لو رأينا في المعالج &lt;br /&gt;
*[[addEventHandler]] - إضافة معالج للحدث&lt;br /&gt;
نرى 3 أشياء&lt;br /&gt;
*: onPlayerJoin - عند دخول اللاعب&lt;br /&gt;
وهو الحدث .. حيث يحدد متى يتم تشغيل المعالج - في هذه الحالة عند دخول اللاعب&lt;br /&gt;
*getRootElement() - جلب العنصر الحالي&lt;br /&gt;
هذا يقوم بتعيين العنصر الذي يقوم بتشغيل الحدث &lt;br /&gt;
*joinHandler &lt;br /&gt;
وهو إسم الوظيفة التي قمنا بصناعتها &lt;br /&gt;
&lt;br /&gt;
يمكنك التوسع أكثر في : [[addEventHandler]]&lt;br /&gt;
&lt;br /&gt;
===تشغيل السكربت===&lt;br /&gt;
بعد أن تقوم بحفظ أجزاء السكربت في ملف واحد ويمكن حفظه في الملفات التالية :&lt;br /&gt;
* مجلد&lt;br /&gt;
* أرشيف .zip&lt;br /&gt;
ونقوم بنسخه إلى مجلد السكربتات داخل سيرفرك ونقوم بتشغيله بالطريقة العادية.&lt;br /&gt;
&lt;br /&gt;
الآن إنتهينا من صنع السكربت .. بعد هذا سنقوم بصنع سكربت مع أمر &lt;br /&gt;
* command&lt;br /&gt;
يمكنك المتابعة أو الذهاب إلى دورة صناعة النوافذ&lt;br /&gt;
*[[Introduction to Scripting GUI]]&lt;br /&gt;
&lt;br /&gt;
===إنشاء سكربت بطريقة مفصلة===&lt;br /&gt;
&lt;br /&gt;
==صناعة أمر بسيط==&lt;br /&gt;
لنعد الآن إلى ملف&lt;br /&gt;
*script.lua&lt;br /&gt;
ونقوم بتعديله قليلاً لإنشاء أمر بسيط يقوم بإنشاء سيارة بجانب اللاعب&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- في البداية نقوم بكتب وظيفة إنشاء السيارة&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
   -- هنا نقوم بكتابة وظيفة إنشاء السيارة كـ&lt;br /&gt;
   -- createVehicle&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- نقوم بإضافة الأمر&lt;br /&gt;
addCommandHandler(&amp;quot;createvehicle&amp;quot;, createVehicleForPlayer) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
''ملاحظة: يمكنك الضغط على الوظائف والتعمق فيها بداخل الويكي.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== الوظيفة ==&lt;br /&gt;
الوظيفة هي شيء يسمى&lt;br /&gt;
&lt;br /&gt;
function&lt;br /&gt;
&lt;br /&gt;
الوظيفة هي الشيء التي يتكون عليها الحدث&lt;br /&gt;
&lt;br /&gt;
يمكنك ان تسمي الوظيفة كما شئت ويمكنك أيضاً عدم وضع اسم للوظيفة&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''مثال لـ وظيفة لها إسم'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function arabs( ) -- الوظيفة&lt;br /&gt;
    outputChatBox(&amp;quot;مرحباً بك&amp;quot;) --s  ستلاحظ بـ أن كلمة &amp;quot; مرحباً بك &amp;quot; ظهرت في الشات عند دخول الاعب &lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, root, arabs) -- .الحدث مع اسم الوظيفة&lt;br /&gt;
-- root = getRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''مثال لـ وظيفة ليس لها إسم'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerWasted&amp;quot;, root,&lt;br /&gt;
function(_,killer)&lt;br /&gt;
    outputChatBox( killer .. &amp;quot; من قبل&amp;quot; .. getPlayerName(source) .. &amp;quot; لقد قُتل الاعب&amp;quot; )&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
كما تلاحظ ووضع قوس قريباً من&lt;br /&gt;
&lt;br /&gt;
end)&lt;br /&gt;
&lt;br /&gt;
هذا القوس يكمل القوس الآخر كما نلاحظ في الحدث &lt;br /&gt;
&lt;br /&gt;
addEventHandler(&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== الحدث ==&lt;br /&gt;
الحدث هو شيء يسمى&lt;br /&gt;
&lt;br /&gt;
event&lt;br /&gt;
&lt;br /&gt;
الحدث هو الذي يتكون على بناء الوظيفة&lt;br /&gt;
فـ اذا رجعنا الى الامثلة التي في الاعلى سوف نرى عدة احداث ومنها&lt;br /&gt;
&lt;br /&gt;
[[onPlayerWasted]]&lt;br /&gt;
&lt;br /&gt;
الحدث ببساطة يحدد متى سوف تحدث او كيف سوف تحدث الوظائف التي ادخلتها&lt;br /&gt;
&lt;br /&gt;
onPlayerWasted&lt;br /&gt;
&lt;br /&gt;
عند موت الاعب&lt;br /&gt;
&lt;br /&gt;
'''مثال للحدث'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onJoin()&lt;br /&gt;
    x, y, z = getElementPosition(source) -- s يآتي بمكان الاعب x, y, z&lt;br /&gt;
	    local theVehicle = createVehicle(445, x, y, z) -- s السيارة التي سـ تصنع بمكان الاعب الذي تم تحديده مسبقاً&lt;br /&gt;
		    warpPedIntoVehicle(source, theVehicle) -- s يجعل الاعب داخل السيارة&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, root, onJoin) -- s الحدث&lt;br /&gt;
-- root = getRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
هذه الوظيفة مع هذا الحدث سوف يعطون الاعب سيارة عند دخوله السيرفر&lt;br /&gt;
&lt;br /&gt;
ملاحظة الحدث ليس دائم على الوظيفة فـ أيصاً يمكنك تكوين هذه الوظيفة على حدث آخر&lt;br /&gt;
&lt;br /&gt;
'''مثال'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onJoin()&lt;br /&gt;
    x, y, z = getElementPosition(source)&lt;br /&gt;
	    local theVehicle = createVehicle(445, x, y, z)&lt;br /&gt;
		    warpPedIntoVehicle(source, theVehicle)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerLogin&amp;quot;, root, onJoin)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
هذا سوف يعطي الاعب سيارة لاكن ليس عند دخوله السيرفر , إنما عند دخوله حسابه&lt;br /&gt;
&lt;br /&gt;
'''Edit'''&lt;br /&gt;
&lt;br /&gt;
مثال آخر&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onVehicleExplode&amp;quot;,root, -- نضيف حدث عند إنفجار اي سيارة&lt;br /&gt;
    function() -- الوظيفة&lt;br /&gt;
        setTimer(destroyElement,5000,1,source) -- يخفي السيارة بعد 5 ثواني من انفاجرها &lt;br /&gt;
    end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
يمكنك ان تجد&lt;br /&gt;
الاحداث&lt;br /&gt;
والوظائف &lt;br /&gt;
كلنت وسيرفر&lt;br /&gt;
هنا&lt;br /&gt;
&lt;br /&gt;
كلنت:&lt;br /&gt;
&lt;br /&gt;
'''وظائف كلنت'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Client_Scripting_Functions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''احداث كلنت'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Client_Scripting_Events&lt;br /&gt;
&lt;br /&gt;
سيرفر:&lt;br /&gt;
&lt;br /&gt;
'''وظائف سيرفر'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Server_Scripting_Functions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''احداث سيرفر'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Server_Scripting_Events&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== String الـ ==&lt;br /&gt;
السترنج هو شيء يوجد في بعض الوظايف التي توجد داخل الام تي اي&lt;br /&gt;
&lt;br /&gt;
مثلاً&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onResourceStart&amp;quot;,resourceRoot, -- الايفنت هنا يجب ان تكون بين سترنق كما الموضح هنا&lt;br /&gt;
    function()&lt;br /&gt;
        outputChatBox(&amp;quot;تم بدء السكربت&amp;quot;) -- s هنا سوف يظهر رسالة بالشات &amp;quot; تم بدء السكربت &amp;quot; عند بدء السكربت ويجب ان تكون سترنق&lt;br /&gt;
    end&lt;br /&gt;
) -- نهاية قوس الحدث&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
السترنق له عدة أشكال , فيمكن ان يكون كالآتي&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
أو&lt;br /&gt;
&lt;br /&gt;
' '&lt;br /&gt;
&lt;br /&gt;
أو&lt;br /&gt;
&lt;br /&gt;
[[]]&lt;br /&gt;
&lt;br /&gt;
فمثلاً اذا نريد ان نخرج رسالة بعلبة الشات&lt;br /&gt;
&lt;br /&gt;
يمكن ان تكون كذلك &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
outputChatBox([[مرحباً]])&lt;br /&gt;
&lt;br /&gt;
-- أو كذلك&lt;br /&gt;
outputChatBox('مرحباً')&lt;br /&gt;
&lt;br /&gt;
-- أو كذلك&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;مرحباً&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Command handlerعن الـ====&lt;br /&gt;
.(`) أو زر F8 التي يمكن للاعب ان يعرضها باستخدام زر Consoleهو اسم الامر الذي يمكن للاعب ان يدخله في الـ [[addCommandHandler]] في argument أول&lt;br /&gt;
&lt;br /&gt;
.&amp;quot;createVehicleForPlayer&amp;quot;هي وظيفة تُنفذ عند كتابة اللاعب الامر في هذه الحالة لـ [[addCommandHandler]] في argument ثاني&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:اذا كنت متمرس في البرمجة, ستعرف انك ستحتاج ان تنفذ وظيفة مثل&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
functionName(argument1, argument2, argument3, ..)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
functionName(thePlayer, commandName, argument3, ..)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If we have a closer look on the lower example above, we can see argument1 is thePlayer and argument2 the commandName. thePlayer is simply the one who typed the command, so whatever you call it, the variable will contain the player who activated the command. commandName is simply the command they typed. So if they typed &amp;quot;/greet&amp;quot;, this argument will contain &amp;quot;greet&amp;quot;. Argument 3 is something extra the player typed, you'll learn it a little bit further in the tutorial. Never forget that the first 2 arguments are standard arguments, but you can name them to anything you want.&lt;br /&gt;
&lt;br /&gt;
We called the [[addCommandHandler]] function this way already and since ''createVehicleForPlayer'' is a function too, it can be called that way as well. But we are using a command handler for that, which calls it in a similiar manner, internally.&lt;br /&gt;
&lt;br /&gt;
For example: Someone types &amp;quot;createvehicle 468&amp;quot; ingame in the console to spawn a Sanchez, the command handler calls the createVehicleForPlayer function, as '''if''' we would have this line of code in the script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
createVehicleForPlayer(thePlayer,&amp;quot;createvehicle&amp;quot;,&amp;quot;468&amp;quot;) -- thePlayer هو الشيء الي كتب الكومند&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
As we can see, it provides several parameters: the player who called the command, the command he entered and whatever text he had after that, in this case &amp;quot;468&amp;quot; as vehicle id for the Sanchez. The first two parameters are the same with all command handlers, which you can read on the [[addEventHandler]] page. For this fact, you always have to define at least those two parameters to use any after that (for example to process text that was entered after the command, like in our example the vehicle model id).&lt;br /&gt;
&lt;br /&gt;
''Note: You have to add the command handler AFTER you defined the handler function, else it can't find it. The order of execution matters.''&lt;br /&gt;
&lt;br /&gt;
====Writing the function====&lt;br /&gt;
In order to fill the function we created, we need to think about what we have to do:&lt;br /&gt;
* Get the players position, so we know where to spawn the vehicle (we want it to appear right beside the player)&lt;br /&gt;
* Calculate the position we want to spawn the vehicle at (we don't want it to appear in the player)&lt;br /&gt;
* Spawn the vehicle&lt;br /&gt;
* Check if it has been spawned successfully, or output a message&lt;br /&gt;
&lt;br /&gt;
In order to achieve our goals, we have to use several functions. To find function we need to use, we should visit the [[Scripting Functions|Server Functions List]]. First we need a function to get the players position. Since players are Elements, we first jump to the '''Element functions''' where we find the [[getElementPosition]] function. By clicking on the function name in the list, you get to the function description. There we can see the syntax, what it returns and usually an example. The syntax shows us what arguments we can or have to submit.&lt;br /&gt;
&lt;br /&gt;
For [[getElementPosition]], the syntax is:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float, float, float getElementPosition ( element theElement )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three ''float'' in front of the function name are the return type. In this case it means the function returns three floating point numbers. (x, y and z) Within the parentheses, you can see what arguments you have to submit. In this case only the element whose position you want to get, which is the player in our example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	-- نأتي باحداثيات المكان الي نبغي نضع فيه السيارة بشكل x, y, z&lt;br /&gt;
	-- (local  تعني ان هاد الاختصار ما رح يشغل غير في هاد الفنكشن)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we want to ensure that the vehicle won't spawn directly in the player, so we add a few units to the ''x'' variable, which will make it spawn east from the player.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) -- نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- add 5 units to the x position&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we need another function, one to spawn a vehicle. We once again search for it on the [[Scripting Functions|Server Functions List]], this time - since we are talking about vehicles - in the '''Vehicle functions''' section, where we will choose [[createVehicle]]. In this function's syntax, we only have one return type (which is more common), a vehicle element that points to the vehicle we just created. Also, we see that some arguments are enclosed within [ ] which means that those are optional.&lt;br /&gt;
&lt;br /&gt;
We already have all arguments we need for [[createVehicle]] in our function: The position we just calculated in the ''x,y,z'' variables and the model id that we provided through the command (&amp;quot;createvehicle 468&amp;quot;) and can access in the function as ''vehicleModel'' variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) --  نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- add 5 units to the x position&lt;br /&gt;
	-- create the vehicle and store the returned vehicle element in the ''createdVehicle'' variable&lt;br /&gt;
	local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course this code can be improved in many ways, but at least we want to add a check whether the vehicle was created successfully or not. As we can read on the [[createVehicle]] page under '''Returns''', the function returns ''false'' when it was unable to create the vehicle. Thus, we check the value of the ''createVehicle'' variable.&lt;br /&gt;
&lt;br /&gt;
Now we have our complete script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) --  نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- نضيف 5 وحد ل الاحداثيات X&lt;br /&gt;
	local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z)&lt;br /&gt;
	-- نشوف لو السيارة اتعملت ام لا&lt;br /&gt;
	if (createdVehicle == false) then&lt;br /&gt;
		-- لو السياره اتعملت يبقي نعمل رسالة,لكن للاعب فقط&lt;br /&gt;
		outputChatBox(&amp;quot;Failed to create vehicle.&amp;quot;,thePlayer)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;createvehicle&amp;quot;, createVehicleForPlayer)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, we introduced another function with [[outputChatBox]]. By now, you should be able to explore the function's documentation page yourself. For more advanced scripting, please check out the [[Map manager|Map Manager]].&lt;br /&gt;
&lt;br /&gt;
==What you need to know==&lt;br /&gt;
You already read some things about resources, command handlers and finding functions in the documentation in the first paragraph, but there is much more to learn. This section will give you a rather short overview over some of these things, while linking to related pages if possible.&lt;br /&gt;
===Clientside and Serverside scripts===&lt;br /&gt;
You may have already noticed these or similiar terms (Server/Client) somewhere on this wiki, mostly in conjunction with functions. MTA not only supports scripts that run on the server and provide commands (like the one we wrote above) or other features, but also scripts that run on the MTA client the players use to connect to the server. The reason for this is, that some features MTA provides have to be clientside (like a GUI - Graphical User Interface), others should be because they work better and still others are better off to be serverside or just don't work clientside.&lt;br /&gt;
&lt;br /&gt;
Most scripts you will make (gamemodes, maps) will probably be serverside, like the one we wrote in the first section. If you run into something that can't be solved serverside, you will probably have to make it clientside. For a clientside script for example, you would create a ordinary script file (for example called ''client.lua'') and specify it in the meta.xml, like this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;client.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The ''type'' attribute defaults to 'server', so you only need to specify it for clientside scripts. When you do this, the clientside script will be downloaded to the player's computer once he connects to the server. Read more about [[Client side scripts]].&lt;br /&gt;
&lt;br /&gt;
===More complex resources===&lt;br /&gt;
The previous section showed briefly how to add clientside scripts to the resource, but there is also much more possible. As mentioned at the very top of this page, resources can be pretty much everything. Their purpose is defined by what they do. Let's have some theoretical resources, by looking at the files it contains, the ''meta.xml'' and what they might do:&lt;br /&gt;
&lt;br /&gt;
====First example - A utility script====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/admin_commands&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/commands.lua&lt;br /&gt;
	/client.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;admin commands&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;commands.lua&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;client.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''commands.lua'' provides some admin commands, like banning a player, muting or something else that can be used to admin the server&lt;br /&gt;
* The ''client.lua'' provides a GUI to be able to perform the mentioned actions easily&lt;br /&gt;
&lt;br /&gt;
This example might be running all the time (maybe even auto-started when the server starts) as it's useful during the whole gaming experience and also wont interfere with the gameplay, unless an admin decides to take some action of course.&lt;br /&gt;
&lt;br /&gt;
====Second example - A gamemode====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/counterstrike&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/counterstrike.lua&lt;br /&gt;
	/buymenu.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;Counterstrike remake&amp;quot; type=&amp;quot;gamemode&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;counterstrike.lua&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;buymenu.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''counterstrike.lua'' contains similiar to the following features:&lt;br /&gt;
** Let players choose their team and spawn them&lt;br /&gt;
** Provide them with weapons, targets and instructions (maybe read from a Map, see below)&lt;br /&gt;
** Define the game's rules, e.g. when does the round end, what happens when a player dies&lt;br /&gt;
** .. and maybe some more&lt;br /&gt;
* The ''buymenu.lua'' is a clientside script and creates a menu to buy weapons&lt;br /&gt;
&lt;br /&gt;
This example can be called a gamemode, since it not only intereferes with the gameplay, but actually defines the rules of it. The ''type'' attribute indicates that this example works with the [[Map manager]], yet another resource that was written by the QA Team to manage gamemodes and map loading. It is highly recommended that you base your gamemodes on the techniques it provides.&lt;br /&gt;
&lt;br /&gt;
This also means that the gamemode probably won't run without a map. Gamemodes should always be as generic as possible. An example for a map is stated in the next example.&lt;br /&gt;
&lt;br /&gt;
====Third example - A Map====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/cs-airport&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/airport.map&lt;br /&gt;
	/airport.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;Counterstrike airport map&amp;quot; type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;counterstrike&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;map src=&amp;quot;airport.map&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;airport.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''airport.map'' in a XML file that provides information about the map to the gamemode, these may include:&lt;br /&gt;
** Where the players should spawn, with what weapons, what teams there are&lt;br /&gt;
** What the targets are&lt;br /&gt;
** Weather, World Time, Timelimit&lt;br /&gt;
** Provide vehicles&lt;br /&gt;
* The ''airport.lua'' might contain map-specific features, that may include:&lt;br /&gt;
** Opening some door/make something explode when something specific happens&lt;br /&gt;
** Create or move some custom objects, or manipulate objects that are created through the .map file&lt;br /&gt;
** .. anything else map-specific you can think of&lt;br /&gt;
&lt;br /&gt;
As you can see, the ''type'' attribute changed to 'map', telling the [[Map manager]] that this resource is a map, while the ''gamemodes'' attribute tells it for which gamemodes this map is valid, in this case the gamemode from the above example.&lt;br /&gt;
What may come as a surprise is that there is also a script in the Map resource. Of course this is not necessarily needed in a map, but opens a wide range of possibilities for map makers to create their own world within the rules of the gamemode they create it for.&lt;br /&gt;
&lt;br /&gt;
The ''airport.map'' file might look similiar to this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map mode=&amp;quot;deathmatch&amp;quot; version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;terrorists&amp;gt;&lt;br /&gt;
		&amp;lt;spawnpoint posX=&amp;quot;2332.23&amp;quot; posY=&amp;quot;-12232.33&amp;quot; posZ=&amp;quot;4.42223&amp;quot; skins=&amp;quot;23-40&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/terrorists&amp;gt;&lt;br /&gt;
	&amp;lt;counterterrorists&amp;gt;&lt;br /&gt;
		&amp;lt;spawnpoint posX=&amp;quot;2334.23443&amp;quot; posY=&amp;quot;-12300.233&amp;quot; posZ=&amp;quot;10.2344&amp;quot; skins=&amp;quot;40-50&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/counterterrorists&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;bomb posX=&amp;quot;23342.23&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
	&amp;lt;vehicle posX=&amp;quot;&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; model=&amp;quot;602&amp;quot; /&amp;gt;	&lt;br /&gt;
	&amp;lt;vehicle posX=&amp;quot;&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; model=&amp;quot;603&amp;quot; /&amp;gt;	&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When a gamemode is started with a map, the map resources is automatically started by the mapmanager and the information it contains can be read by the gamemode resource. When the map changes, the current map resource is stopped and the next map resource is started. For a more in-depth explanation and examples of how map resources are utilized in the main script, please visit the [[Writing Gamemodes]] page.&lt;br /&gt;
&lt;br /&gt;
===Events===&lt;br /&gt;
Events are the way MTA tells scripts about things that happen. For example when a player dies, the [[onPlayerWasted]] event is triggered. In order to perform any actions when a player dies, you have to prepare yourself similiar to adding a command handler, as shown in [[#Writing_the_script|the first chapter]].&lt;br /&gt;
&lt;br /&gt;
This example will output a message with the name of the player who died:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function playerDied(totalAmmo, killer, killerWeapon, bodypart)&lt;br /&gt;
	outputChatBox(getPlayerName(source)..&amp;quot; died!&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerWasted&amp;quot;,getRootElement(),playerDied)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead of showing what arguments are needed, the documentation page for Events shows what parameters are passed to the handler function, similiar to the way a [[#About_command_handlers|command handler]] does, just that it is different from event to event. Another important point is the ''source'' variable, that exists in handler functions. It doesn't have to be added to the parameter list of the function, but it still exists. It has a different value from event to event, for player events (as in the example above) it is the player element. As another example, you can take a look at the basic spawning player script in the first section to get an idea how ''source'' is used.&lt;br /&gt;
&lt;br /&gt;
==Where to go from here==&lt;br /&gt;
You should now be familiar with the most basic aspects of MTA scripting and also a bit with the documentation. The [[Main Page]] provides you with links to more information, Tutorials and References that allow a deeper look into the topics you desire to learn about.&lt;br /&gt;
&lt;br /&gt;
From here we recommend reading the [[debugging]] tutorial. Good debugging skills are an absolute necessity when you are making scripts.&lt;br /&gt;
&lt;br /&gt;
[[ru:Scripting Introduction]]&lt;br /&gt;
[[it:Introduzione allo scripting]]&lt;br /&gt;
[[es:Introducción a la Programación]]&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=CenterWindow&amp;diff=48941</id>
		<title>CenterWindow</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=CenterWindow&amp;diff=48941"/>
		<updated>2016-08-31T11:01:42Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function center the window in any resolution.&amp;lt;br&amp;gt;&lt;br /&gt;
* '''NOTE:''' This is made to be used clientside!.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool centerWindow ( element TheElement )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''theElement''': The element you want to center it.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the window has been successfully centered, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Clientside script&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function centerWindow (center_window)&lt;br /&gt;
    local screenW, screenH = guiGetScreenSize()&lt;br /&gt;
    local windowW, windowH = guiGetSize(center_window, false)&lt;br /&gt;
    local x, y = (screenW - windowW) /2,(screenH - windowH) /2&lt;br /&gt;
    return guiSetPosition(center_window, x, y, false)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example center the window.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler( &amp;quot;onClientResourceStart&amp;quot;, resourceRoot, function()&lt;br /&gt;
  myWindow = guiCreateWindow( 350, 100, 200, 250, &amp;quot;Window Title&amp;quot;, false )&lt;br /&gt;
end )&lt;br /&gt;
&lt;br /&gt;
addCommandHandler( &amp;quot;center&amp;quot;, function()&lt;br /&gt;
  if myWindow then&lt;br /&gt;
    centerWindow( myWindow )&lt;br /&gt;
  end&lt;br /&gt;
end )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: laserlaser&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/getElementsWithinColShape&amp;diff=47648</id>
		<title>AR/getElementsWithinColShape</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/getElementsWithinColShape&amp;diff=47648"/>
		<updated>2016-06-17T19:39:15Z</updated>

		<summary type="html">&lt;p&gt;Jaber: Created page with &amp;quot;{{Server client function}} __NOTOC__ هذه الوظيفة تستخدم لجلب الألمنتات التي بداخل الكول شيب  ==Syntax==  &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; table getE...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
هذه الوظيفة تستخدم لجلب الألمنتات التي بداخل الكول شيب&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
table getElementsWithinColShape ( colshape shape, [ string elemType = nil ] ) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP| |[[colshape]]:getElementsWithin||}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''shape:''' الكول شيب الذي تبي تجيب الالمنتات التي به .&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
*'''elemType:''' نوع الألمنت :&lt;br /&gt;
**'''&amp;quot;player&amp;quot;:''' لاعب&lt;br /&gt;
**'''&amp;quot;ped&amp;quot;:''' بيد , شخصية وهمية&lt;br /&gt;
**'''&amp;quot;vehicle&amp;quot;:''' سيارة&lt;br /&gt;
**'''&amp;quot;object&amp;quot;:''' ابجكت&lt;br /&gt;
**'''&amp;quot;pickup&amp;quot;:''' &lt;br /&gt;
**'''&amp;quot;marker&amp;quot;:''' ماركر&lt;br /&gt;
&amp;lt;!--**'''&amp;quot;spawnpoint&amp;quot;:''' A spawnpoint&lt;br /&gt;
**'''&amp;quot;remoteclient&amp;quot;:''' A remote client connected to the server&lt;br /&gt;
**'''&amp;quot;console&amp;quot;:''' The server Console--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a ''table'' containing all the elements inside the colshape, of the specified type. Returns an empty ''table'' if there are no elements inside. Returns ''false'' if the colshape is invalid.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
هذه الوظيفة تقوم بجلب الاعبين الذين بداخل الابجكت واخراج اسمائهم بالشات .&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local newcolshape = createColSphere ( 1, 2, 3, 4 )&lt;br /&gt;
local players = getElementsWithinColShape ( newcolshape, &amp;quot;player&amp;quot; )  -- جلب جميع الاعبين بداخل الكول شيب&lt;br /&gt;
for theKey,thePlayer in ipairs(players) do                           -- لوب لجميع الاعبين داخل الكول شيب&lt;br /&gt;
    outputChatBox ( getPlayerName ( thePlayer ) .. &amp;quot; is in our new sphere&amp;quot; )  -- اخراج اسمائهم بالشات&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Element_functions}}&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/createColRectangle&amp;diff=47647</id>
		<title>AR/createColRectangle</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/createColRectangle&amp;diff=47647"/>
		<updated>2016-06-17T19:32:31Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}}&lt;br /&gt;
هذه الوظيفة تستخدم لصنع كول شيب مستطيل.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
colshape createColRectangle ( float fX, float fY, float fWidth, float fHeight)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP| |ColShape.Rectangle||}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''fX:''' احداثيات X &lt;br /&gt;
*'''fY:''' احداثيات Y&lt;br /&gt;
*'''fWidth:''' العرض&lt;br /&gt;
*'''fHeight:''' الارتفاع&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a [[colshape]] element if successful, ''false'' if invalid arguments were passed to the function.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example displays a chat message when a player enters the colshape and allows the colshape to be created using a console function ''set_zone''.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
theZone = false&lt;br /&gt;
&lt;br /&gt;
function shapeHit ( thePlayer ) &lt;br /&gt;
    outputChatBox ( getPlayerName ( thePlayer ) .. &amp;quot; is in the zone!&amp;quot; ) -- display a message in everyone's chat box&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function setZone ( playerSource, commandName, fX, fY )&lt;br /&gt;
    if ( fY and fX ) then -- check we've got the 2 args we need&lt;br /&gt;
        local tempCol = createColRectangle ( fX, fY, 10.0, 10.0 ) -- create a col&lt;br /&gt;
        if ( tempCol == false ) then -- did the col get created successfully?&lt;br /&gt;
            outputConsole ( &amp;quot;Syntax is: set_zone &amp;lt;X&amp;gt; &amp;lt;Y&amp;gt;&amp;quot; ) -- inform the user what the valid syntax is&lt;br /&gt;
        else&lt;br /&gt;
            if ( theZone ~= false ) then -- did we already have a zone?&lt;br /&gt;
                destroyElement ( theZone ) -- if so, destroy it&lt;br /&gt;
            else&lt;br /&gt;
                   addEventHandler ( &amp;quot;onColShapeHit&amp;quot;, theZone, shapeHit ) -- add a handler for the onColShapeHit event&lt;br /&gt;
            end&lt;br /&gt;
            theZone = tempCol -- and store the new zone we've made&lt;br /&gt;
            outputChatBox ( &amp;quot;Zone has moved!&amp;quot; ) -- and tell everyone&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;set_zone&amp;quot;, setZone ) -- add a console function called set_zone that will trigger the function setZone&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Collision shape functions}}&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/createColRectangle&amp;diff=47646</id>
		<title>AR/createColRectangle</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/createColRectangle&amp;diff=47646"/>
		<updated>2016-06-17T19:31:31Z</updated>

		<summary type="html">&lt;p&gt;Jaber: Created page with &amp;quot;__NOTOC__  {{Server client function}} هذه الوظيفة تستخدم لصنع كول شيب مستطيل.  ==Syntax==  &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; colshape createColRectangle ( float fX...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}}&lt;br /&gt;
هذه الوظيفة تستخدم لصنع كول شيب مستطيل.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
colshape createColRectangle ( float fX, float fY, float fWidth, float fHeight)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP| |ColShape.Rectangle||}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''fX:''' The X position of the collision rectangle's west side&lt;br /&gt;
*'''fY:''' The Y position of the collision rectangle's south side&lt;br /&gt;
*'''fWidth:''' The collision rectangle's width&lt;br /&gt;
*'''fHeight:''' The collision rectangle's height&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a [[colshape]] element if successful, ''false'' if invalid arguments were passed to the function.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example displays a chat message when a player enters the colshape and allows the colshape to be created using a console function ''set_zone''.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
theZone = false&lt;br /&gt;
&lt;br /&gt;
function shapeHit ( thePlayer ) &lt;br /&gt;
    outputChatBox ( getPlayerName ( thePlayer ) .. &amp;quot; is in the zone!&amp;quot; ) -- display a message in everyone's chat box&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function setZone ( playerSource, commandName, fX, fY )&lt;br /&gt;
    if ( fY and fX ) then -- check we've got the 2 args we need&lt;br /&gt;
        local tempCol = createColRectangle ( fX, fY, 10.0, 10.0 ) -- create a col&lt;br /&gt;
        if ( tempCol == false ) then -- did the col get created successfully?&lt;br /&gt;
            outputConsole ( &amp;quot;Syntax is: set_zone &amp;lt;X&amp;gt; &amp;lt;Y&amp;gt;&amp;quot; ) -- inform the user what the valid syntax is&lt;br /&gt;
        else&lt;br /&gt;
            if ( theZone ~= false ) then -- did we already have a zone?&lt;br /&gt;
                destroyElement ( theZone ) -- if so, destroy it&lt;br /&gt;
            else&lt;br /&gt;
                   addEventHandler ( &amp;quot;onColShapeHit&amp;quot;, theZone, shapeHit ) -- add a handler for the onColShapeHit event&lt;br /&gt;
            end&lt;br /&gt;
            theZone = tempCol -- and store the new zone we've made&lt;br /&gt;
            outputChatBox ( &amp;quot;Zone has moved!&amp;quot; ) -- and tell everyone&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;set_zone&amp;quot;, setZone ) -- add a console function called set_zone that will trigger the function setZone&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Collision shape functions}}&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/createColCuboid&amp;diff=47645</id>
		<title>AR/createColCuboid</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/createColCuboid&amp;diff=47645"/>
		<updated>2016-06-17T19:29:50Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}}&lt;br /&gt;
هذه الوظيفة تستخدم لصنع كول شيب متوازي مستطيلات.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
colshape createColCuboid ( float fX, float fY, float fZ, float fWidth, float fDepth, float fHeight )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP| |ColShape.Cuboid||}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''fX:''' احداثيات x&lt;br /&gt;
*'''fY:''' احداثيات y&lt;br /&gt;
*'''fZ:''' احداثيات z&lt;br /&gt;
*'''fWidth:''' العرض&lt;br /&gt;
*'''fDepth:''' العمق&lt;br /&gt;
*'''fHeight:''' الارتفاع&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a [[colshape]] element if successful, ''false'' if invalid arguments were passed to the function.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example displays a chat message when a player enters the colshape and allows the colshape to be created using a console function ''set_zone''.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
theZone = false&lt;br /&gt;
&lt;br /&gt;
function shapeHit ( thePlayer ) &lt;br /&gt;
    outputChatBox ( getPlayerName ( thePlayer ) .. &amp;quot; is in the zone!&amp;quot; )  -- display a message in everyone's chat box&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function setZone ( playerSource, commandName, fX, fY, fZ )&lt;br /&gt;
    if ( fZ and fY and fX ) then                                         -- check we've got all 3 args we need&lt;br /&gt;
        local tempCol = createColCuboid ( fX, fY, fZ, 10.0, 10.0, 10.0 )   -- create a col&lt;br /&gt;
        if ( tempCol == false ) then                                     -- did the col get created successfully?&lt;br /&gt;
            outputConsole ( &amp;quot;Syntax is: set_zone &amp;lt;X&amp;gt; &amp;lt;Y&amp;gt; &amp;lt;Z&amp;gt;&amp;quot; )          -- inform the user what the valid syntax is&lt;br /&gt;
        else&lt;br /&gt;
            if ( theZone ~= false ) then                                 -- did we already have a zone?&lt;br /&gt;
                destroyElement ( theZone )                               -- if so, destroy it&lt;br /&gt;
            else&lt;br /&gt;
                addEventHandler ( &amp;quot;onColShapeHit&amp;quot;, theZone, shapeHit )   -- add a handler for the onColShapeHit event&lt;br /&gt;
            end&lt;br /&gt;
            theZone = tempCol                                            -- store the new zone we've made&lt;br /&gt;
            outputChatBox ( &amp;quot;Zone has moved!&amp;quot; )                          -- and tell everyone&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;set_zone&amp;quot;, setZone ) -- add a console function called set_zone that will trigger the function setZone&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Collision shape functions}}&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/createColCuboid&amp;diff=47644</id>
		<title>AR/createColCuboid</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/createColCuboid&amp;diff=47644"/>
		<updated>2016-06-17T19:29:18Z</updated>

		<summary type="html">&lt;p&gt;Jaber: Created page with &amp;quot;__NOTOC__  {{Server client function}} هذه الوظيفة تستخدم لصنع كول شيب متوازي مستطيلات. {{VisualizeColshape}} {{Note|Attaching a cuboid ...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}}&lt;br /&gt;
هذه الوظيفة تستخدم لصنع كول شيب متوازي مستطيلات.&lt;br /&gt;
{{VisualizeColshape}}&lt;br /&gt;
{{Note|Attaching a cuboid colshape to another element may give unexpected results as the origin is not at the cuboid centre. Try using a [[createColSphere|collision sphere]] for attaching instead}}&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
colshape createColCuboid ( float fX, float fY, float fZ, float fWidth, float fDepth, float fHeight )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP| |ColShape.Cuboid||}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''fX:''' احداثيات x&lt;br /&gt;
*'''fY:''' احداثيات y&lt;br /&gt;
*'''fZ:''' احداثيات z&lt;br /&gt;
*'''fWidth:''' العرض&lt;br /&gt;
*'''fDepth:''' العمق&lt;br /&gt;
*'''fHeight:''' الارتفاع&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a [[colshape]] element if successful, ''false'' if invalid arguments were passed to the function.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example displays a chat message when a player enters the colshape and allows the colshape to be created using a console function ''set_zone''.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
theZone = false&lt;br /&gt;
&lt;br /&gt;
function shapeHit ( thePlayer ) &lt;br /&gt;
    outputChatBox ( getPlayerName ( thePlayer ) .. &amp;quot; is in the zone!&amp;quot; )  -- display a message in everyone's chat box&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function setZone ( playerSource, commandName, fX, fY, fZ )&lt;br /&gt;
    if ( fZ and fY and fX ) then                                         -- check we've got all 3 args we need&lt;br /&gt;
        local tempCol = createColCuboid ( fX, fY, fZ, 10.0, 10.0, 10.0 )   -- create a col&lt;br /&gt;
        if ( tempCol == false ) then                                     -- did the col get created successfully?&lt;br /&gt;
            outputConsole ( &amp;quot;Syntax is: set_zone &amp;lt;X&amp;gt; &amp;lt;Y&amp;gt; &amp;lt;Z&amp;gt;&amp;quot; )          -- inform the user what the valid syntax is&lt;br /&gt;
        else&lt;br /&gt;
            if ( theZone ~= false ) then                                 -- did we already have a zone?&lt;br /&gt;
                destroyElement ( theZone )                               -- if so, destroy it&lt;br /&gt;
            else&lt;br /&gt;
                addEventHandler ( &amp;quot;onColShapeHit&amp;quot;, theZone, shapeHit )   -- add a handler for the onColShapeHit event&lt;br /&gt;
            end&lt;br /&gt;
            theZone = tempCol                                            -- store the new zone we've made&lt;br /&gt;
            outputChatBox ( &amp;quot;Zone has moved!&amp;quot; )                          -- and tell everyone&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;set_zone&amp;quot;, setZone ) -- add a console function called set_zone that will trigger the function setZone&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Collision shape functions}}&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/createColCircle&amp;diff=47643</id>
		<title>AR/createColCircle</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/createColCircle&amp;diff=47643"/>
		<updated>2016-06-17T19:26:29Z</updated>

		<summary type="html">&lt;p&gt;Jaber: Created page with &amp;quot;__NOTOC__  {{Server client function}} هذه الوظيفة تستخدم لصنع كول شيب دائري الشكل. {{VisualizeColshape}} ==Syntax==  &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; colshape...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}}&lt;br /&gt;
هذه الوظيفة تستخدم لصنع كول شيب دائري الشكل.&lt;br /&gt;
{{VisualizeColshape}}&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
colshape createColCircle ( float fX, float fY, float radius )             &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''fX:''' الاحداثيات x&lt;br /&gt;
*'''fY:''' الاحداثيات y&lt;br /&gt;
*'''radius''' نصف قطر الدائرة&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a [[colshape]] element if successful, ''false'' if invalid arguments were passed to the function.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example displays a chat message when a player enters the colshape and allows the colshape to be created using a console function ''set_zone''.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
theZone = false&lt;br /&gt;
&lt;br /&gt;
function shapeHit ( thePlayer ) &lt;br /&gt;
    outputChatBox ( getPlayerName ( thePlayer ) .. &amp;quot; is in the zone!&amp;quot; ) -- display a message in everyone's chat box&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function setZone ( playerSource, commandName, fX, fY )&lt;br /&gt;
    if ( fY and fX ) then -- check we've got all 3 args we need&lt;br /&gt;
        local tempCol = createColCircle ( fX, fY, 10.0 ) -- create a col&lt;br /&gt;
        if ( tempCol == false ) then -- did the col get created successfully?&lt;br /&gt;
            outputConsole ( &amp;quot;Syntax is: set_zone &amp;lt;X&amp;gt; &amp;lt;Y&amp;gt;&amp;quot; ) -- inform the user what the valid syntax is&lt;br /&gt;
        else&lt;br /&gt;
            if ( theZone ~= false ) then -- did we already have a zone?&lt;br /&gt;
                destroyElement ( theZone ) -- if so, destroy it&lt;br /&gt;
            else&lt;br /&gt;
                   addEventHandler ( &amp;quot;onColShapeHit&amp;quot;, theZone, shapeHit ) -- add a handler for the onColShapeHit event&lt;br /&gt;
            end&lt;br /&gt;
            theZone = tempCol -- and store the new zone we've made&lt;br /&gt;
            outputChatBox ( &amp;quot;Zone has moved!&amp;quot; ) -- and tell everyone&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;set_zone&amp;quot;, setZone ) -- add a console function called set_zone that will trigger the function setZone&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Collision shape functions}}&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/isChatVisible&amp;diff=47642</id>
		<title>AR/isChatVisible</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/isChatVisible&amp;diff=47642"/>
		<updated>2016-06-17T19:19:25Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New items|4.0132|1.4|&lt;br /&gt;
هذه الوظيفة تستخدم للتحقق ان الشات ظاهر.&lt;br /&gt;
&lt;br /&gt;
ملاحظة : تعمل في  اصدار 1.4 فقط&lt;br /&gt;
}}&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool isChatVisible ( )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the chat is visible, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler(&amp;quot;sc&amp;quot;,&lt;br /&gt;
	function ()&lt;br /&gt;
		showChat(not isChatVisible())&lt;br /&gt;
	end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_output_functions}}&lt;br /&gt;
[[ru:isChatVisible]]&lt;br /&gt;
[[en:isChatVisible]]&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/isChatVisible&amp;diff=47641</id>
		<title>AR/isChatVisible</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/isChatVisible&amp;diff=47641"/>
		<updated>2016-06-17T19:17:27Z</updated>

		<summary type="html">&lt;p&gt;Jaber: Created page with &amp;quot;{{Client function}} __NOTOC__ {{New items|4.0132|1.4| هذه الوظيفة تستخدم للتحقق ان الشات ظاهر. }} ==Syntax==  &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; bool isChatVisible...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New items|4.0132|1.4|&lt;br /&gt;
هذه الوظيفة تستخدم للتحقق ان الشات ظاهر.&lt;br /&gt;
}}&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool isChatVisible ( )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the chat is visible, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler(&amp;quot;sc&amp;quot;,&lt;br /&gt;
	function ()&lt;br /&gt;
		showChat(not isChatVisible())&lt;br /&gt;
	end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_output_functions}}&lt;br /&gt;
[[ru:isChatVisible]]&lt;br /&gt;
[[en:isChatVisible]]&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/%D9%85%D9%82%D8%AF%D9%85%D9%87_%D9%81%D9%8A_%D8%A7%D9%84%D8%A8%D8%B1%D9%85%D8%AC%D9%87&amp;diff=47529</id>
		<title>AR/مقدمه في البرمجه</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/%D9%85%D9%82%D8%AF%D9%85%D9%87_%D9%81%D9%8A_%D8%A7%D9%84%D8%A8%D8%B1%D9%85%D8%AC%D9%87&amp;diff=47529"/>
		<updated>2016-05-15T15:19:57Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p align=&amp;quot;right&amp;quot;&amp;gt;  &lt;br /&gt;
 تختلف أنواع السكربتات فمنها خريطة أو وضع للعب &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
السكربتات جزء أساسي في تشغيل MTA &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
فتستطيع بإستخدامهم إنشاء تطبيقات لتحسين اللعب ،&amp;quot; freeroam , race , deathmatch &amp;quot; وغيرها ..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
برمجة السكربتات تعتمد على لغة البرمجة (Lua) [www.lua.org] .&lt;br /&gt;
&lt;br /&gt;
لغة البرمجة تعتمد إعتماداً كلياً على اللغة الإنجليزية , فيجب أن تكون لديك خلفية في اللغة الإنجليزية قبل المتابعة.&lt;br /&gt;
&lt;br /&gt;
لبرمجة سكربت ما تحتاج لمحرر .. ويفضل إستخدام محرر إحترافي لكي يسهل عليك البرمجة مثل :&lt;br /&gt;
*Notepad++ [http://notepad-plus-plus.org/download]&lt;br /&gt;
*Lua Edit [http://luaedit.sourceforge.net/ LuaEdit]&lt;br /&gt;
&lt;br /&gt;
لكن يفضل إستخدام برنامج MTASE فهو يسهل عملية إنشاء السكربتات وبرمجتها :&lt;br /&gt;
* [[MTASE|MTA Script Editor]].'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==إنشاء سكربت ==&lt;br /&gt;
&lt;br /&gt;
سوف نتعلم كيف نقوم بإنشاء سكربت يدخل اللاعب إلى اللعبة .. خطوة بحطوة&lt;br /&gt;
&lt;br /&gt;
اولا لا بد من معرفة انواع ملفات السكربت    &lt;br /&gt;
                                                                                                          &lt;br /&gt;
1-Meta.xml -- يقوم هذا الملف بتعرف الملفات الموجود في السكربت للسيرفر               &lt;br /&gt;
                                                                                          &lt;br /&gt;
2-Client -- يقوم هذا الملف بتشغيل جميع أوامر المتعلقة بالاعب فقط                                       &lt;br /&gt;
&lt;br /&gt;
3-Server -- يقوم هذا الملف بتشغيل جميع الاوامر سواء كانت للسيرفر او الاعب&lt;br /&gt;
&lt;br /&gt;
===أين مسار كل البرامج النصية (السكريبتات أو المودات)؟===&lt;br /&gt;
الان نتعرف على مجلد المودات أو السكربتات.&lt;br /&gt;
اذهب إلى مجلد Multi Theft Auto واتبع المسار التالي:&lt;br /&gt;
&lt;br /&gt;
	/Your MTA Server/mods/deathmatch/resources/&lt;br /&gt;
&lt;br /&gt;
. أو مجلد عادي zip سترى الكثير من الملفات. ربما ترى مجلدات صيغتها , MTA .. وجميعها يقبله الـ&lt;br /&gt;
&lt;br /&gt;
وهو الذي سنستخدمه بالبرنامج التعليمي &amp;quot;myserver&amp;quot; ولإنشاء المودات الخاصة بك: قم بعمل مجلد جديد واجعل اسمه كما تريد فمثلاً قم بتسميته &lt;br /&gt;
&lt;br /&gt;
والان يجب أن يكون مسار المجلد الذي قمت بعمله هذا:&lt;br /&gt;
&lt;br /&gt;
	/Your MTA Server/mods/deathmatch/resources/myserver/&lt;br /&gt;
&lt;br /&gt;
* myserver: اسم المجلد الذي قمت بتسميته&lt;br /&gt;
&lt;br /&gt;
=== meta.xml تعريف السكربت اضافة ملف===&lt;br /&gt;
حتى يستطيع السيرفر من معرفة المودات, يجب علينا إنشاء ملف meta.xml &lt;br /&gt;
&lt;br /&gt;
&amp;quot; ويكون بداخل مجلد السكربت الذي قمنا بإنشائه وهو &amp;quot;myserver&amp;quot; &lt;br /&gt;
&lt;br /&gt;
ولإنشاء ملف meta.xml :&lt;br /&gt;
&lt;br /&gt;
وافتحه باستخدام المفكرة =) meta.xml أفتح ملف نصي جديد وقم بتسميته&lt;br /&gt;
&lt;br /&gt;
ولا تنسى ان يكون بداخل مجلد السكربت .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
أدخل الكود التالي في ملف ''meta.xml'':&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
     &amp;lt;info author=&amp;quot;إسمك&amp;quot; type=&amp;quot;gamemode&amp;quot; name=&amp;quot;إسم السكربت&amp;quot; description=&amp;quot;وصف بسيط للسكربت&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;script src=&amp;quot;script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
هنا يتم تعريف أجزاء السكربت فمثلاً :&lt;br /&gt;
* &amp;lt;info ..&amp;gt;&lt;br /&gt;
تضع فيه بيانات السكربت .. مثل الإسم والنوع والوصف&lt;br /&gt;
* type=&amp;quot;gamemode&amp;quot;&lt;br /&gt;
تعني أن نوع السكربت هو مود لعب وتوجد أنواع عديدة مثل :&lt;br /&gt;
**gamemode&lt;br /&gt;
**map&lt;br /&gt;
**script&lt;br /&gt;
&lt;br /&gt;
===إنشاء ملف السكربت Lua===&lt;br /&gt;
قمنا بوضع هذا السطر في :&lt;br /&gt;
*meta.xml&lt;br /&gt;
:&lt;br /&gt;
		&amp;lt;script src=&amp;quot;script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
الآن نقوم بإنشاء ملف نصي بنفس الإسم&lt;br /&gt;
**script.lua&lt;br /&gt;
بإستخدام برنامج التحرير لديك .. نقوم بإنشاء الكود&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function joinHandler() -- الوظيفة .. وبعدها نقوم بكتابة الإسم&lt;br /&gt;
	local x = 1959.55 -- تعريف x&lt;br /&gt;
	local y = -1714.46 -- تعريف y&lt;br /&gt;
	local z = 10 -- تعريف z&lt;br /&gt;
	spawnPlayer(source, x, y, z) -- نقوم بإستخدام هذه الوظيفة لإنتاج اللاعب ونقوم بتحديد اللاعب وهو المصدر : source&lt;br /&gt;
	fadeCamera(source, true) -- نقوم بعمل fade للكاميرا&lt;br /&gt;
	setCameraTarget(source, source) -- نجعل هدف الكاميرا هو اللاعب &lt;br /&gt;
	outputChatBox(&amp;quot;مرحباً بك في السيرفر&amp;quot;, source) -- نقوم بإخراج نص في الدردشة&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, getRootElement(), joinHandler) -- نقوم بإضافة المعالج حيث سيتم تشغيله بعد الحدث المحدد وهو عند دخول اللا&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
وصف وشرح الكود اعلاه : &lt;br /&gt;
	سيقوم السكربت بوضع اللاعب في الاحداثيات (x,y,z) المحدده اعلاه, عند دخوله الى السيرفر&lt;br /&gt;
	لاحظ انه يجب استخدام  وظيفة [ ''fadeCamera'' ] ستكون الشاشة سوداء وأيضاً يجب تعيين الكاميرا ( setTargetCamera ) ..&lt;br /&gt;
&lt;br /&gt;
نرى أن '''source''' هو المصدر وهو اللاعب الذي يقوم بالدخول &lt;br /&gt;
&lt;br /&gt;
*[[addEventHandler]] - الاحداث وهي ما يجب فعله من قبل المستخدم او السيرفر&lt;br /&gt;
*[[function]] - وظيفة تعمل عند حدث من الاحداث وتحتوي على امر او أوامر&lt;br /&gt;
أيضاً لو رأينا في المعالج &lt;br /&gt;
*[[addEventHandler]] - إضافة معالج للحدث&lt;br /&gt;
نرى 3 أشياء&lt;br /&gt;
*: onPlayerJoin - عند دخول اللاعب&lt;br /&gt;
وهو الحدث .. حيث يحدد متى يتم تشغيل المعالج - في هذه الحالة عند دخول اللاعب&lt;br /&gt;
*getRootElement() - جلب العنصر الحالي&lt;br /&gt;
هذا يقوم بتعيين العنصر الذي يقوم بتشغيل الحدث &lt;br /&gt;
*joinHandler &lt;br /&gt;
وهو إسم الوظيفة التي قمنا بصناعتها &lt;br /&gt;
&lt;br /&gt;
يمكنك التوسع أكثر في : [[addEventHandler]]&lt;br /&gt;
&lt;br /&gt;
===تشغيل السكربت===&lt;br /&gt;
بعد أن تقوم بحفظ أجزاء السكربت في ملف واحد ويمكن حفظه في الملفات التالية :&lt;br /&gt;
* مجلد&lt;br /&gt;
* أرشيف .zip&lt;br /&gt;
ونقوم بنسخه إلى مجلد السكربتات داخل سيرفرك ونقوم بتشغيله بالطريقة العادية.&lt;br /&gt;
&lt;br /&gt;
الآن إنتهينا من صنع السكربت .. بعد هذا سنقوم بصنع سكربت مع أمر &lt;br /&gt;
* command&lt;br /&gt;
يمكنك المتابعة أو الذهاب إلى دورة صناعة النوافذ&lt;br /&gt;
*[[Introduction to Scripting GUI]]&lt;br /&gt;
&lt;br /&gt;
===إنشاء سكربت بطريقة مفصلة===&lt;br /&gt;
&lt;br /&gt;
==صناعة أمر بسيط==&lt;br /&gt;
لنعد الآن إلى ملف&lt;br /&gt;
*script.lua&lt;br /&gt;
ونقوم بتعديله قليلاً لإنشاء أمر بسيط يقوم بإنشاء سيارة بجانب اللاعب&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- في البداية نقوم بكتب وظيفة إنشاء السيارة&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
   -- هنا نقوم بكتابة وظيفة إنشاء السيارة كـ&lt;br /&gt;
   -- createVehicle&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- نقوم بإضافة الأمر&lt;br /&gt;
addCommandHandler(&amp;quot;createvehicle&amp;quot;, createVehicleForPlayer) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
''ملاحظة: يمكنك الضغط على الوظائف والتعمق فيها بداخل الويكي.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== الوظيفة ==&lt;br /&gt;
الوظيفة هي شيء يسمى&lt;br /&gt;
&lt;br /&gt;
function&lt;br /&gt;
&lt;br /&gt;
الوظيفة هي الشيء التي يتكون عليها الحدث&lt;br /&gt;
&lt;br /&gt;
يمكنك ان تسمي الوظيفة كما شئت ويمكنك أيضاً عدم وضع اسم للوظيفة&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''مثال لـ وظيفة لها إسم'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function arabs( ) -- الوظيفة&lt;br /&gt;
    outputChatBox(&amp;quot;مرحباً بك&amp;quot;) --s  ستلاحظ بـ أن كلمة &amp;quot; مرحباً بك &amp;quot; ظهرت في الشات عند دخول الاعب &lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, root, arabs) -- .الحدث مع اسم الوظيفة&lt;br /&gt;
-- root = getRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''مثال لـ وظيفة ليس لها إسم'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerWasted&amp;quot;, root,&lt;br /&gt;
function(_,killer)&lt;br /&gt;
    outputChatBox( killer .. &amp;quot; من قبل&amp;quot; .. getPlayerName(source) .. &amp;quot; لقد قُتل الاعب&amp;quot; )&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
كما تلاحظ ووضع قوس قريباً من&lt;br /&gt;
&lt;br /&gt;
end)&lt;br /&gt;
&lt;br /&gt;
هذا القوس يكمل القوس الآخر كما نلاحظ في الحدث &lt;br /&gt;
&lt;br /&gt;
addEventHandler(&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== الحدث ==&lt;br /&gt;
الحدث هو شيء يسمى&lt;br /&gt;
&lt;br /&gt;
event&lt;br /&gt;
&lt;br /&gt;
الحدث هو الذي يتكون على بناء الوظيفة&lt;br /&gt;
فـ اذا رجعنا الى الامثلة التي في الاعلى سوف نرى عدة احداث ومنها&lt;br /&gt;
&lt;br /&gt;
[[onPlayerWasted]]&lt;br /&gt;
&lt;br /&gt;
الحدث ببساطة يحدد متى سوف تحدث او كيف سوف تحدث الوظائف التي ادخلتها&lt;br /&gt;
&lt;br /&gt;
onPlayerWasted&lt;br /&gt;
&lt;br /&gt;
عند موت الاعب&lt;br /&gt;
&lt;br /&gt;
'''مثال للحدث'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onJoin()&lt;br /&gt;
    x, y, z = getElementPosition(source) -- s يآتي بمكان الاعب x, y, z&lt;br /&gt;
	    local theVehicle = createVehicle(445, x, y, z) -- s السيارة التي سـ تصنع بمكان الاعب الذي تم تحديده مسبقاً&lt;br /&gt;
		    warpPedIntoVehicle(source, theVehicle) -- s يجعل الاعب داخل السيارة&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, root, onJoin) -- s الحدث&lt;br /&gt;
-- root = getRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
هذه الوظيفة مع هذا الحدث سوف يعطون الاعب سيارة عند دخوله السيرفر&lt;br /&gt;
&lt;br /&gt;
ملاحظة الحدث ليس دائم على الوظيفة فـ أيصاً يمكنك تكوين هذه الوظيفة على حدث آخر&lt;br /&gt;
&lt;br /&gt;
'''مثال'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onJoin()&lt;br /&gt;
    x, y, z = getElementPosition(source)&lt;br /&gt;
	    local theVehicle = createVehicle(445, x, y, z)&lt;br /&gt;
		    warpPedIntoVehicle(source, theVehicle)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerLogin&amp;quot;, root, onJoin)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
هذا سوف يعطي الاعب سيارة لاكن ليس عند دخوله السيرفر , إنما عند دخوله حسابه&lt;br /&gt;
&lt;br /&gt;
'''Edit'''&lt;br /&gt;
&lt;br /&gt;
مثال آخر&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onVehicleExplode&amp;quot;,root, -- نضيف حدث عند إنفجار اي سيارة&lt;br /&gt;
    function() -- الوظيفة&lt;br /&gt;
        setTimer(destroyElement,5000,1,source) -- يخفي السيارة بعد 5 ثواني من انفاجرها &lt;br /&gt;
    end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
يمكنك ان تجد&lt;br /&gt;
الاحداث&lt;br /&gt;
والوظائف &lt;br /&gt;
كلنت وسيرفر&lt;br /&gt;
هنا&lt;br /&gt;
&lt;br /&gt;
كلنت:&lt;br /&gt;
&lt;br /&gt;
'''وظائف كلنت'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Client_Scripting_Functions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''احداث كلنت'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Client_Scripting_Events&lt;br /&gt;
&lt;br /&gt;
سيرفر:&lt;br /&gt;
&lt;br /&gt;
'''وظائف سيرفر'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Server_Scripting_Functions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''احداث سيرفر'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Server_Scripting_Events&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== String الـ ==&lt;br /&gt;
السترنج هو شيء يوجد في بعض الوظايف التي توجد داخل الام تي اي&lt;br /&gt;
&lt;br /&gt;
مثلاً&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onResourceStart&amp;quot;,resourceRoot, -- الايفنت هنا يجب ان تكون بين سترنق كما الموضح هنا&lt;br /&gt;
    function()&lt;br /&gt;
        outputChatBox(&amp;quot;تم بدء السكربت&amp;quot;) -- s هنا سوف يظهر رسالة بالشات &amp;quot; تم بدء السكربت &amp;quot; عند بدء السكربت ويجب ان تكون سترنق&lt;br /&gt;
    end&lt;br /&gt;
) -- نهاية قوس الحدث&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
السترنق له عدة أشكال , فيمكن ان يكون كالآتي&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
أو&lt;br /&gt;
&lt;br /&gt;
' '&lt;br /&gt;
&lt;br /&gt;
أو&lt;br /&gt;
&lt;br /&gt;
[[]]&lt;br /&gt;
&lt;br /&gt;
فمثلاً اذا نريد ان نخرج رسالة بعلبة الشات&lt;br /&gt;
&lt;br /&gt;
يمكن ان تكون كذلك &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
outputChatBox([[مرحباً]])&lt;br /&gt;
&lt;br /&gt;
-- أو كذلك&lt;br /&gt;
outputChatBox('مرحباً')&lt;br /&gt;
&lt;br /&gt;
-- أو كذلك&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;مرحباً&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Command handlerعن الـ====&lt;br /&gt;
.(`) أو زر F8 التي يمكن للاعب ان يعرضها باستخدام زر Consoleهو اسم الامر الذي يمكن للاعب ان يدخله في الـ [[addCommandHandler]] في argument أول&lt;br /&gt;
&lt;br /&gt;
.&amp;quot;createVehicleForPlayer&amp;quot;هي وظيفة تُنفذ عند كتابة اللاعب الامر في هذه الحالة لـ [[addCommandHandler]] في argument ثاني&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:اذا كنت متمرس في البرمجة, ستعرف انك ستحتاج ان تنفذ وظيفة مثل&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
functionName(argument1, argument2, argument3, ..)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
functionName(thePlayer, commandName, argument3, ..)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If we have a closer look on the lower example above, we can see argument1 is thePlayer and argument2 the commandName. thePlayer is simply the one who typed the command, so whatever you call it, the variable will contain the player who activated the command. commandName is simply the command they typed. So if they typed &amp;quot;/greet&amp;quot;, this argument will contain &amp;quot;greet&amp;quot;. Argument 3 is something extra the player typed, you'll learn it a little bit further in the tutorial. Never forget that the first 2 arguments are standard arguments, but you can name them to anything you want.&lt;br /&gt;
&lt;br /&gt;
We called the [[addCommandHandler]] function this way already and since ''createVehicleForPlayer'' is a function too, it can be called that way as well. But we are using a command handler for that, which calls it in a similiar manner, internally.&lt;br /&gt;
&lt;br /&gt;
For example: Someone types &amp;quot;createvehicle 468&amp;quot; ingame in the console to spawn a Sanchez, the command handler calls the createVehicleForPlayer function, as '''if''' we would have this line of code in the script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
createVehicleForPlayer(thePlayer,&amp;quot;createvehicle&amp;quot;,&amp;quot;468&amp;quot;) -- thePlayer هو الشيء الي كتب الكومند&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
As we can see, it provides several parameters: the player who called the command, the command he entered and whatever text he had after that, in this case &amp;quot;468&amp;quot; as vehicle id for the Sanchez. The first two parameters are the same with all command handlers, which you can read on the [[addEventHandler]] page. For this fact, you always have to define at least those two parameters to use any after that (for example to process text that was entered after the command, like in our example the vehicle model id).&lt;br /&gt;
&lt;br /&gt;
''Note: You have to add the command handler AFTER you defined the handler function, else it can't find it. The order of execution matters.''&lt;br /&gt;
&lt;br /&gt;
====Writing the function====&lt;br /&gt;
In order to fill the function we created, we need to think about what we have to do:&lt;br /&gt;
* Get the players position, so we know where to spawn the vehicle (we want it to appear right beside the player)&lt;br /&gt;
* Calculate the position we want to spawn the vehicle at (we don't want it to appear in the player)&lt;br /&gt;
* Spawn the vehicle&lt;br /&gt;
* Check if it has been spawned successfully, or output a message&lt;br /&gt;
&lt;br /&gt;
In order to achieve our goals, we have to use several functions. To find function we need to use, we should visit the [[Scripting Functions|Server Functions List]]. First we need a function to get the players position. Since players are Elements, we first jump to the '''Element functions''' where we find the [[getElementPosition]] function. By clicking on the function name in the list, you get to the function description. There we can see the syntax, what it returns and usually an example. The syntax shows us what arguments we can or have to submit.&lt;br /&gt;
&lt;br /&gt;
For [[getElementPosition]], the syntax is:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float, float, float getElementPosition ( element theElement )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three ''float'' in front of the function name are the return type. In this case it means the function returns three floating point numbers. (x, y and z) Within the parentheses, you can see what arguments you have to submit. In this case only the element whose position you want to get, which is the player in our example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	-- نأتي باحداثيات المكان الي نبغي نضع فيه السيارة بشكل x, y, z&lt;br /&gt;
	-- (local  تعني ان هاد الاختصار ما رح يشغل غير في هاد الفنكشن)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we want to ensure that the vehicle won't spawn directly in the player, so we add a few units to the ''x'' variable, which will make it spawn east from the player.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) -- نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- add 5 units to the x position&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we need another function, one to spawn a vehicle. We once again search for it on the [[Scripting Functions|Server Functions List]], this time - since we are talking about vehicles - in the '''Vehicle functions''' section, where we will choose [[createVehicle]]. In this function's syntax, we only have one return type (which is more common), a vehicle element that points to the vehicle we just created. Also, we see that some arguments are enclosed within [ ] which means that those are optional.&lt;br /&gt;
&lt;br /&gt;
We already have all arguments we need for [[createVehicle]] in our function: The position we just calculated in the ''x,y,z'' variables and the model id that we provided through the command (&amp;quot;createvehicle 468&amp;quot;) and can access in the function as ''vehicleModel'' variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) --  نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- add 5 units to the x position&lt;br /&gt;
	-- create the vehicle and store the returned vehicle element in the ''createdVehicle'' variable&lt;br /&gt;
	local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course this code can be improved in many ways, but at least we want to add a check whether the vehicle was created successfully or not. As we can read on the [[createVehicle]] page under '''Returns''', the function returns ''false'' when it was unable to create the vehicle. Thus, we check the value of the ''createVehicle'' variable.&lt;br /&gt;
&lt;br /&gt;
Now we have our complete script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) --  نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- نضيف 5 وحد ل الاحداثيات X&lt;br /&gt;
	local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z)&lt;br /&gt;
	-- نشوف لو السيارة اتعملت ام لا&lt;br /&gt;
	if (createdVehicle == false) then&lt;br /&gt;
		-- لو السياره اتعملت يبقي نعمل رسالة,لكن للاعب فقط&lt;br /&gt;
		outputChatBox(&amp;quot;Failed to create vehicle.&amp;quot;,thePlayer)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;createvehicle&amp;quot;, createVehicleForPlayer)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, we introduced another function with [[outputChatBox]]. By now, you should be able to explore the function's documentation page yourself. For more advanced scripting, please check out the [[Map manager|Map Manager]].&lt;br /&gt;
&lt;br /&gt;
==What you need to know==&lt;br /&gt;
You already read some things about resources, command handlers and finding functions in the documentation in the first paragraph, but there is much more to learn. This section will give you a rather short overview over some of these things, while linking to related pages if possible.&lt;br /&gt;
===Clientside and Serverside scripts===&lt;br /&gt;
You may have already noticed these or similiar terms (Server/Client) somewhere on this wiki, mostly in conjunction with functions. MTA not only supports scripts that run on the server and provide commands (like the one we wrote above) or other features, but also scripts that run on the MTA client the players use to connect to the server. The reason for this is, that some features MTA provides have to be clientside (like a GUI - Graphical User Interface), others should be because they work better and still others are better off to be serverside or just don't work clientside.&lt;br /&gt;
&lt;br /&gt;
Most scripts you will make (gamemodes, maps) will probably be serverside, like the one we wrote in the first section. If you run into something that can't be solved serverside, you will probably have to make it clientside. For a clientside script for example, you would create a ordinary script file (for example called ''client.lua'') and specify it in the meta.xml, like this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;client.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The ''type'' attribute defaults to 'server', so you only need to specify it for clientside scripts. When you do this, the clientside script will be downloaded to the player's computer once he connects to the server. Read more about [[Client side scripts]].&lt;br /&gt;
&lt;br /&gt;
===More complex resources===&lt;br /&gt;
The previous section showed briefly how to add clientside scripts to the resource, but there is also much more possible. As mentioned at the very top of this page, resources can be pretty much everything. Their purpose is defined by what they do. Let's have some theoretical resources, by looking at the files it contains, the ''meta.xml'' and what they might do:&lt;br /&gt;
&lt;br /&gt;
====First example - A utility script====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/admin_commands&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/commands.lua&lt;br /&gt;
	/client.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;admin commands&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;commands.lua&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;client.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''commands.lua'' provides some admin commands, like banning a player, muting or something else that can be used to admin the server&lt;br /&gt;
* The ''client.lua'' provides a GUI to be able to perform the mentioned actions easily&lt;br /&gt;
&lt;br /&gt;
This example might be running all the time (maybe even auto-started when the server starts) as it's useful during the whole gaming experience and also wont interfere with the gameplay, unless an admin decides to take some action of course.&lt;br /&gt;
&lt;br /&gt;
====Second example - A gamemode====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/counterstrike&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/counterstrike.lua&lt;br /&gt;
	/buymenu.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;Counterstrike remake&amp;quot; type=&amp;quot;gamemode&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;counterstrike.lua&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;buymenu.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''counterstrike.lua'' contains similiar to the following features:&lt;br /&gt;
** Let players choose their team and spawn them&lt;br /&gt;
** Provide them with weapons, targets and instructions (maybe read from a Map, see below)&lt;br /&gt;
** Define the game's rules, e.g. when does the round end, what happens when a player dies&lt;br /&gt;
** .. and maybe some more&lt;br /&gt;
* The ''buymenu.lua'' is a clientside script and creates a menu to buy weapons&lt;br /&gt;
&lt;br /&gt;
This example can be called a gamemode, since it not only intereferes with the gameplay, but actually defines the rules of it. The ''type'' attribute indicates that this example works with the [[Map manager]], yet another resource that was written by the QA Team to manage gamemodes and map loading. It is highly recommended that you base your gamemodes on the techniques it provides.&lt;br /&gt;
&lt;br /&gt;
This also means that the gamemode probably won't run without a map. Gamemodes should always be as generic as possible. An example for a map is stated in the next example.&lt;br /&gt;
&lt;br /&gt;
====Third example - A Map====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/cs-airport&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/airport.map&lt;br /&gt;
	/airport.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;Counterstrike airport map&amp;quot; type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;counterstrike&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;map src=&amp;quot;airport.map&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;airport.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''airport.map'' in a XML file that provides information about the map to the gamemode, these may include:&lt;br /&gt;
** Where the players should spawn, with what weapons, what teams there are&lt;br /&gt;
** What the targets are&lt;br /&gt;
** Weather, World Time, Timelimit&lt;br /&gt;
** Provide vehicles&lt;br /&gt;
* The ''airport.lua'' might contain map-specific features, that may include:&lt;br /&gt;
** Opening some door/make something explode when something specific happens&lt;br /&gt;
** Create or move some custom objects, or manipulate objects that are created through the .map file&lt;br /&gt;
** .. anything else map-specific you can think of&lt;br /&gt;
&lt;br /&gt;
As you can see, the ''type'' attribute changed to 'map', telling the [[Map manager]] that this resource is a map, while the ''gamemodes'' attribute tells it for which gamemodes this map is valid, in this case the gamemode from the above example.&lt;br /&gt;
What may come as a surprise is that there is also a script in the Map resource. Of course this is not necessarily needed in a map, but opens a wide range of possibilities for map makers to create their own world within the rules of the gamemode they create it for.&lt;br /&gt;
&lt;br /&gt;
The ''airport.map'' file might look similiar to this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map mode=&amp;quot;deathmatch&amp;quot; version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;terrorists&amp;gt;&lt;br /&gt;
		&amp;lt;spawnpoint posX=&amp;quot;2332.23&amp;quot; posY=&amp;quot;-12232.33&amp;quot; posZ=&amp;quot;4.42223&amp;quot; skins=&amp;quot;23-40&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/terrorists&amp;gt;&lt;br /&gt;
	&amp;lt;counterterrorists&amp;gt;&lt;br /&gt;
		&amp;lt;spawnpoint posX=&amp;quot;2334.23443&amp;quot; posY=&amp;quot;-12300.233&amp;quot; posZ=&amp;quot;10.2344&amp;quot; skins=&amp;quot;40-50&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/counterterrorists&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;bomb posX=&amp;quot;23342.23&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
	&amp;lt;vehicle posX=&amp;quot;&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; model=&amp;quot;602&amp;quot; /&amp;gt;	&lt;br /&gt;
	&amp;lt;vehicle posX=&amp;quot;&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; model=&amp;quot;603&amp;quot; /&amp;gt;	&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When a gamemode is started with a map, the map resources is automatically started by the mapmanager and the information it contains can be read by the gamemode resource. When the map changes, the current map resource is stopped and the next map resource is started. For a more in-depth explanation and examples of how map resources are utilized in the main script, please visit the [[Writing Gamemodes]] page.&lt;br /&gt;
&lt;br /&gt;
===Events===&lt;br /&gt;
Events are the way MTA tells scripts about things that happen. For example when a player dies, the [[onPlayerWasted]] event is triggered. In order to perform any actions when a player dies, you have to prepare yourself similiar to adding a command handler, as shown in [[#Writing_the_script|the first chapter]].&lt;br /&gt;
&lt;br /&gt;
This example will output a message with the name of the player who died:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function playerDied(totalAmmo, killer, killerWeapon, bodypart)&lt;br /&gt;
	outputChatBox(getPlayerName(source)..&amp;quot; died!&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerWasted&amp;quot;,getRootElement(),playerDied)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead of showing what arguments are needed, the documentation page for Events shows what parameters are passed to the handler function, similiar to the way a [[#About_command_handlers|command handler]] does, just that it is different from event to event. Another important point is the ''source'' variable, that exists in handler functions. It doesn't have to be added to the parameter list of the function, but it still exists. It has a different value from event to event, for player events (as in the example above) it is the player element. As another example, you can take a look at the basic spawning player script in the first section to get an idea how ''source'' is used.&lt;br /&gt;
&lt;br /&gt;
==Where to go from here==&lt;br /&gt;
You should now be familiar with the most basic aspects of MTA scripting and also a bit with the documentation. The [[Main Page]] provides you with links to more information, Tutorials and References that allow a deeper look into the topics you desire to learn about.&lt;br /&gt;
&lt;br /&gt;
From here we recommend reading the [[debugging]] tutorial. Good debugging skills are an absolute necessity when you are making scripts.&lt;br /&gt;
&lt;br /&gt;
[[ru:Scripting Introduction]]&lt;br /&gt;
[[it:Introduzione allo scripting]]&lt;br /&gt;
[[es:Introducción a la Programación]]&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/%D9%85%D9%82%D8%AF%D9%85%D9%87_%D9%81%D9%8A_%D8%A7%D9%84%D8%A8%D8%B1%D9%85%D8%AC%D9%87&amp;diff=47528</id>
		<title>AR/مقدمه في البرمجه</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/%D9%85%D9%82%D8%AF%D9%85%D9%87_%D9%81%D9%8A_%D8%A7%D9%84%D8%A8%D8%B1%D9%85%D8%AC%D9%87&amp;diff=47528"/>
		<updated>2016-05-15T15:19:19Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p align=&amp;quot;right&amp;quot;&amp;gt;  &lt;br /&gt;
 تختلف أنواع السكربتات فمنها خريطة أو وضع للعب &lt;br /&gt;
&lt;br /&gt;
السكربتات جزء أساسي في تشغيل MTA &lt;br /&gt;
&lt;br /&gt;
فتستطيع بإستخدامهم إنشاء تطبيقات لتحسين اللعب ،&lt;br /&gt;
&amp;quot; freeroam , race , deathmatch &amp;quot; وغيرها ..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
برمجة السكربتات تعتمد على لغة البرمجة (Lua) [www.lua.org] .&lt;br /&gt;
&lt;br /&gt;
لغة البرمجة تعتمد إعتماداً كلياً على اللغة الإنجليزية , فيجب أن تكون لديك خلفية في اللغة الإنجليزية قبل المتابعة.&lt;br /&gt;
&lt;br /&gt;
لبرمجة سكربت ما تحتاج لمحرر .. ويفضل إستخدام محرر إحترافي لكي يسهل عليك البرمجة مثل :&lt;br /&gt;
*Notepad++ [http://notepad-plus-plus.org/download]&lt;br /&gt;
*Lua Edit [http://luaedit.sourceforge.net/ LuaEdit]&lt;br /&gt;
&lt;br /&gt;
لكن يفضل إستخدام برنامج MTASE فهو يسهل عملية إنشاء السكربتات وبرمجتها :&lt;br /&gt;
* [[MTASE|MTA Script Editor]].'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==إنشاء سكربت ==&lt;br /&gt;
&lt;br /&gt;
سوف نتعلم كيف نقوم بإنشاء سكربت يدخل اللاعب إلى اللعبة .. خطوة بحطوة&lt;br /&gt;
&lt;br /&gt;
اولا لا بد من معرفة انواع ملفات السكربت    &lt;br /&gt;
                                                                                                          &lt;br /&gt;
1-Meta.xml -- يقوم هذا الملف بتعرف الملفات الموجود في السكربت للسيرفر               &lt;br /&gt;
                                                                                          &lt;br /&gt;
2-Client -- يقوم هذا الملف بتشغيل جميع أوامر المتعلقة بالاعب فقط                                       &lt;br /&gt;
&lt;br /&gt;
3-Server -- يقوم هذا الملف بتشغيل جميع الاوامر سواء كانت للسيرفر او الاعب&lt;br /&gt;
&lt;br /&gt;
===أين مسار كل البرامج النصية (السكريبتات أو المودات)؟===&lt;br /&gt;
الان نتعرف على مجلد المودات أو السكربتات.&lt;br /&gt;
اذهب إلى مجلد Multi Theft Auto واتبع المسار التالي:&lt;br /&gt;
&lt;br /&gt;
	/Your MTA Server/mods/deathmatch/resources/&lt;br /&gt;
&lt;br /&gt;
. أو مجلد عادي zip سترى الكثير من الملفات. ربما ترى مجلدات صيغتها , MTA .. وجميعها يقبله الـ&lt;br /&gt;
&lt;br /&gt;
وهو الذي سنستخدمه بالبرنامج التعليمي &amp;quot;myserver&amp;quot; ولإنشاء المودات الخاصة بك: قم بعمل مجلد جديد واجعل اسمه كما تريد فمثلاً قم بتسميته &lt;br /&gt;
&lt;br /&gt;
والان يجب أن يكون مسار المجلد الذي قمت بعمله هذا:&lt;br /&gt;
&lt;br /&gt;
	/Your MTA Server/mods/deathmatch/resources/myserver/&lt;br /&gt;
&lt;br /&gt;
* myserver: اسم المجلد الذي قمت بتسميته&lt;br /&gt;
&lt;br /&gt;
=== meta.xml تعريف السكربت اضافة ملف===&lt;br /&gt;
حتى يستطيع السيرفر من معرفة المودات, يجب علينا إنشاء ملف meta.xml &lt;br /&gt;
&lt;br /&gt;
&amp;quot; ويكون بداخل مجلد السكربت الذي قمنا بإنشائه وهو &amp;quot;myserver&amp;quot; &lt;br /&gt;
&lt;br /&gt;
ولإنشاء ملف meta.xml :&lt;br /&gt;
&lt;br /&gt;
وافتحه باستخدام المفكرة =) meta.xml أفتح ملف نصي جديد وقم بتسميته&lt;br /&gt;
&lt;br /&gt;
ولا تنسى ان يكون بداخل مجلد السكربت .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
أدخل الكود التالي في ملف ''meta.xml'':&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
     &amp;lt;info author=&amp;quot;إسمك&amp;quot; type=&amp;quot;gamemode&amp;quot; name=&amp;quot;إسم السكربت&amp;quot; description=&amp;quot;وصف بسيط للسكربت&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;script src=&amp;quot;script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
هنا يتم تعريف أجزاء السكربت فمثلاً :&lt;br /&gt;
* &amp;lt;info ..&amp;gt;&lt;br /&gt;
تضع فيه بيانات السكربت .. مثل الإسم والنوع والوصف&lt;br /&gt;
* type=&amp;quot;gamemode&amp;quot;&lt;br /&gt;
تعني أن نوع السكربت هو مود لعب وتوجد أنواع عديدة مثل :&lt;br /&gt;
**gamemode&lt;br /&gt;
**map&lt;br /&gt;
**script&lt;br /&gt;
&lt;br /&gt;
===إنشاء ملف السكربت Lua===&lt;br /&gt;
قمنا بوضع هذا السطر في :&lt;br /&gt;
*meta.xml&lt;br /&gt;
:&lt;br /&gt;
		&amp;lt;script src=&amp;quot;script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
الآن نقوم بإنشاء ملف نصي بنفس الإسم&lt;br /&gt;
**script.lua&lt;br /&gt;
بإستخدام برنامج التحرير لديك .. نقوم بإنشاء الكود&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function joinHandler() -- الوظيفة .. وبعدها نقوم بكتابة الإسم&lt;br /&gt;
	local x = 1959.55 -- تعريف x&lt;br /&gt;
	local y = -1714.46 -- تعريف y&lt;br /&gt;
	local z = 10 -- تعريف z&lt;br /&gt;
	spawnPlayer(source, x, y, z) -- نقوم بإستخدام هذه الوظيفة لإنتاج اللاعب ونقوم بتحديد اللاعب وهو المصدر : source&lt;br /&gt;
	fadeCamera(source, true) -- نقوم بعمل fade للكاميرا&lt;br /&gt;
	setCameraTarget(source, source) -- نجعل هدف الكاميرا هو اللاعب &lt;br /&gt;
	outputChatBox(&amp;quot;مرحباً بك في السيرفر&amp;quot;, source) -- نقوم بإخراج نص في الدردشة&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, getRootElement(), joinHandler) -- نقوم بإضافة المعالج حيث سيتم تشغيله بعد الحدث المحدد وهو عند دخول اللا&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
وصف وشرح الكود اعلاه : &lt;br /&gt;
	سيقوم السكربت بوضع اللاعب في الاحداثيات (x,y,z) المحدده اعلاه, عند دخوله الى السيرفر&lt;br /&gt;
	لاحظ انه يجب استخدام  وظيفة [ ''fadeCamera'' ] ستكون الشاشة سوداء وأيضاً يجب تعيين الكاميرا ( setTargetCamera ) ..&lt;br /&gt;
&lt;br /&gt;
نرى أن '''source''' هو المصدر وهو اللاعب الذي يقوم بالدخول &lt;br /&gt;
&lt;br /&gt;
*[[addEventHandler]] - الاحداث وهي ما يجب فعله من قبل المستخدم او السيرفر&lt;br /&gt;
*[[function]] - وظيفة تعمل عند حدث من الاحداث وتحتوي على امر او أوامر&lt;br /&gt;
أيضاً لو رأينا في المعالج &lt;br /&gt;
*[[addEventHandler]] - إضافة معالج للحدث&lt;br /&gt;
نرى 3 أشياء&lt;br /&gt;
*: onPlayerJoin - عند دخول اللاعب&lt;br /&gt;
وهو الحدث .. حيث يحدد متى يتم تشغيل المعالج - في هذه الحالة عند دخول اللاعب&lt;br /&gt;
*getRootElement() - جلب العنصر الحالي&lt;br /&gt;
هذا يقوم بتعيين العنصر الذي يقوم بتشغيل الحدث &lt;br /&gt;
*joinHandler &lt;br /&gt;
وهو إسم الوظيفة التي قمنا بصناعتها &lt;br /&gt;
&lt;br /&gt;
يمكنك التوسع أكثر في : [[addEventHandler]]&lt;br /&gt;
&lt;br /&gt;
===تشغيل السكربت===&lt;br /&gt;
بعد أن تقوم بحفظ أجزاء السكربت في ملف واحد ويمكن حفظه في الملفات التالية :&lt;br /&gt;
* مجلد&lt;br /&gt;
* أرشيف .zip&lt;br /&gt;
ونقوم بنسخه إلى مجلد السكربتات داخل سيرفرك ونقوم بتشغيله بالطريقة العادية.&lt;br /&gt;
&lt;br /&gt;
الآن إنتهينا من صنع السكربت .. بعد هذا سنقوم بصنع سكربت مع أمر &lt;br /&gt;
* command&lt;br /&gt;
يمكنك المتابعة أو الذهاب إلى دورة صناعة النوافذ&lt;br /&gt;
*[[Introduction to Scripting GUI]]&lt;br /&gt;
&lt;br /&gt;
===إنشاء سكربت بطريقة مفصلة===&lt;br /&gt;
&lt;br /&gt;
==صناعة أمر بسيط==&lt;br /&gt;
لنعد الآن إلى ملف&lt;br /&gt;
*script.lua&lt;br /&gt;
ونقوم بتعديله قليلاً لإنشاء أمر بسيط يقوم بإنشاء سيارة بجانب اللاعب&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- في البداية نقوم بكتب وظيفة إنشاء السيارة&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
   -- هنا نقوم بكتابة وظيفة إنشاء السيارة كـ&lt;br /&gt;
   -- createVehicle&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- نقوم بإضافة الأمر&lt;br /&gt;
addCommandHandler(&amp;quot;createvehicle&amp;quot;, createVehicleForPlayer) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
''ملاحظة: يمكنك الضغط على الوظائف والتعمق فيها بداخل الويكي.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== الوظيفة ==&lt;br /&gt;
الوظيفة هي شيء يسمى&lt;br /&gt;
&lt;br /&gt;
function&lt;br /&gt;
&lt;br /&gt;
الوظيفة هي الشيء التي يتكون عليها الحدث&lt;br /&gt;
&lt;br /&gt;
يمكنك ان تسمي الوظيفة كما شئت ويمكنك أيضاً عدم وضع اسم للوظيفة&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''مثال لـ وظيفة لها إسم'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function arabs( ) -- الوظيفة&lt;br /&gt;
    outputChatBox(&amp;quot;مرحباً بك&amp;quot;) --s  ستلاحظ بـ أن كلمة &amp;quot; مرحباً بك &amp;quot; ظهرت في الشات عند دخول الاعب &lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, root, arabs) -- .الحدث مع اسم الوظيفة&lt;br /&gt;
-- root = getRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''مثال لـ وظيفة ليس لها إسم'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerWasted&amp;quot;, root,&lt;br /&gt;
function(_,killer)&lt;br /&gt;
    outputChatBox( killer .. &amp;quot; من قبل&amp;quot; .. getPlayerName(source) .. &amp;quot; لقد قُتل الاعب&amp;quot; )&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
كما تلاحظ ووضع قوس قريباً من&lt;br /&gt;
&lt;br /&gt;
end)&lt;br /&gt;
&lt;br /&gt;
هذا القوس يكمل القوس الآخر كما نلاحظ في الحدث &lt;br /&gt;
&lt;br /&gt;
addEventHandler(&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== الحدث ==&lt;br /&gt;
الحدث هو شيء يسمى&lt;br /&gt;
&lt;br /&gt;
event&lt;br /&gt;
&lt;br /&gt;
الحدث هو الذي يتكون على بناء الوظيفة&lt;br /&gt;
فـ اذا رجعنا الى الامثلة التي في الاعلى سوف نرى عدة احداث ومنها&lt;br /&gt;
&lt;br /&gt;
[[onPlayerWasted]]&lt;br /&gt;
&lt;br /&gt;
الحدث ببساطة يحدد متى سوف تحدث او كيف سوف تحدث الوظائف التي ادخلتها&lt;br /&gt;
&lt;br /&gt;
onPlayerWasted&lt;br /&gt;
&lt;br /&gt;
عند موت الاعب&lt;br /&gt;
&lt;br /&gt;
'''مثال للحدث'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onJoin()&lt;br /&gt;
    x, y, z = getElementPosition(source) -- s يآتي بمكان الاعب x, y, z&lt;br /&gt;
	    local theVehicle = createVehicle(445, x, y, z) -- s السيارة التي سـ تصنع بمكان الاعب الذي تم تحديده مسبقاً&lt;br /&gt;
		    warpPedIntoVehicle(source, theVehicle) -- s يجعل الاعب داخل السيارة&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, root, onJoin) -- s الحدث&lt;br /&gt;
-- root = getRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
هذه الوظيفة مع هذا الحدث سوف يعطون الاعب سيارة عند دخوله السيرفر&lt;br /&gt;
&lt;br /&gt;
ملاحظة الحدث ليس دائم على الوظيفة فـ أيصاً يمكنك تكوين هذه الوظيفة على حدث آخر&lt;br /&gt;
&lt;br /&gt;
'''مثال'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onJoin()&lt;br /&gt;
    x, y, z = getElementPosition(source)&lt;br /&gt;
	    local theVehicle = createVehicle(445, x, y, z)&lt;br /&gt;
		    warpPedIntoVehicle(source, theVehicle)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerLogin&amp;quot;, root, onJoin)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
هذا سوف يعطي الاعب سيارة لاكن ليس عند دخوله السيرفر , إنما عند دخوله حسابه&lt;br /&gt;
&lt;br /&gt;
'''Edit'''&lt;br /&gt;
&lt;br /&gt;
مثال آخر&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onVehicleExplode&amp;quot;,root, -- نضيف حدث عند إنفجار اي سيارة&lt;br /&gt;
    function() -- الوظيفة&lt;br /&gt;
        setTimer(destroyElement,5000,1,source) -- يخفي السيارة بعد 5 ثواني من انفاجرها &lt;br /&gt;
    end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
يمكنك ان تجد&lt;br /&gt;
الاحداث&lt;br /&gt;
والوظائف &lt;br /&gt;
كلنت وسيرفر&lt;br /&gt;
هنا&lt;br /&gt;
&lt;br /&gt;
كلنت:&lt;br /&gt;
&lt;br /&gt;
'''وظائف كلنت'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Client_Scripting_Functions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''احداث كلنت'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Client_Scripting_Events&lt;br /&gt;
&lt;br /&gt;
سيرفر:&lt;br /&gt;
&lt;br /&gt;
'''وظائف سيرفر'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Server_Scripting_Functions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''احداث سيرفر'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Server_Scripting_Events&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== String الـ ==&lt;br /&gt;
السترنج هو شيء يوجد في بعض الوظايف التي توجد داخل الام تي اي&lt;br /&gt;
&lt;br /&gt;
مثلاً&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onResourceStart&amp;quot;,resourceRoot, -- الايفنت هنا يجب ان تكون بين سترنق كما الموضح هنا&lt;br /&gt;
    function()&lt;br /&gt;
        outputChatBox(&amp;quot;تم بدء السكربت&amp;quot;) -- s هنا سوف يظهر رسالة بالشات &amp;quot; تم بدء السكربت &amp;quot; عند بدء السكربت ويجب ان تكون سترنق&lt;br /&gt;
    end&lt;br /&gt;
) -- نهاية قوس الحدث&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
السترنق له عدة أشكال , فيمكن ان يكون كالآتي&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
أو&lt;br /&gt;
&lt;br /&gt;
' '&lt;br /&gt;
&lt;br /&gt;
أو&lt;br /&gt;
&lt;br /&gt;
[[]]&lt;br /&gt;
&lt;br /&gt;
فمثلاً اذا نريد ان نخرج رسالة بعلبة الشات&lt;br /&gt;
&lt;br /&gt;
يمكن ان تكون كذلك &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
outputChatBox([[مرحباً]])&lt;br /&gt;
&lt;br /&gt;
-- أو كذلك&lt;br /&gt;
outputChatBox('مرحباً')&lt;br /&gt;
&lt;br /&gt;
-- أو كذلك&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;مرحباً&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Command handlerعن الـ====&lt;br /&gt;
.(`) أو زر F8 التي يمكن للاعب ان يعرضها باستخدام زر Consoleهو اسم الامر الذي يمكن للاعب ان يدخله في الـ [[addCommandHandler]] في argument أول&lt;br /&gt;
&lt;br /&gt;
.&amp;quot;createVehicleForPlayer&amp;quot;هي وظيفة تُنفذ عند كتابة اللاعب الامر في هذه الحالة لـ [[addCommandHandler]] في argument ثاني&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:اذا كنت متمرس في البرمجة, ستعرف انك ستحتاج ان تنفذ وظيفة مثل&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
functionName(argument1, argument2, argument3, ..)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
functionName(thePlayer, commandName, argument3, ..)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If we have a closer look on the lower example above, we can see argument1 is thePlayer and argument2 the commandName. thePlayer is simply the one who typed the command, so whatever you call it, the variable will contain the player who activated the command. commandName is simply the command they typed. So if they typed &amp;quot;/greet&amp;quot;, this argument will contain &amp;quot;greet&amp;quot;. Argument 3 is something extra the player typed, you'll learn it a little bit further in the tutorial. Never forget that the first 2 arguments are standard arguments, but you can name them to anything you want.&lt;br /&gt;
&lt;br /&gt;
We called the [[addCommandHandler]] function this way already and since ''createVehicleForPlayer'' is a function too, it can be called that way as well. But we are using a command handler for that, which calls it in a similiar manner, internally.&lt;br /&gt;
&lt;br /&gt;
For example: Someone types &amp;quot;createvehicle 468&amp;quot; ingame in the console to spawn a Sanchez, the command handler calls the createVehicleForPlayer function, as '''if''' we would have this line of code in the script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
createVehicleForPlayer(thePlayer,&amp;quot;createvehicle&amp;quot;,&amp;quot;468&amp;quot;) -- thePlayer هو الشيء الي كتب الكومند&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
As we can see, it provides several parameters: the player who called the command, the command he entered and whatever text he had after that, in this case &amp;quot;468&amp;quot; as vehicle id for the Sanchez. The first two parameters are the same with all command handlers, which you can read on the [[addEventHandler]] page. For this fact, you always have to define at least those two parameters to use any after that (for example to process text that was entered after the command, like in our example the vehicle model id).&lt;br /&gt;
&lt;br /&gt;
''Note: You have to add the command handler AFTER you defined the handler function, else it can't find it. The order of execution matters.''&lt;br /&gt;
&lt;br /&gt;
====Writing the function====&lt;br /&gt;
In order to fill the function we created, we need to think about what we have to do:&lt;br /&gt;
* Get the players position, so we know where to spawn the vehicle (we want it to appear right beside the player)&lt;br /&gt;
* Calculate the position we want to spawn the vehicle at (we don't want it to appear in the player)&lt;br /&gt;
* Spawn the vehicle&lt;br /&gt;
* Check if it has been spawned successfully, or output a message&lt;br /&gt;
&lt;br /&gt;
In order to achieve our goals, we have to use several functions. To find function we need to use, we should visit the [[Scripting Functions|Server Functions List]]. First we need a function to get the players position. Since players are Elements, we first jump to the '''Element functions''' where we find the [[getElementPosition]] function. By clicking on the function name in the list, you get to the function description. There we can see the syntax, what it returns and usually an example. The syntax shows us what arguments we can or have to submit.&lt;br /&gt;
&lt;br /&gt;
For [[getElementPosition]], the syntax is:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float, float, float getElementPosition ( element theElement )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three ''float'' in front of the function name are the return type. In this case it means the function returns three floating point numbers. (x, y and z) Within the parentheses, you can see what arguments you have to submit. In this case only the element whose position you want to get, which is the player in our example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	-- نأتي باحداثيات المكان الي نبغي نضع فيه السيارة بشكل x, y, z&lt;br /&gt;
	-- (local  تعني ان هاد الاختصار ما رح يشغل غير في هاد الفنكشن)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we want to ensure that the vehicle won't spawn directly in the player, so we add a few units to the ''x'' variable, which will make it spawn east from the player.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) -- نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- add 5 units to the x position&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we need another function, one to spawn a vehicle. We once again search for it on the [[Scripting Functions|Server Functions List]], this time - since we are talking about vehicles - in the '''Vehicle functions''' section, where we will choose [[createVehicle]]. In this function's syntax, we only have one return type (which is more common), a vehicle element that points to the vehicle we just created. Also, we see that some arguments are enclosed within [ ] which means that those are optional.&lt;br /&gt;
&lt;br /&gt;
We already have all arguments we need for [[createVehicle]] in our function: The position we just calculated in the ''x,y,z'' variables and the model id that we provided through the command (&amp;quot;createvehicle 468&amp;quot;) and can access in the function as ''vehicleModel'' variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) --  نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- add 5 units to the x position&lt;br /&gt;
	-- create the vehicle and store the returned vehicle element in the ''createdVehicle'' variable&lt;br /&gt;
	local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course this code can be improved in many ways, but at least we want to add a check whether the vehicle was created successfully or not. As we can read on the [[createVehicle]] page under '''Returns''', the function returns ''false'' when it was unable to create the vehicle. Thus, we check the value of the ''createVehicle'' variable.&lt;br /&gt;
&lt;br /&gt;
Now we have our complete script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) --  نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- نضيف 5 وحد ل الاحداثيات X&lt;br /&gt;
	local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z)&lt;br /&gt;
	-- نشوف لو السيارة اتعملت ام لا&lt;br /&gt;
	if (createdVehicle == false) then&lt;br /&gt;
		-- لو السياره اتعملت يبقي نعمل رسالة,لكن للاعب فقط&lt;br /&gt;
		outputChatBox(&amp;quot;Failed to create vehicle.&amp;quot;,thePlayer)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;createvehicle&amp;quot;, createVehicleForPlayer)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, we introduced another function with [[outputChatBox]]. By now, you should be able to explore the function's documentation page yourself. For more advanced scripting, please check out the [[Map manager|Map Manager]].&lt;br /&gt;
&lt;br /&gt;
==What you need to know==&lt;br /&gt;
You already read some things about resources, command handlers and finding functions in the documentation in the first paragraph, but there is much more to learn. This section will give you a rather short overview over some of these things, while linking to related pages if possible.&lt;br /&gt;
===Clientside and Serverside scripts===&lt;br /&gt;
You may have already noticed these or similiar terms (Server/Client) somewhere on this wiki, mostly in conjunction with functions. MTA not only supports scripts that run on the server and provide commands (like the one we wrote above) or other features, but also scripts that run on the MTA client the players use to connect to the server. The reason for this is, that some features MTA provides have to be clientside (like a GUI - Graphical User Interface), others should be because they work better and still others are better off to be serverside or just don't work clientside.&lt;br /&gt;
&lt;br /&gt;
Most scripts you will make (gamemodes, maps) will probably be serverside, like the one we wrote in the first section. If you run into something that can't be solved serverside, you will probably have to make it clientside. For a clientside script for example, you would create a ordinary script file (for example called ''client.lua'') and specify it in the meta.xml, like this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;client.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The ''type'' attribute defaults to 'server', so you only need to specify it for clientside scripts. When you do this, the clientside script will be downloaded to the player's computer once he connects to the server. Read more about [[Client side scripts]].&lt;br /&gt;
&lt;br /&gt;
===More complex resources===&lt;br /&gt;
The previous section showed briefly how to add clientside scripts to the resource, but there is also much more possible. As mentioned at the very top of this page, resources can be pretty much everything. Their purpose is defined by what they do. Let's have some theoretical resources, by looking at the files it contains, the ''meta.xml'' and what they might do:&lt;br /&gt;
&lt;br /&gt;
====First example - A utility script====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/admin_commands&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/commands.lua&lt;br /&gt;
	/client.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;admin commands&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;commands.lua&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;client.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''commands.lua'' provides some admin commands, like banning a player, muting or something else that can be used to admin the server&lt;br /&gt;
* The ''client.lua'' provides a GUI to be able to perform the mentioned actions easily&lt;br /&gt;
&lt;br /&gt;
This example might be running all the time (maybe even auto-started when the server starts) as it's useful during the whole gaming experience and also wont interfere with the gameplay, unless an admin decides to take some action of course.&lt;br /&gt;
&lt;br /&gt;
====Second example - A gamemode====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/counterstrike&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/counterstrike.lua&lt;br /&gt;
	/buymenu.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;Counterstrike remake&amp;quot; type=&amp;quot;gamemode&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;counterstrike.lua&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;buymenu.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''counterstrike.lua'' contains similiar to the following features:&lt;br /&gt;
** Let players choose their team and spawn them&lt;br /&gt;
** Provide them with weapons, targets and instructions (maybe read from a Map, see below)&lt;br /&gt;
** Define the game's rules, e.g. when does the round end, what happens when a player dies&lt;br /&gt;
** .. and maybe some more&lt;br /&gt;
* The ''buymenu.lua'' is a clientside script and creates a menu to buy weapons&lt;br /&gt;
&lt;br /&gt;
This example can be called a gamemode, since it not only intereferes with the gameplay, but actually defines the rules of it. The ''type'' attribute indicates that this example works with the [[Map manager]], yet another resource that was written by the QA Team to manage gamemodes and map loading. It is highly recommended that you base your gamemodes on the techniques it provides.&lt;br /&gt;
&lt;br /&gt;
This also means that the gamemode probably won't run without a map. Gamemodes should always be as generic as possible. An example for a map is stated in the next example.&lt;br /&gt;
&lt;br /&gt;
====Third example - A Map====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/cs-airport&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/airport.map&lt;br /&gt;
	/airport.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;Counterstrike airport map&amp;quot; type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;counterstrike&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;map src=&amp;quot;airport.map&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;airport.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''airport.map'' in a XML file that provides information about the map to the gamemode, these may include:&lt;br /&gt;
** Where the players should spawn, with what weapons, what teams there are&lt;br /&gt;
** What the targets are&lt;br /&gt;
** Weather, World Time, Timelimit&lt;br /&gt;
** Provide vehicles&lt;br /&gt;
* The ''airport.lua'' might contain map-specific features, that may include:&lt;br /&gt;
** Opening some door/make something explode when something specific happens&lt;br /&gt;
** Create or move some custom objects, or manipulate objects that are created through the .map file&lt;br /&gt;
** .. anything else map-specific you can think of&lt;br /&gt;
&lt;br /&gt;
As you can see, the ''type'' attribute changed to 'map', telling the [[Map manager]] that this resource is a map, while the ''gamemodes'' attribute tells it for which gamemodes this map is valid, in this case the gamemode from the above example.&lt;br /&gt;
What may come as a surprise is that there is also a script in the Map resource. Of course this is not necessarily needed in a map, but opens a wide range of possibilities for map makers to create their own world within the rules of the gamemode they create it for.&lt;br /&gt;
&lt;br /&gt;
The ''airport.map'' file might look similiar to this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map mode=&amp;quot;deathmatch&amp;quot; version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;terrorists&amp;gt;&lt;br /&gt;
		&amp;lt;spawnpoint posX=&amp;quot;2332.23&amp;quot; posY=&amp;quot;-12232.33&amp;quot; posZ=&amp;quot;4.42223&amp;quot; skins=&amp;quot;23-40&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/terrorists&amp;gt;&lt;br /&gt;
	&amp;lt;counterterrorists&amp;gt;&lt;br /&gt;
		&amp;lt;spawnpoint posX=&amp;quot;2334.23443&amp;quot; posY=&amp;quot;-12300.233&amp;quot; posZ=&amp;quot;10.2344&amp;quot; skins=&amp;quot;40-50&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/counterterrorists&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;bomb posX=&amp;quot;23342.23&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
	&amp;lt;vehicle posX=&amp;quot;&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; model=&amp;quot;602&amp;quot; /&amp;gt;	&lt;br /&gt;
	&amp;lt;vehicle posX=&amp;quot;&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; model=&amp;quot;603&amp;quot; /&amp;gt;	&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When a gamemode is started with a map, the map resources is automatically started by the mapmanager and the information it contains can be read by the gamemode resource. When the map changes, the current map resource is stopped and the next map resource is started. For a more in-depth explanation and examples of how map resources are utilized in the main script, please visit the [[Writing Gamemodes]] page.&lt;br /&gt;
&lt;br /&gt;
===Events===&lt;br /&gt;
Events are the way MTA tells scripts about things that happen. For example when a player dies, the [[onPlayerWasted]] event is triggered. In order to perform any actions when a player dies, you have to prepare yourself similiar to adding a command handler, as shown in [[#Writing_the_script|the first chapter]].&lt;br /&gt;
&lt;br /&gt;
This example will output a message with the name of the player who died:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function playerDied(totalAmmo, killer, killerWeapon, bodypart)&lt;br /&gt;
	outputChatBox(getPlayerName(source)..&amp;quot; died!&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerWasted&amp;quot;,getRootElement(),playerDied)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead of showing what arguments are needed, the documentation page for Events shows what parameters are passed to the handler function, similiar to the way a [[#About_command_handlers|command handler]] does, just that it is different from event to event. Another important point is the ''source'' variable, that exists in handler functions. It doesn't have to be added to the parameter list of the function, but it still exists. It has a different value from event to event, for player events (as in the example above) it is the player element. As another example, you can take a look at the basic spawning player script in the first section to get an idea how ''source'' is used.&lt;br /&gt;
&lt;br /&gt;
==Where to go from here==&lt;br /&gt;
You should now be familiar with the most basic aspects of MTA scripting and also a bit with the documentation. The [[Main Page]] provides you with links to more information, Tutorials and References that allow a deeper look into the topics you desire to learn about.&lt;br /&gt;
&lt;br /&gt;
From here we recommend reading the [[debugging]] tutorial. Good debugging skills are an absolute necessity when you are making scripts.&lt;br /&gt;
&lt;br /&gt;
[[ru:Scripting Introduction]]&lt;br /&gt;
[[it:Introduzione allo scripting]]&lt;br /&gt;
[[es:Introducción a la Programación]]&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/%D9%85%D9%82%D8%AF%D9%85%D9%87_%D9%81%D9%8A_%D8%A7%D9%84%D8%A8%D8%B1%D9%85%D8%AC%D9%87&amp;diff=47527</id>
		<title>AR/مقدمه في البرمجه</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/%D9%85%D9%82%D8%AF%D9%85%D9%87_%D9%81%D9%8A_%D8%A7%D9%84%D8%A8%D8%B1%D9%85%D8%AC%D9%87&amp;diff=47527"/>
		<updated>2016-05-15T15:18:14Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p align=&amp;quot;right&amp;quot;&amp;gt;  &lt;br /&gt;
السكربتات جزء أساسي في تشغيل MTA فتستطيع بإستخدامهم إنشاء تطبيقات لتحسين اللعب ، تختلف أنواع السكربتات فمنها خريطة أو وضع للعب &amp;quot; freeroam , race , deathmatch &amp;quot; وغيرها ..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
برمجة السكربتات تعتمد على لغة البرمجة (Lua) [www.lua.org] .&lt;br /&gt;
&lt;br /&gt;
لغة البرمجة تعتمد إعتماداً كلياً على اللغة الإنجليزية , فيجب أن تكون لديك خلفية في اللغة الإنجليزية قبل المتابعة.&lt;br /&gt;
&lt;br /&gt;
لبرمجة سكربت ما تحتاج لمحرر .. ويفضل إستخدام محرر إحترافي لكي يسهل عليك البرمجة مثل :&lt;br /&gt;
*Notepad++ [http://notepad-plus-plus.org/download]&lt;br /&gt;
*Lua Edit [http://luaedit.sourceforge.net/ LuaEdit]&lt;br /&gt;
&lt;br /&gt;
لكن يفضل إستخدام برنامج MTASE فهو يسهل عملية إنشاء السكربتات وبرمجتها :&lt;br /&gt;
* [[MTASE|MTA Script Editor]].'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==إنشاء سكربت ==&lt;br /&gt;
&lt;br /&gt;
سوف نتعلم كيف نقوم بإنشاء سكربت يدخل اللاعب إلى اللعبة .. خطوة بحطوة&lt;br /&gt;
&lt;br /&gt;
اولا لا بد من معرفة انواع ملفات السكربت    &lt;br /&gt;
                                                                                                          &lt;br /&gt;
1-Meta.xml -- يقوم هذا الملف بتعرف الملفات الموجود في السكربت للسيرفر               &lt;br /&gt;
                                                                                          &lt;br /&gt;
2-Client -- يقوم هذا الملف بتشغيل جميع أوامر المتعلقة بالاعب فقط                                       &lt;br /&gt;
&lt;br /&gt;
3-Server -- يقوم هذا الملف بتشغيل جميع الاوامر سواء كانت للسيرفر او الاعب&lt;br /&gt;
&lt;br /&gt;
===أين مسار كل البرامج النصية (السكريبتات أو المودات)؟===&lt;br /&gt;
الان نتعرف على مجلد المودات أو السكربتات.&lt;br /&gt;
اذهب إلى مجلد Multi Theft Auto واتبع المسار التالي:&lt;br /&gt;
&lt;br /&gt;
	/Your MTA Server/mods/deathmatch/resources/&lt;br /&gt;
&lt;br /&gt;
. أو مجلد عادي zip سترى الكثير من الملفات. ربما ترى مجلدات صيغتها , MTA .. وجميعها يقبله الـ&lt;br /&gt;
&lt;br /&gt;
وهو الذي سنستخدمه بالبرنامج التعليمي &amp;quot;myserver&amp;quot; ولإنشاء المودات الخاصة بك: قم بعمل مجلد جديد واجعل اسمه كما تريد فمثلاً قم بتسميته &lt;br /&gt;
&lt;br /&gt;
والان يجب أن يكون مسار المجلد الذي قمت بعمله هذا:&lt;br /&gt;
&lt;br /&gt;
	/Your MTA Server/mods/deathmatch/resources/myserver/&lt;br /&gt;
&lt;br /&gt;
* myserver: اسم المجلد الذي قمت بتسميته&lt;br /&gt;
&lt;br /&gt;
=== meta.xml تعريف السكربت اضافة ملف===&lt;br /&gt;
حتى يستطيع السيرفر من معرفة المودات, يجب علينا إنشاء ملف meta.xml &lt;br /&gt;
&lt;br /&gt;
&amp;quot; ويكون بداخل مجلد السكربت الذي قمنا بإنشائه وهو &amp;quot;myserver&amp;quot; &lt;br /&gt;
&lt;br /&gt;
ولإنشاء ملف meta.xml :&lt;br /&gt;
&lt;br /&gt;
وافتحه باستخدام المفكرة =) meta.xml أفتح ملف نصي جديد وقم بتسميته&lt;br /&gt;
&lt;br /&gt;
ولا تنسى ان يكون بداخل مجلد السكربت .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
أدخل الكود التالي في ملف ''meta.xml'':&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
     &amp;lt;info author=&amp;quot;إسمك&amp;quot; type=&amp;quot;gamemode&amp;quot; name=&amp;quot;إسم السكربت&amp;quot; description=&amp;quot;وصف بسيط للسكربت&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;script src=&amp;quot;script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
هنا يتم تعريف أجزاء السكربت فمثلاً :&lt;br /&gt;
* &amp;lt;info ..&amp;gt;&lt;br /&gt;
تضع فيه بيانات السكربت .. مثل الإسم والنوع والوصف&lt;br /&gt;
* type=&amp;quot;gamemode&amp;quot;&lt;br /&gt;
تعني أن نوع السكربت هو مود لعب وتوجد أنواع عديدة مثل :&lt;br /&gt;
**gamemode&lt;br /&gt;
**map&lt;br /&gt;
**script&lt;br /&gt;
&lt;br /&gt;
===إنشاء ملف السكربت Lua===&lt;br /&gt;
قمنا بوضع هذا السطر في :&lt;br /&gt;
*meta.xml&lt;br /&gt;
:&lt;br /&gt;
		&amp;lt;script src=&amp;quot;script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
الآن نقوم بإنشاء ملف نصي بنفس الإسم&lt;br /&gt;
**script.lua&lt;br /&gt;
بإستخدام برنامج التحرير لديك .. نقوم بإنشاء الكود&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function joinHandler() -- الوظيفة .. وبعدها نقوم بكتابة الإسم&lt;br /&gt;
	local x = 1959.55 -- تعريف x&lt;br /&gt;
	local y = -1714.46 -- تعريف y&lt;br /&gt;
	local z = 10 -- تعريف z&lt;br /&gt;
	spawnPlayer(source, x, y, z) -- نقوم بإستخدام هذه الوظيفة لإنتاج اللاعب ونقوم بتحديد اللاعب وهو المصدر : source&lt;br /&gt;
	fadeCamera(source, true) -- نقوم بعمل fade للكاميرا&lt;br /&gt;
	setCameraTarget(source, source) -- نجعل هدف الكاميرا هو اللاعب &lt;br /&gt;
	outputChatBox(&amp;quot;مرحباً بك في السيرفر&amp;quot;, source) -- نقوم بإخراج نص في الدردشة&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, getRootElement(), joinHandler) -- نقوم بإضافة المعالج حيث سيتم تشغيله بعد الحدث المحدد وهو عند دخول اللا&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
وصف وشرح الكود اعلاه : &lt;br /&gt;
	سيقوم السكربت بوضع اللاعب في الاحداثيات (x,y,z) المحدده اعلاه, عند دخوله الى السيرفر&lt;br /&gt;
	لاحظ انه يجب استخدام  وظيفة [ ''fadeCamera'' ] ستكون الشاشة سوداء وأيضاً يجب تعيين الكاميرا ( setTargetCamera ) ..&lt;br /&gt;
&lt;br /&gt;
نرى أن '''source''' هو المصدر وهو اللاعب الذي يقوم بالدخول &lt;br /&gt;
&lt;br /&gt;
*[[addEventHandler]] - الاحداث وهي ما يجب فعله من قبل المستخدم او السيرفر&lt;br /&gt;
*[[function]] - وظيفة تعمل عند حدث من الاحداث وتحتوي على امر او أوامر&lt;br /&gt;
أيضاً لو رأينا في المعالج &lt;br /&gt;
*[[addEventHandler]] - إضافة معالج للحدث&lt;br /&gt;
نرى 3 أشياء&lt;br /&gt;
*: onPlayerJoin - عند دخول اللاعب&lt;br /&gt;
وهو الحدث .. حيث يحدد متى يتم تشغيل المعالج - في هذه الحالة عند دخول اللاعب&lt;br /&gt;
*getRootElement() - جلب العنصر الحالي&lt;br /&gt;
هذا يقوم بتعيين العنصر الذي يقوم بتشغيل الحدث &lt;br /&gt;
*joinHandler &lt;br /&gt;
وهو إسم الوظيفة التي قمنا بصناعتها &lt;br /&gt;
&lt;br /&gt;
يمكنك التوسع أكثر في : [[addEventHandler]]&lt;br /&gt;
&lt;br /&gt;
===تشغيل السكربت===&lt;br /&gt;
بعد أن تقوم بحفظ أجزاء السكربت في ملف واحد ويمكن حفظه في الملفات التالية :&lt;br /&gt;
* مجلد&lt;br /&gt;
* أرشيف .zip&lt;br /&gt;
ونقوم بنسخه إلى مجلد السكربتات داخل سيرفرك ونقوم بتشغيله بالطريقة العادية.&lt;br /&gt;
&lt;br /&gt;
الآن إنتهينا من صنع السكربت .. بعد هذا سنقوم بصنع سكربت مع أمر &lt;br /&gt;
* command&lt;br /&gt;
يمكنك المتابعة أو الذهاب إلى دورة صناعة النوافذ&lt;br /&gt;
*[[Introduction to Scripting GUI]]&lt;br /&gt;
&lt;br /&gt;
===إنشاء سكربت بطريقة مفصلة===&lt;br /&gt;
&lt;br /&gt;
==صناعة أمر بسيط==&lt;br /&gt;
لنعد الآن إلى ملف&lt;br /&gt;
*script.lua&lt;br /&gt;
ونقوم بتعديله قليلاً لإنشاء أمر بسيط يقوم بإنشاء سيارة بجانب اللاعب&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- في البداية نقوم بكتب وظيفة إنشاء السيارة&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
   -- هنا نقوم بكتابة وظيفة إنشاء السيارة كـ&lt;br /&gt;
   -- createVehicle&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- نقوم بإضافة الأمر&lt;br /&gt;
addCommandHandler(&amp;quot;createvehicle&amp;quot;, createVehicleForPlayer) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
''ملاحظة: يمكنك الضغط على الوظائف والتعمق فيها بداخل الويكي.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== الوظيفة ==&lt;br /&gt;
الوظيفة هي شيء يسمى&lt;br /&gt;
&lt;br /&gt;
function&lt;br /&gt;
&lt;br /&gt;
الوظيفة هي الشيء التي يتكون عليها الحدث&lt;br /&gt;
&lt;br /&gt;
يمكنك ان تسمي الوظيفة كما شئت ويمكنك أيضاً عدم وضع اسم للوظيفة&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''مثال لـ وظيفة لها إسم'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function arabs( ) -- الوظيفة&lt;br /&gt;
    outputChatBox(&amp;quot;مرحباً بك&amp;quot;) --s  ستلاحظ بـ أن كلمة &amp;quot; مرحباً بك &amp;quot; ظهرت في الشات عند دخول الاعب &lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, root, arabs) -- .الحدث مع اسم الوظيفة&lt;br /&gt;
-- root = getRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''مثال لـ وظيفة ليس لها إسم'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerWasted&amp;quot;, root,&lt;br /&gt;
function(_,killer)&lt;br /&gt;
    outputChatBox( killer .. &amp;quot; من قبل&amp;quot; .. getPlayerName(source) .. &amp;quot; لقد قُتل الاعب&amp;quot; )&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
كما تلاحظ ووضع قوس قريباً من&lt;br /&gt;
&lt;br /&gt;
end)&lt;br /&gt;
&lt;br /&gt;
هذا القوس يكمل القوس الآخر كما نلاحظ في الحدث &lt;br /&gt;
&lt;br /&gt;
addEventHandler(&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== الحدث ==&lt;br /&gt;
الحدث هو شيء يسمى&lt;br /&gt;
&lt;br /&gt;
event&lt;br /&gt;
&lt;br /&gt;
الحدث هو الذي يتكون على بناء الوظيفة&lt;br /&gt;
فـ اذا رجعنا الى الامثلة التي في الاعلى سوف نرى عدة احداث ومنها&lt;br /&gt;
&lt;br /&gt;
[[onPlayerWasted]]&lt;br /&gt;
&lt;br /&gt;
الحدث ببساطة يحدد متى سوف تحدث او كيف سوف تحدث الوظائف التي ادخلتها&lt;br /&gt;
&lt;br /&gt;
onPlayerWasted&lt;br /&gt;
&lt;br /&gt;
عند موت الاعب&lt;br /&gt;
&lt;br /&gt;
'''مثال للحدث'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onJoin()&lt;br /&gt;
    x, y, z = getElementPosition(source) -- s يآتي بمكان الاعب x, y, z&lt;br /&gt;
	    local theVehicle = createVehicle(445, x, y, z) -- s السيارة التي سـ تصنع بمكان الاعب الذي تم تحديده مسبقاً&lt;br /&gt;
		    warpPedIntoVehicle(source, theVehicle) -- s يجعل الاعب داخل السيارة&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, root, onJoin) -- s الحدث&lt;br /&gt;
-- root = getRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
هذه الوظيفة مع هذا الحدث سوف يعطون الاعب سيارة عند دخوله السيرفر&lt;br /&gt;
&lt;br /&gt;
ملاحظة الحدث ليس دائم على الوظيفة فـ أيصاً يمكنك تكوين هذه الوظيفة على حدث آخر&lt;br /&gt;
&lt;br /&gt;
'''مثال'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onJoin()&lt;br /&gt;
    x, y, z = getElementPosition(source)&lt;br /&gt;
	    local theVehicle = createVehicle(445, x, y, z)&lt;br /&gt;
		    warpPedIntoVehicle(source, theVehicle)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerLogin&amp;quot;, root, onJoin)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
هذا سوف يعطي الاعب سيارة لاكن ليس عند دخوله السيرفر , إنما عند دخوله حسابه&lt;br /&gt;
&lt;br /&gt;
'''Edit'''&lt;br /&gt;
&lt;br /&gt;
مثال آخر&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onVehicleExplode&amp;quot;,root, -- نضيف حدث عند إنفجار اي سيارة&lt;br /&gt;
    function() -- الوظيفة&lt;br /&gt;
        setTimer(destroyElement,5000,1,source) -- يخفي السيارة بعد 5 ثواني من انفاجرها &lt;br /&gt;
    end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
يمكنك ان تجد&lt;br /&gt;
الاحداث&lt;br /&gt;
والوظائف &lt;br /&gt;
كلنت وسيرفر&lt;br /&gt;
هنا&lt;br /&gt;
&lt;br /&gt;
كلنت:&lt;br /&gt;
&lt;br /&gt;
'''وظائف كلنت'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Client_Scripting_Functions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''احداث كلنت'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Client_Scripting_Events&lt;br /&gt;
&lt;br /&gt;
سيرفر:&lt;br /&gt;
&lt;br /&gt;
'''وظائف سيرفر'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Server_Scripting_Functions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''احداث سيرفر'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Server_Scripting_Events&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== String الـ ==&lt;br /&gt;
السترنج هو شيء يوجد في بعض الوظايف التي توجد داخل الام تي اي&lt;br /&gt;
&lt;br /&gt;
مثلاً&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onResourceStart&amp;quot;,resourceRoot, -- الايفنت هنا يجب ان تكون بين سترنق كما الموضح هنا&lt;br /&gt;
    function()&lt;br /&gt;
        outputChatBox(&amp;quot;تم بدء السكربت&amp;quot;) -- s هنا سوف يظهر رسالة بالشات &amp;quot; تم بدء السكربت &amp;quot; عند بدء السكربت ويجب ان تكون سترنق&lt;br /&gt;
    end&lt;br /&gt;
) -- نهاية قوس الحدث&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
السترنق له عدة أشكال , فيمكن ان يكون كالآتي&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
أو&lt;br /&gt;
&lt;br /&gt;
' '&lt;br /&gt;
&lt;br /&gt;
أو&lt;br /&gt;
&lt;br /&gt;
[[]]&lt;br /&gt;
&lt;br /&gt;
فمثلاً اذا نريد ان نخرج رسالة بعلبة الشات&lt;br /&gt;
&lt;br /&gt;
يمكن ان تكون كذلك &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
outputChatBox([[مرحباً]])&lt;br /&gt;
&lt;br /&gt;
-- أو كذلك&lt;br /&gt;
outputChatBox('مرحباً')&lt;br /&gt;
&lt;br /&gt;
-- أو كذلك&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;مرحباً&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Command handlerعن الـ====&lt;br /&gt;
.(`) أو زر F8 التي يمكن للاعب ان يعرضها باستخدام زر Consoleهو اسم الامر الذي يمكن للاعب ان يدخله في الـ [[addCommandHandler]] في argument أول&lt;br /&gt;
&lt;br /&gt;
.&amp;quot;createVehicleForPlayer&amp;quot;هي وظيفة تُنفذ عند كتابة اللاعب الامر في هذه الحالة لـ [[addCommandHandler]] في argument ثاني&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:اذا كنت متمرس في البرمجة, ستعرف انك ستحتاج ان تنفذ وظيفة مثل&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
functionName(argument1, argument2, argument3, ..)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
functionName(thePlayer, commandName, argument3, ..)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If we have a closer look on the lower example above, we can see argument1 is thePlayer and argument2 the commandName. thePlayer is simply the one who typed the command, so whatever you call it, the variable will contain the player who activated the command. commandName is simply the command they typed. So if they typed &amp;quot;/greet&amp;quot;, this argument will contain &amp;quot;greet&amp;quot;. Argument 3 is something extra the player typed, you'll learn it a little bit further in the tutorial. Never forget that the first 2 arguments are standard arguments, but you can name them to anything you want.&lt;br /&gt;
&lt;br /&gt;
We called the [[addCommandHandler]] function this way already and since ''createVehicleForPlayer'' is a function too, it can be called that way as well. But we are using a command handler for that, which calls it in a similiar manner, internally.&lt;br /&gt;
&lt;br /&gt;
For example: Someone types &amp;quot;createvehicle 468&amp;quot; ingame in the console to spawn a Sanchez, the command handler calls the createVehicleForPlayer function, as '''if''' we would have this line of code in the script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
createVehicleForPlayer(thePlayer,&amp;quot;createvehicle&amp;quot;,&amp;quot;468&amp;quot;) -- thePlayer هو الشيء الي كتب الكومند&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
As we can see, it provides several parameters: the player who called the command, the command he entered and whatever text he had after that, in this case &amp;quot;468&amp;quot; as vehicle id for the Sanchez. The first two parameters are the same with all command handlers, which you can read on the [[addEventHandler]] page. For this fact, you always have to define at least those two parameters to use any after that (for example to process text that was entered after the command, like in our example the vehicle model id).&lt;br /&gt;
&lt;br /&gt;
''Note: You have to add the command handler AFTER you defined the handler function, else it can't find it. The order of execution matters.''&lt;br /&gt;
&lt;br /&gt;
====Writing the function====&lt;br /&gt;
In order to fill the function we created, we need to think about what we have to do:&lt;br /&gt;
* Get the players position, so we know where to spawn the vehicle (we want it to appear right beside the player)&lt;br /&gt;
* Calculate the position we want to spawn the vehicle at (we don't want it to appear in the player)&lt;br /&gt;
* Spawn the vehicle&lt;br /&gt;
* Check if it has been spawned successfully, or output a message&lt;br /&gt;
&lt;br /&gt;
In order to achieve our goals, we have to use several functions. To find function we need to use, we should visit the [[Scripting Functions|Server Functions List]]. First we need a function to get the players position. Since players are Elements, we first jump to the '''Element functions''' where we find the [[getElementPosition]] function. By clicking on the function name in the list, you get to the function description. There we can see the syntax, what it returns and usually an example. The syntax shows us what arguments we can or have to submit.&lt;br /&gt;
&lt;br /&gt;
For [[getElementPosition]], the syntax is:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float, float, float getElementPosition ( element theElement )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three ''float'' in front of the function name are the return type. In this case it means the function returns three floating point numbers. (x, y and z) Within the parentheses, you can see what arguments you have to submit. In this case only the element whose position you want to get, which is the player in our example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	-- نأتي باحداثيات المكان الي نبغي نضع فيه السيارة بشكل x, y, z&lt;br /&gt;
	-- (local  تعني ان هاد الاختصار ما رح يشغل غير في هاد الفنكشن)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we want to ensure that the vehicle won't spawn directly in the player, so we add a few units to the ''x'' variable, which will make it spawn east from the player.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) -- نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- add 5 units to the x position&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we need another function, one to spawn a vehicle. We once again search for it on the [[Scripting Functions|Server Functions List]], this time - since we are talking about vehicles - in the '''Vehicle functions''' section, where we will choose [[createVehicle]]. In this function's syntax, we only have one return type (which is more common), a vehicle element that points to the vehicle we just created. Also, we see that some arguments are enclosed within [ ] which means that those are optional.&lt;br /&gt;
&lt;br /&gt;
We already have all arguments we need for [[createVehicle]] in our function: The position we just calculated in the ''x,y,z'' variables and the model id that we provided through the command (&amp;quot;createvehicle 468&amp;quot;) and can access in the function as ''vehicleModel'' variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) --  نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- add 5 units to the x position&lt;br /&gt;
	-- create the vehicle and store the returned vehicle element in the ''createdVehicle'' variable&lt;br /&gt;
	local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course this code can be improved in many ways, but at least we want to add a check whether the vehicle was created successfully or not. As we can read on the [[createVehicle]] page under '''Returns''', the function returns ''false'' when it was unable to create the vehicle. Thus, we check the value of the ''createVehicle'' variable.&lt;br /&gt;
&lt;br /&gt;
Now we have our complete script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) --  نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- نضيف 5 وحد ل الاحداثيات X&lt;br /&gt;
	local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z)&lt;br /&gt;
	-- نشوف لو السيارة اتعملت ام لا&lt;br /&gt;
	if (createdVehicle == false) then&lt;br /&gt;
		-- لو السياره اتعملت يبقي نعمل رسالة,لكن للاعب فقط&lt;br /&gt;
		outputChatBox(&amp;quot;Failed to create vehicle.&amp;quot;,thePlayer)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;createvehicle&amp;quot;, createVehicleForPlayer)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, we introduced another function with [[outputChatBox]]. By now, you should be able to explore the function's documentation page yourself. For more advanced scripting, please check out the [[Map manager|Map Manager]].&lt;br /&gt;
&lt;br /&gt;
==What you need to know==&lt;br /&gt;
You already read some things about resources, command handlers and finding functions in the documentation in the first paragraph, but there is much more to learn. This section will give you a rather short overview over some of these things, while linking to related pages if possible.&lt;br /&gt;
===Clientside and Serverside scripts===&lt;br /&gt;
You may have already noticed these or similiar terms (Server/Client) somewhere on this wiki, mostly in conjunction with functions. MTA not only supports scripts that run on the server and provide commands (like the one we wrote above) or other features, but also scripts that run on the MTA client the players use to connect to the server. The reason for this is, that some features MTA provides have to be clientside (like a GUI - Graphical User Interface), others should be because they work better and still others are better off to be serverside or just don't work clientside.&lt;br /&gt;
&lt;br /&gt;
Most scripts you will make (gamemodes, maps) will probably be serverside, like the one we wrote in the first section. If you run into something that can't be solved serverside, you will probably have to make it clientside. For a clientside script for example, you would create a ordinary script file (for example called ''client.lua'') and specify it in the meta.xml, like this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;client.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The ''type'' attribute defaults to 'server', so you only need to specify it for clientside scripts. When you do this, the clientside script will be downloaded to the player's computer once he connects to the server. Read more about [[Client side scripts]].&lt;br /&gt;
&lt;br /&gt;
===More complex resources===&lt;br /&gt;
The previous section showed briefly how to add clientside scripts to the resource, but there is also much more possible. As mentioned at the very top of this page, resources can be pretty much everything. Their purpose is defined by what they do. Let's have some theoretical resources, by looking at the files it contains, the ''meta.xml'' and what they might do:&lt;br /&gt;
&lt;br /&gt;
====First example - A utility script====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/admin_commands&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/commands.lua&lt;br /&gt;
	/client.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;admin commands&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;commands.lua&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;client.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''commands.lua'' provides some admin commands, like banning a player, muting or something else that can be used to admin the server&lt;br /&gt;
* The ''client.lua'' provides a GUI to be able to perform the mentioned actions easily&lt;br /&gt;
&lt;br /&gt;
This example might be running all the time (maybe even auto-started when the server starts) as it's useful during the whole gaming experience and also wont interfere with the gameplay, unless an admin decides to take some action of course.&lt;br /&gt;
&lt;br /&gt;
====Second example - A gamemode====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/counterstrike&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/counterstrike.lua&lt;br /&gt;
	/buymenu.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;Counterstrike remake&amp;quot; type=&amp;quot;gamemode&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;counterstrike.lua&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;buymenu.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''counterstrike.lua'' contains similiar to the following features:&lt;br /&gt;
** Let players choose their team and spawn them&lt;br /&gt;
** Provide them with weapons, targets and instructions (maybe read from a Map, see below)&lt;br /&gt;
** Define the game's rules, e.g. when does the round end, what happens when a player dies&lt;br /&gt;
** .. and maybe some more&lt;br /&gt;
* The ''buymenu.lua'' is a clientside script and creates a menu to buy weapons&lt;br /&gt;
&lt;br /&gt;
This example can be called a gamemode, since it not only intereferes with the gameplay, but actually defines the rules of it. The ''type'' attribute indicates that this example works with the [[Map manager]], yet another resource that was written by the QA Team to manage gamemodes and map loading. It is highly recommended that you base your gamemodes on the techniques it provides.&lt;br /&gt;
&lt;br /&gt;
This also means that the gamemode probably won't run without a map. Gamemodes should always be as generic as possible. An example for a map is stated in the next example.&lt;br /&gt;
&lt;br /&gt;
====Third example - A Map====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/cs-airport&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/airport.map&lt;br /&gt;
	/airport.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;Counterstrike airport map&amp;quot; type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;counterstrike&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;map src=&amp;quot;airport.map&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;airport.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''airport.map'' in a XML file that provides information about the map to the gamemode, these may include:&lt;br /&gt;
** Where the players should spawn, with what weapons, what teams there are&lt;br /&gt;
** What the targets are&lt;br /&gt;
** Weather, World Time, Timelimit&lt;br /&gt;
** Provide vehicles&lt;br /&gt;
* The ''airport.lua'' might contain map-specific features, that may include:&lt;br /&gt;
** Opening some door/make something explode when something specific happens&lt;br /&gt;
** Create or move some custom objects, or manipulate objects that are created through the .map file&lt;br /&gt;
** .. anything else map-specific you can think of&lt;br /&gt;
&lt;br /&gt;
As you can see, the ''type'' attribute changed to 'map', telling the [[Map manager]] that this resource is a map, while the ''gamemodes'' attribute tells it for which gamemodes this map is valid, in this case the gamemode from the above example.&lt;br /&gt;
What may come as a surprise is that there is also a script in the Map resource. Of course this is not necessarily needed in a map, but opens a wide range of possibilities for map makers to create their own world within the rules of the gamemode they create it for.&lt;br /&gt;
&lt;br /&gt;
The ''airport.map'' file might look similiar to this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map mode=&amp;quot;deathmatch&amp;quot; version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;terrorists&amp;gt;&lt;br /&gt;
		&amp;lt;spawnpoint posX=&amp;quot;2332.23&amp;quot; posY=&amp;quot;-12232.33&amp;quot; posZ=&amp;quot;4.42223&amp;quot; skins=&amp;quot;23-40&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/terrorists&amp;gt;&lt;br /&gt;
	&amp;lt;counterterrorists&amp;gt;&lt;br /&gt;
		&amp;lt;spawnpoint posX=&amp;quot;2334.23443&amp;quot; posY=&amp;quot;-12300.233&amp;quot; posZ=&amp;quot;10.2344&amp;quot; skins=&amp;quot;40-50&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/counterterrorists&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;bomb posX=&amp;quot;23342.23&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
	&amp;lt;vehicle posX=&amp;quot;&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; model=&amp;quot;602&amp;quot; /&amp;gt;	&lt;br /&gt;
	&amp;lt;vehicle posX=&amp;quot;&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; model=&amp;quot;603&amp;quot; /&amp;gt;	&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When a gamemode is started with a map, the map resources is automatically started by the mapmanager and the information it contains can be read by the gamemode resource. When the map changes, the current map resource is stopped and the next map resource is started. For a more in-depth explanation and examples of how map resources are utilized in the main script, please visit the [[Writing Gamemodes]] page.&lt;br /&gt;
&lt;br /&gt;
===Events===&lt;br /&gt;
Events are the way MTA tells scripts about things that happen. For example when a player dies, the [[onPlayerWasted]] event is triggered. In order to perform any actions when a player dies, you have to prepare yourself similiar to adding a command handler, as shown in [[#Writing_the_script|the first chapter]].&lt;br /&gt;
&lt;br /&gt;
This example will output a message with the name of the player who died:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function playerDied(totalAmmo, killer, killerWeapon, bodypart)&lt;br /&gt;
	outputChatBox(getPlayerName(source)..&amp;quot; died!&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerWasted&amp;quot;,getRootElement(),playerDied)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead of showing what arguments are needed, the documentation page for Events shows what parameters are passed to the handler function, similiar to the way a [[#About_command_handlers|command handler]] does, just that it is different from event to event. Another important point is the ''source'' variable, that exists in handler functions. It doesn't have to be added to the parameter list of the function, but it still exists. It has a different value from event to event, for player events (as in the example above) it is the player element. As another example, you can take a look at the basic spawning player script in the first section to get an idea how ''source'' is used.&lt;br /&gt;
&lt;br /&gt;
==Where to go from here==&lt;br /&gt;
You should now be familiar with the most basic aspects of MTA scripting and also a bit with the documentation. The [[Main Page]] provides you with links to more information, Tutorials and References that allow a deeper look into the topics you desire to learn about.&lt;br /&gt;
&lt;br /&gt;
From here we recommend reading the [[debugging]] tutorial. Good debugging skills are an absolute necessity when you are making scripts.&lt;br /&gt;
&lt;br /&gt;
[[ru:Scripting Introduction]]&lt;br /&gt;
[[it:Introduzione allo scripting]]&lt;br /&gt;
[[es:Introducción a la Programación]]&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/%D9%85%D9%82%D8%AF%D9%85%D9%87_%D9%81%D9%8A_%D8%A7%D9%84%D8%A8%D8%B1%D9%85%D8%AC%D9%87&amp;diff=47526</id>
		<title>AR/مقدمه في البرمجه</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/%D9%85%D9%82%D8%AF%D9%85%D9%87_%D9%81%D9%8A_%D8%A7%D9%84%D8%A8%D8%B1%D9%85%D8%AC%D9%87&amp;diff=47526"/>
		<updated>2016-05-15T15:15:48Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p align=&amp;quot;right&amp;quot;&amp;gt;  &lt;br /&gt;
السكربتات جزء أساسي في تشغيل MTA فتستطيع بإستخدامهم إنشاء تطبيقات لتحسين اللعب ، تختلف أنواع السكربتات فمنها خريطة أو وضع للعب &amp;quot; freeroam , race , deathmatch &amp;quot; وغيرها ..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
برمجة السكربتات تعتمد على لغة البرمجة (Lua) [www.lua.org] .&lt;br /&gt;
&lt;br /&gt;
لغة البرمجة تعتمد إعتماداً كلياً على اللغة الإنجليزية , فيجب أن تكون لديك خلفية في اللغة الإنجليزية قبل المتابعة.&lt;br /&gt;
&lt;br /&gt;
لبرمجة سكربت ما تحتاج لمحرر .. ويفضل إستخدام محرر إحترافي لكي يسهل عليك البرمجة مثل :&lt;br /&gt;
*Notepad++ [http://notepad-plus-plus.org/download]&lt;br /&gt;
*Lua Edit [http://luaedit.sourceforge.net/ LuaEdit]&lt;br /&gt;
&lt;br /&gt;
لكن يفضل إستخدام برنامج MTASE فهو يسهل عملية إنشاء السكربتات وبرمجتها :&lt;br /&gt;
* [[MTASE|MTA Script Editor]].'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==إنشاء سكربت ==&lt;br /&gt;
&lt;br /&gt;
سوف نتعلم كيف نقوم بإنشاء سكربت يدخل اللاعب إلى اللعبة .. خطوة بحطوة&lt;br /&gt;
&lt;br /&gt;
اولا لا بد من معرفة انواع ملفات السكربت    &lt;br /&gt;
                                                                                                          &lt;br /&gt;
1-Meta.xml -- يقوم هذا الملف بتعرف الملفات الموجود في السكربت للسيرفر               &lt;br /&gt;
                                                                                          &lt;br /&gt;
2-Client -- يقوم هذا الملف بتشغيل جميع أوامر المتعلقة بالاعب فقط                                       &lt;br /&gt;
&lt;br /&gt;
3-Server -- يقوم هذا الملف بتشغيل جميع الاوامر سواء كانت للسيرفر او الاعب&lt;br /&gt;
&lt;br /&gt;
===أين مسار كل البرامج النصية (السكريبتات أو المودات)؟===&lt;br /&gt;
الان نتعرف على مجلد المودات أو السكربتات.&lt;br /&gt;
اذهب إلى مجلد Multi Theft Auto واتبع المسار التالي:&lt;br /&gt;
&lt;br /&gt;
	/Your MTA Server/mods/deathmatch/resources/&lt;br /&gt;
&lt;br /&gt;
. أو مجلد عادي zip سترى الكثير من الملفات. ربما ترى مجلدات صيغتها , MTA .. وجميعها يقبله الـ&lt;br /&gt;
&lt;br /&gt;
وهو الذي سنستخدمه بالبرنامج التعليمي &amp;quot;myserver&amp;quot; ولإنشاء المودات الخاصة بك: قم بعمل مجلد جديد واجعل اسمه كما تريد فمثلاً قم بتسميته &lt;br /&gt;
&lt;br /&gt;
والان يجب أن يكون مسار المجلد الذي قمت بعمله هذا:&lt;br /&gt;
&lt;br /&gt;
	/Your MTA Server/mods/deathmatch/resources/myserver/&lt;br /&gt;
&lt;br /&gt;
* myserver: اسم المجلد الذي قمت بتسميته&lt;br /&gt;
&lt;br /&gt;
===تعريف السكربت (إضافة ملف meta.xml)===&lt;br /&gt;
حتى يستطيع السيرفر من معرفة المودات, يجب علينا إنشاء ملف meta.xml &lt;br /&gt;
&amp;quot; ويكون بداخل مجلد السكربت الذي قمنا بإنشائه وهو &amp;quot;myserver&amp;quot; &lt;br /&gt;
ولإنشاء ملف meta.xml : أفتح ملف نصي جديد وقم بتسميته meta.xml وافتحه باستخدام المفكرة =)&lt;br /&gt;
ولا تنسى ان يكون بداخل مجلد السكربت .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
أدخل الكود التالي في ملف ''meta.xml'':&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
     &amp;lt;info author=&amp;quot;إسمك&amp;quot; type=&amp;quot;gamemode&amp;quot; name=&amp;quot;إسم السكربت&amp;quot; description=&amp;quot;وصف بسيط للسكربت&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;script src=&amp;quot;script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
هنا يتم تعريف أجزاء السكربت فمثلاً :&lt;br /&gt;
* &amp;lt;info ..&amp;gt;&lt;br /&gt;
تضع فيه بيانات السكربت .. مثل الإسم والنوع والوصف&lt;br /&gt;
* type=&amp;quot;gamemode&amp;quot;&lt;br /&gt;
تعني أن نوع السكربت هو مود لعب وتوجد أنواع عديدة مثل :&lt;br /&gt;
**gamemode&lt;br /&gt;
**map&lt;br /&gt;
**script&lt;br /&gt;
&lt;br /&gt;
===إنشاء ملف السكربت Lua===&lt;br /&gt;
قمنا بوضع هذا السطر في :&lt;br /&gt;
*meta.xml&lt;br /&gt;
:&lt;br /&gt;
		&amp;lt;script src=&amp;quot;script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
الآن نقوم بإنشاء ملف نصي بنفس الإسم&lt;br /&gt;
**script.lua&lt;br /&gt;
بإستخدام برنامج التحرير لديك .. نقوم بإنشاء الكود&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function joinHandler() -- الوظيفة .. وبعدها نقوم بكتابة الإسم&lt;br /&gt;
	local x = 1959.55 -- تعريف x&lt;br /&gt;
	local y = -1714.46 -- تعريف y&lt;br /&gt;
	local z = 10 -- تعريف z&lt;br /&gt;
	spawnPlayer(source, x, y, z) -- نقوم بإستخدام هذه الوظيفة لإنتاج اللاعب ونقوم بتحديد اللاعب وهو المصدر : source&lt;br /&gt;
	fadeCamera(source, true) -- نقوم بعمل fade للكاميرا&lt;br /&gt;
	setCameraTarget(source, source) -- نجعل هدف الكاميرا هو اللاعب &lt;br /&gt;
	outputChatBox(&amp;quot;مرحباً بك في السيرفر&amp;quot;, source) -- نقوم بإخراج نص في الدردشة&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, getRootElement(), joinHandler) -- نقوم بإضافة المعالج حيث سيتم تشغيله بعد الحدث المحدد وهو عند دخول اللا&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
وصف وشرح الكود اعلاه : &lt;br /&gt;
	سيقوم السكربت بوضع اللاعب في الاحداثيات (x,y,z) المحدده اعلاه, عند دخوله الى السيرفر&lt;br /&gt;
	لاحظ انه يجب استخدام  وظيفة [ ''fadeCamera'' ] ستكون الشاشة سوداء وأيضاً يجب تعيين الكاميرا ( setTargetCamera ) ..&lt;br /&gt;
&lt;br /&gt;
نرى أن '''source''' هو المصدر وهو اللاعب الذي يقوم بالدخول &lt;br /&gt;
&lt;br /&gt;
*[[addEventHandler]] - الاحداث وهي ما يجب فعله من قبل المستخدم او السيرفر&lt;br /&gt;
*[[function]] - وظيفة تعمل عند حدث من الاحداث وتحتوي على امر او أوامر&lt;br /&gt;
أيضاً لو رأينا في المعالج &lt;br /&gt;
*[[addEventHandler]] - إضافة معالج للحدث&lt;br /&gt;
نرى 3 أشياء&lt;br /&gt;
*: onPlayerJoin - عند دخول اللاعب&lt;br /&gt;
وهو الحدث .. حيث يحدد متى يتم تشغيل المعالج - في هذه الحالة عند دخول اللاعب&lt;br /&gt;
*getRootElement() - جلب العنصر الحالي&lt;br /&gt;
هذا يقوم بتعيين العنصر الذي يقوم بتشغيل الحدث &lt;br /&gt;
*joinHandler &lt;br /&gt;
وهو إسم الوظيفة التي قمنا بصناعتها &lt;br /&gt;
&lt;br /&gt;
يمكنك التوسع أكثر في : [[addEventHandler]]&lt;br /&gt;
&lt;br /&gt;
===تشغيل السكربت===&lt;br /&gt;
بعد أن تقوم بحفظ أجزاء السكربت في ملف واحد ويمكن حفظه في الملفات التالية :&lt;br /&gt;
* مجلد&lt;br /&gt;
* أرشيف .zip&lt;br /&gt;
ونقوم بنسخه إلى مجلد السكربتات داخل سيرفرك ونقوم بتشغيله بالطريقة العادية.&lt;br /&gt;
&lt;br /&gt;
الآن إنتهينا من صنع السكربت .. بعد هذا سنقوم بصنع سكربت مع أمر &lt;br /&gt;
* command&lt;br /&gt;
يمكنك المتابعة أو الذهاب إلى دورة صناعة النوافذ&lt;br /&gt;
*[[Introduction to Scripting GUI]]&lt;br /&gt;
&lt;br /&gt;
===إنشاء سكربت بطريقة مفصلة===&lt;br /&gt;
&lt;br /&gt;
==صناعة أمر بسيط==&lt;br /&gt;
لنعد الآن إلى ملف&lt;br /&gt;
*script.lua&lt;br /&gt;
ونقوم بتعديله قليلاً لإنشاء أمر بسيط يقوم بإنشاء سيارة بجانب اللاعب&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- في البداية نقوم بكتب وظيفة إنشاء السيارة&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
   -- هنا نقوم بكتابة وظيفة إنشاء السيارة كـ&lt;br /&gt;
   -- createVehicle&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- نقوم بإضافة الأمر&lt;br /&gt;
addCommandHandler(&amp;quot;createvehicle&amp;quot;, createVehicleForPlayer) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
''ملاحظة: يمكنك الضغط على الوظائف والتعمق فيها بداخل الويكي.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== الوظيفة ==&lt;br /&gt;
الوظيفة هي شيء يسمى&lt;br /&gt;
&lt;br /&gt;
function&lt;br /&gt;
&lt;br /&gt;
الوظيفة هي الشيء التي يتكون عليها الحدث&lt;br /&gt;
&lt;br /&gt;
يمكنك ان تسمي الوظيفة كما شئت ويمكنك أيضاً عدم وضع اسم للوظيفة&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''مثال لـ وظيفة لها إسم'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function arabs( ) -- الوظيفة&lt;br /&gt;
    outputChatBox(&amp;quot;مرحباً بك&amp;quot;) --s  ستلاحظ بـ أن كلمة &amp;quot; مرحباً بك &amp;quot; ظهرت في الشات عند دخول الاعب &lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, root, arabs) -- .الحدث مع اسم الوظيفة&lt;br /&gt;
-- root = getRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''مثال لـ وظيفة ليس لها إسم'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerWasted&amp;quot;, root,&lt;br /&gt;
function(_,killer)&lt;br /&gt;
    outputChatBox( killer .. &amp;quot; من قبل&amp;quot; .. getPlayerName(source) .. &amp;quot; لقد قُتل الاعب&amp;quot; )&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
كما تلاحظ ووضع قوس قريباً من&lt;br /&gt;
&lt;br /&gt;
end)&lt;br /&gt;
&lt;br /&gt;
هذا القوس يكمل القوس الآخر كما نلاحظ في الحدث &lt;br /&gt;
&lt;br /&gt;
addEventHandler(&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== الحدث ==&lt;br /&gt;
الحدث هو شيء يسمى&lt;br /&gt;
&lt;br /&gt;
event&lt;br /&gt;
&lt;br /&gt;
الحدث هو الذي يتكون على بناء الوظيفة&lt;br /&gt;
فـ اذا رجعنا الى الامثلة التي في الاعلى سوف نرى عدة احداث ومنها&lt;br /&gt;
&lt;br /&gt;
[[onPlayerWasted]]&lt;br /&gt;
&lt;br /&gt;
الحدث ببساطة يحدد متى سوف تحدث او كيف سوف تحدث الوظائف التي ادخلتها&lt;br /&gt;
&lt;br /&gt;
onPlayerWasted&lt;br /&gt;
&lt;br /&gt;
عند موت الاعب&lt;br /&gt;
&lt;br /&gt;
'''مثال للحدث'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onJoin()&lt;br /&gt;
    x, y, z = getElementPosition(source) -- s يآتي بمكان الاعب x, y, z&lt;br /&gt;
	    local theVehicle = createVehicle(445, x, y, z) -- s السيارة التي سـ تصنع بمكان الاعب الذي تم تحديده مسبقاً&lt;br /&gt;
		    warpPedIntoVehicle(source, theVehicle) -- s يجعل الاعب داخل السيارة&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, root, onJoin) -- s الحدث&lt;br /&gt;
-- root = getRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
هذه الوظيفة مع هذا الحدث سوف يعطون الاعب سيارة عند دخوله السيرفر&lt;br /&gt;
&lt;br /&gt;
ملاحظة الحدث ليس دائم على الوظيفة فـ أيصاً يمكنك تكوين هذه الوظيفة على حدث آخر&lt;br /&gt;
&lt;br /&gt;
'''مثال'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onJoin()&lt;br /&gt;
    x, y, z = getElementPosition(source)&lt;br /&gt;
	    local theVehicle = createVehicle(445, x, y, z)&lt;br /&gt;
		    warpPedIntoVehicle(source, theVehicle)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerLogin&amp;quot;, root, onJoin)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
هذا سوف يعطي الاعب سيارة لاكن ليس عند دخوله السيرفر , إنما عند دخوله حسابه&lt;br /&gt;
&lt;br /&gt;
'''Edit'''&lt;br /&gt;
&lt;br /&gt;
مثال آخر&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onVehicleExplode&amp;quot;,root, -- نضيف حدث عند إنفجار اي سيارة&lt;br /&gt;
    function() -- الوظيفة&lt;br /&gt;
        setTimer(destroyElement,5000,1,source) -- يخفي السيارة بعد 5 ثواني من انفاجرها &lt;br /&gt;
    end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
يمكنك ان تجد&lt;br /&gt;
الاحداث&lt;br /&gt;
والوظائف &lt;br /&gt;
كلنت وسيرفر&lt;br /&gt;
هنا&lt;br /&gt;
&lt;br /&gt;
كلنت:&lt;br /&gt;
&lt;br /&gt;
'''وظائف كلنت'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Client_Scripting_Functions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''احداث كلنت'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Client_Scripting_Events&lt;br /&gt;
&lt;br /&gt;
سيرفر:&lt;br /&gt;
&lt;br /&gt;
'''وظائف سيرفر'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Server_Scripting_Functions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''احداث سيرفر'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Server_Scripting_Events&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== String الـ ==&lt;br /&gt;
السترنج هو شيء يوجد في بعض الوظايف التي توجد داخل الام تي اي&lt;br /&gt;
&lt;br /&gt;
مثلاً&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onResourceStart&amp;quot;,resourceRoot, -- الايفنت هنا يجب ان تكون بين سترنق كما الموضح هنا&lt;br /&gt;
    function()&lt;br /&gt;
        outputChatBox(&amp;quot;تم بدء السكربت&amp;quot;) -- s هنا سوف يظهر رسالة بالشات &amp;quot; تم بدء السكربت &amp;quot; عند بدء السكربت ويجب ان تكون سترنق&lt;br /&gt;
    end&lt;br /&gt;
) -- نهاية قوس الحدث&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
السترنق له عدة أشكال , فيمكن ان يكون كالآتي&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
أو&lt;br /&gt;
&lt;br /&gt;
' '&lt;br /&gt;
&lt;br /&gt;
أو&lt;br /&gt;
&lt;br /&gt;
[[]]&lt;br /&gt;
&lt;br /&gt;
فمثلاً اذا نريد ان نخرج رسالة بعلبة الشات&lt;br /&gt;
&lt;br /&gt;
يمكن ان تكون كذلك &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
outputChatBox([[مرحباً]])&lt;br /&gt;
&lt;br /&gt;
-- أو كذلك&lt;br /&gt;
outputChatBox('مرحباً')&lt;br /&gt;
&lt;br /&gt;
-- أو كذلك&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;مرحباً&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Command handlerعن الـ====&lt;br /&gt;
.(`) أو زر F8 التي يمكن للاعب ان يعرضها باستخدام زر Consoleهو اسم الامر الذي يمكن للاعب ان يدخله في الـ [[addCommandHandler]] في argument أول&lt;br /&gt;
&lt;br /&gt;
.&amp;quot;createVehicleForPlayer&amp;quot;هي وظيفة تُنفذ عند كتابة اللاعب الامر في هذه الحالة لـ [[addCommandHandler]] في argument ثاني&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:اذا كنت متمرس في البرمجة, ستعرف انك ستحتاج ان تنفذ وظيفة مثل&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
functionName(argument1, argument2, argument3, ..)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
functionName(thePlayer, commandName, argument3, ..)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If we have a closer look on the lower example above, we can see argument1 is thePlayer and argument2 the commandName. thePlayer is simply the one who typed the command, so whatever you call it, the variable will contain the player who activated the command. commandName is simply the command they typed. So if they typed &amp;quot;/greet&amp;quot;, this argument will contain &amp;quot;greet&amp;quot;. Argument 3 is something extra the player typed, you'll learn it a little bit further in the tutorial. Never forget that the first 2 arguments are standard arguments, but you can name them to anything you want.&lt;br /&gt;
&lt;br /&gt;
We called the [[addCommandHandler]] function this way already and since ''createVehicleForPlayer'' is a function too, it can be called that way as well. But we are using a command handler for that, which calls it in a similiar manner, internally.&lt;br /&gt;
&lt;br /&gt;
For example: Someone types &amp;quot;createvehicle 468&amp;quot; ingame in the console to spawn a Sanchez, the command handler calls the createVehicleForPlayer function, as '''if''' we would have this line of code in the script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
createVehicleForPlayer(thePlayer,&amp;quot;createvehicle&amp;quot;,&amp;quot;468&amp;quot;) -- thePlayer هو الشيء الي كتب الكومند&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
As we can see, it provides several parameters: the player who called the command, the command he entered and whatever text he had after that, in this case &amp;quot;468&amp;quot; as vehicle id for the Sanchez. The first two parameters are the same with all command handlers, which you can read on the [[addEventHandler]] page. For this fact, you always have to define at least those two parameters to use any after that (for example to process text that was entered after the command, like in our example the vehicle model id).&lt;br /&gt;
&lt;br /&gt;
''Note: You have to add the command handler AFTER you defined the handler function, else it can't find it. The order of execution matters.''&lt;br /&gt;
&lt;br /&gt;
====Writing the function====&lt;br /&gt;
In order to fill the function we created, we need to think about what we have to do:&lt;br /&gt;
* Get the players position, so we know where to spawn the vehicle (we want it to appear right beside the player)&lt;br /&gt;
* Calculate the position we want to spawn the vehicle at (we don't want it to appear in the player)&lt;br /&gt;
* Spawn the vehicle&lt;br /&gt;
* Check if it has been spawned successfully, or output a message&lt;br /&gt;
&lt;br /&gt;
In order to achieve our goals, we have to use several functions. To find function we need to use, we should visit the [[Scripting Functions|Server Functions List]]. First we need a function to get the players position. Since players are Elements, we first jump to the '''Element functions''' where we find the [[getElementPosition]] function. By clicking on the function name in the list, you get to the function description. There we can see the syntax, what it returns and usually an example. The syntax shows us what arguments we can or have to submit.&lt;br /&gt;
&lt;br /&gt;
For [[getElementPosition]], the syntax is:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float, float, float getElementPosition ( element theElement )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three ''float'' in front of the function name are the return type. In this case it means the function returns three floating point numbers. (x, y and z) Within the parentheses, you can see what arguments you have to submit. In this case only the element whose position you want to get, which is the player in our example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	-- نأتي باحداثيات المكان الي نبغي نضع فيه السيارة بشكل x, y, z&lt;br /&gt;
	-- (local  تعني ان هاد الاختصار ما رح يشغل غير في هاد الفنكشن)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we want to ensure that the vehicle won't spawn directly in the player, so we add a few units to the ''x'' variable, which will make it spawn east from the player.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) -- نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- add 5 units to the x position&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we need another function, one to spawn a vehicle. We once again search for it on the [[Scripting Functions|Server Functions List]], this time - since we are talking about vehicles - in the '''Vehicle functions''' section, where we will choose [[createVehicle]]. In this function's syntax, we only have one return type (which is more common), a vehicle element that points to the vehicle we just created. Also, we see that some arguments are enclosed within [ ] which means that those are optional.&lt;br /&gt;
&lt;br /&gt;
We already have all arguments we need for [[createVehicle]] in our function: The position we just calculated in the ''x,y,z'' variables and the model id that we provided through the command (&amp;quot;createvehicle 468&amp;quot;) and can access in the function as ''vehicleModel'' variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) --  نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- add 5 units to the x position&lt;br /&gt;
	-- create the vehicle and store the returned vehicle element in the ''createdVehicle'' variable&lt;br /&gt;
	local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course this code can be improved in many ways, but at least we want to add a check whether the vehicle was created successfully or not. As we can read on the [[createVehicle]] page under '''Returns''', the function returns ''false'' when it was unable to create the vehicle. Thus, we check the value of the ''createVehicle'' variable.&lt;br /&gt;
&lt;br /&gt;
Now we have our complete script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) --  نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- نضيف 5 وحد ل الاحداثيات X&lt;br /&gt;
	local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z)&lt;br /&gt;
	-- نشوف لو السيارة اتعملت ام لا&lt;br /&gt;
	if (createdVehicle == false) then&lt;br /&gt;
		-- لو السياره اتعملت يبقي نعمل رسالة,لكن للاعب فقط&lt;br /&gt;
		outputChatBox(&amp;quot;Failed to create vehicle.&amp;quot;,thePlayer)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;createvehicle&amp;quot;, createVehicleForPlayer)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, we introduced another function with [[outputChatBox]]. By now, you should be able to explore the function's documentation page yourself. For more advanced scripting, please check out the [[Map manager|Map Manager]].&lt;br /&gt;
&lt;br /&gt;
==What you need to know==&lt;br /&gt;
You already read some things about resources, command handlers and finding functions in the documentation in the first paragraph, but there is much more to learn. This section will give you a rather short overview over some of these things, while linking to related pages if possible.&lt;br /&gt;
===Clientside and Serverside scripts===&lt;br /&gt;
You may have already noticed these or similiar terms (Server/Client) somewhere on this wiki, mostly in conjunction with functions. MTA not only supports scripts that run on the server and provide commands (like the one we wrote above) or other features, but also scripts that run on the MTA client the players use to connect to the server. The reason for this is, that some features MTA provides have to be clientside (like a GUI - Graphical User Interface), others should be because they work better and still others are better off to be serverside or just don't work clientside.&lt;br /&gt;
&lt;br /&gt;
Most scripts you will make (gamemodes, maps) will probably be serverside, like the one we wrote in the first section. If you run into something that can't be solved serverside, you will probably have to make it clientside. For a clientside script for example, you would create a ordinary script file (for example called ''client.lua'') and specify it in the meta.xml, like this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;client.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The ''type'' attribute defaults to 'server', so you only need to specify it for clientside scripts. When you do this, the clientside script will be downloaded to the player's computer once he connects to the server. Read more about [[Client side scripts]].&lt;br /&gt;
&lt;br /&gt;
===More complex resources===&lt;br /&gt;
The previous section showed briefly how to add clientside scripts to the resource, but there is also much more possible. As mentioned at the very top of this page, resources can be pretty much everything. Their purpose is defined by what they do. Let's have some theoretical resources, by looking at the files it contains, the ''meta.xml'' and what they might do:&lt;br /&gt;
&lt;br /&gt;
====First example - A utility script====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/admin_commands&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/commands.lua&lt;br /&gt;
	/client.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;admin commands&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;commands.lua&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;client.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''commands.lua'' provides some admin commands, like banning a player, muting or something else that can be used to admin the server&lt;br /&gt;
* The ''client.lua'' provides a GUI to be able to perform the mentioned actions easily&lt;br /&gt;
&lt;br /&gt;
This example might be running all the time (maybe even auto-started when the server starts) as it's useful during the whole gaming experience and also wont interfere with the gameplay, unless an admin decides to take some action of course.&lt;br /&gt;
&lt;br /&gt;
====Second example - A gamemode====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/counterstrike&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/counterstrike.lua&lt;br /&gt;
	/buymenu.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;Counterstrike remake&amp;quot; type=&amp;quot;gamemode&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;counterstrike.lua&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;buymenu.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''counterstrike.lua'' contains similiar to the following features:&lt;br /&gt;
** Let players choose their team and spawn them&lt;br /&gt;
** Provide them with weapons, targets and instructions (maybe read from a Map, see below)&lt;br /&gt;
** Define the game's rules, e.g. when does the round end, what happens when a player dies&lt;br /&gt;
** .. and maybe some more&lt;br /&gt;
* The ''buymenu.lua'' is a clientside script and creates a menu to buy weapons&lt;br /&gt;
&lt;br /&gt;
This example can be called a gamemode, since it not only intereferes with the gameplay, but actually defines the rules of it. The ''type'' attribute indicates that this example works with the [[Map manager]], yet another resource that was written by the QA Team to manage gamemodes and map loading. It is highly recommended that you base your gamemodes on the techniques it provides.&lt;br /&gt;
&lt;br /&gt;
This also means that the gamemode probably won't run without a map. Gamemodes should always be as generic as possible. An example for a map is stated in the next example.&lt;br /&gt;
&lt;br /&gt;
====Third example - A Map====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/cs-airport&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/airport.map&lt;br /&gt;
	/airport.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;Counterstrike airport map&amp;quot; type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;counterstrike&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;map src=&amp;quot;airport.map&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;airport.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''airport.map'' in a XML file that provides information about the map to the gamemode, these may include:&lt;br /&gt;
** Where the players should spawn, with what weapons, what teams there are&lt;br /&gt;
** What the targets are&lt;br /&gt;
** Weather, World Time, Timelimit&lt;br /&gt;
** Provide vehicles&lt;br /&gt;
* The ''airport.lua'' might contain map-specific features, that may include:&lt;br /&gt;
** Opening some door/make something explode when something specific happens&lt;br /&gt;
** Create or move some custom objects, or manipulate objects that are created through the .map file&lt;br /&gt;
** .. anything else map-specific you can think of&lt;br /&gt;
&lt;br /&gt;
As you can see, the ''type'' attribute changed to 'map', telling the [[Map manager]] that this resource is a map, while the ''gamemodes'' attribute tells it for which gamemodes this map is valid, in this case the gamemode from the above example.&lt;br /&gt;
What may come as a surprise is that there is also a script in the Map resource. Of course this is not necessarily needed in a map, but opens a wide range of possibilities for map makers to create their own world within the rules of the gamemode they create it for.&lt;br /&gt;
&lt;br /&gt;
The ''airport.map'' file might look similiar to this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map mode=&amp;quot;deathmatch&amp;quot; version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;terrorists&amp;gt;&lt;br /&gt;
		&amp;lt;spawnpoint posX=&amp;quot;2332.23&amp;quot; posY=&amp;quot;-12232.33&amp;quot; posZ=&amp;quot;4.42223&amp;quot; skins=&amp;quot;23-40&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/terrorists&amp;gt;&lt;br /&gt;
	&amp;lt;counterterrorists&amp;gt;&lt;br /&gt;
		&amp;lt;spawnpoint posX=&amp;quot;2334.23443&amp;quot; posY=&amp;quot;-12300.233&amp;quot; posZ=&amp;quot;10.2344&amp;quot; skins=&amp;quot;40-50&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/counterterrorists&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;bomb posX=&amp;quot;23342.23&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
	&amp;lt;vehicle posX=&amp;quot;&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; model=&amp;quot;602&amp;quot; /&amp;gt;	&lt;br /&gt;
	&amp;lt;vehicle posX=&amp;quot;&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; model=&amp;quot;603&amp;quot; /&amp;gt;	&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When a gamemode is started with a map, the map resources is automatically started by the mapmanager and the information it contains can be read by the gamemode resource. When the map changes, the current map resource is stopped and the next map resource is started. For a more in-depth explanation and examples of how map resources are utilized in the main script, please visit the [[Writing Gamemodes]] page.&lt;br /&gt;
&lt;br /&gt;
===Events===&lt;br /&gt;
Events are the way MTA tells scripts about things that happen. For example when a player dies, the [[onPlayerWasted]] event is triggered. In order to perform any actions when a player dies, you have to prepare yourself similiar to adding a command handler, as shown in [[#Writing_the_script|the first chapter]].&lt;br /&gt;
&lt;br /&gt;
This example will output a message with the name of the player who died:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function playerDied(totalAmmo, killer, killerWeapon, bodypart)&lt;br /&gt;
	outputChatBox(getPlayerName(source)..&amp;quot; died!&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerWasted&amp;quot;,getRootElement(),playerDied)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead of showing what arguments are needed, the documentation page for Events shows what parameters are passed to the handler function, similiar to the way a [[#About_command_handlers|command handler]] does, just that it is different from event to event. Another important point is the ''source'' variable, that exists in handler functions. It doesn't have to be added to the parameter list of the function, but it still exists. It has a different value from event to event, for player events (as in the example above) it is the player element. As another example, you can take a look at the basic spawning player script in the first section to get an idea how ''source'' is used.&lt;br /&gt;
&lt;br /&gt;
==Where to go from here==&lt;br /&gt;
You should now be familiar with the most basic aspects of MTA scripting and also a bit with the documentation. The [[Main Page]] provides you with links to more information, Tutorials and References that allow a deeper look into the topics you desire to learn about.&lt;br /&gt;
&lt;br /&gt;
From here we recommend reading the [[debugging]] tutorial. Good debugging skills are an absolute necessity when you are making scripts.&lt;br /&gt;
&lt;br /&gt;
[[ru:Scripting Introduction]]&lt;br /&gt;
[[it:Introduzione allo scripting]]&lt;br /&gt;
[[es:Introducción a la Programación]]&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/%D9%85%D9%82%D8%AF%D9%85%D9%87_%D9%81%D9%8A_%D8%A7%D9%84%D8%A8%D8%B1%D9%85%D8%AC%D9%87&amp;diff=47525</id>
		<title>AR/مقدمه في البرمجه</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/%D9%85%D9%82%D8%AF%D9%85%D9%87_%D9%81%D9%8A_%D8%A7%D9%84%D8%A8%D8%B1%D9%85%D8%AC%D9%87&amp;diff=47525"/>
		<updated>2016-05-15T15:12:08Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p align=&amp;quot;right&amp;quot;&amp;gt;  &lt;br /&gt;
السكربتات جزء أساسي في تشغيل MTA فتستطيع بإستخدامهم إنشاء تطبيقات لتحسين اللعب ، تختلف أنواع السكربتات فمنها خريطة أو وضع للعب &amp;quot; freeroam , race , deathmatch &amp;quot; وغيرها ..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
برمجة السكربتات تعتمد على لغة البرمجة (Lua) [www.lua.org] .&lt;br /&gt;
&lt;br /&gt;
لغة البرمجة تعتمد إعتماداً كلياً على اللغة الإنجليزية , فيجب أن تكون لديك خلفية في اللغة الإنجليزية قبل المتابعة.&lt;br /&gt;
&lt;br /&gt;
لبرمجة سكربت ما تحتاج لمحرر .. ويفضل إستخدام محرر إحترافي لكي يسهل عليك البرمجة مثل :&lt;br /&gt;
*Notepad++ [http://notepad-plus-plus.org/download]&lt;br /&gt;
*Lua Edit [http://luaedit.sourceforge.net/ LuaEdit]&lt;br /&gt;
&lt;br /&gt;
لكن يفضل إستخدام برنامج MTASE فهو يسهل عملية إنشاء السكربتات وبرمجتها :&lt;br /&gt;
* [[MTASE|MTA Script Editor]].'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==إنشاء سكربت ==&lt;br /&gt;
&lt;br /&gt;
سوف نتعلم كيف نقوم بإنشاء سكربت يدخل اللاعب إلى اللعبة .. خطوة بحطوة&lt;br /&gt;
&lt;br /&gt;
اولا لا بد من معرفة انواع ملفات السكربت    &lt;br /&gt;
                                                                                                          &lt;br /&gt;
1-Meta.xml -- يقوم هذا الملف بتعرف الملفات الموجود في السكربت للسيرفر               &lt;br /&gt;
                                                                                          &lt;br /&gt;
2-Client -- يقوم هذا الملف بتشغيل جميع أوامر المتعلقة بالاعب فقط                                       &lt;br /&gt;
&lt;br /&gt;
3-Server -- يقوم هذا الملف بتشغيل جميع الاوامر سواء كانت للسيرفر او الاعب&lt;br /&gt;
&lt;br /&gt;
===أين مسار كل البرامج النصية (السكريبتات أو المودات)؟===&lt;br /&gt;
الان نتعرف على مجلد المودات أو السكربتات.&lt;br /&gt;
اذهب إلى مجلد Multi Theft Auto واتبع المسار التالي:&lt;br /&gt;
&lt;br /&gt;
	/Your MTA Server/mods/deathmatch/resources/&lt;br /&gt;
&lt;br /&gt;
سترى الكثير من الملفات. ربما ترى مجلدات صيغتها .zip أو مجلد عادي , وجميعها يقبله الـ MTA ..&lt;br /&gt;
ولإنشاء المودات الخاصة بك: قم بعمل مجلد جديد واجعل اسمه كما تريد فمثلاً قم بتسميته &amp;quot;myserver&amp;quot; وهو الذي سنستخدمه بالبرنامج التعليمي&lt;br /&gt;
والان يجب أن يكون مسار المجلد الذي قمت بعمله هذا:&lt;br /&gt;
&lt;br /&gt;
	/Your MTA Server/mods/deathmatch/resources/myserver/&lt;br /&gt;
&lt;br /&gt;
* myserver: اسم المجلد الذي قمت بتسميته&lt;br /&gt;
&lt;br /&gt;
===تعريف السكربت (إضافة ملف meta.xml)===&lt;br /&gt;
حتى يستطيع السيرفر من معرفة المودات, يجب علينا إنشاء ملف meta.xml &lt;br /&gt;
&amp;quot; ويكون بداخل مجلد السكربت الذي قمنا بإنشائه وهو &amp;quot;myserver&amp;quot; &lt;br /&gt;
ولإنشاء ملف meta.xml : أفتح ملف نصي جديد وقم بتسميته meta.xml وافتحه باستخدام المفكرة =)&lt;br /&gt;
ولا تنسى ان يكون بداخل مجلد السكربت .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
أدخل الكود التالي في ملف ''meta.xml'':&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
     &amp;lt;info author=&amp;quot;إسمك&amp;quot; type=&amp;quot;gamemode&amp;quot; name=&amp;quot;إسم السكربت&amp;quot; description=&amp;quot;وصف بسيط للسكربت&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;script src=&amp;quot;script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
هنا يتم تعريف أجزاء السكربت فمثلاً :&lt;br /&gt;
* &amp;lt;info ..&amp;gt;&lt;br /&gt;
تضع فيه بيانات السكربت .. مثل الإسم والنوع والوصف&lt;br /&gt;
* type=&amp;quot;gamemode&amp;quot;&lt;br /&gt;
تعني أن نوع السكربت هو مود لعب وتوجد أنواع عديدة مثل :&lt;br /&gt;
**gamemode&lt;br /&gt;
**map&lt;br /&gt;
**script&lt;br /&gt;
&lt;br /&gt;
===إنشاء ملف السكربت Lua===&lt;br /&gt;
قمنا بوضع هذا السطر في :&lt;br /&gt;
*meta.xml&lt;br /&gt;
:&lt;br /&gt;
		&amp;lt;script src=&amp;quot;script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
الآن نقوم بإنشاء ملف نصي بنفس الإسم&lt;br /&gt;
**script.lua&lt;br /&gt;
بإستخدام برنامج التحرير لديك .. نقوم بإنشاء الكود&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function joinHandler() -- الوظيفة .. وبعدها نقوم بكتابة الإسم&lt;br /&gt;
	local x = 1959.55 -- تعريف x&lt;br /&gt;
	local y = -1714.46 -- تعريف y&lt;br /&gt;
	local z = 10 -- تعريف z&lt;br /&gt;
	spawnPlayer(source, x, y, z) -- نقوم بإستخدام هذه الوظيفة لإنتاج اللاعب ونقوم بتحديد اللاعب وهو المصدر : source&lt;br /&gt;
	fadeCamera(source, true) -- نقوم بعمل fade للكاميرا&lt;br /&gt;
	setCameraTarget(source, source) -- نجعل هدف الكاميرا هو اللاعب &lt;br /&gt;
	outputChatBox(&amp;quot;مرحباً بك في السيرفر&amp;quot;, source) -- نقوم بإخراج نص في الدردشة&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, getRootElement(), joinHandler) -- نقوم بإضافة المعالج حيث سيتم تشغيله بعد الحدث المحدد وهو عند دخول اللا&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
وصف وشرح الكود اعلاه : &lt;br /&gt;
	سيقوم السكربت بوضع اللاعب في الاحداثيات (x,y,z) المحدده اعلاه, عند دخوله الى السيرفر&lt;br /&gt;
	لاحظ انه يجب استخدام  وظيفة [ ''fadeCamera'' ] ستكون الشاشة سوداء وأيضاً يجب تعيين الكاميرا ( setTargetCamera ) ..&lt;br /&gt;
&lt;br /&gt;
نرى أن '''source''' هو المصدر وهو اللاعب الذي يقوم بالدخول &lt;br /&gt;
&lt;br /&gt;
*[[addEventHandler]] - الاحداث وهي ما يجب فعله من قبل المستخدم او السيرفر&lt;br /&gt;
*[[function]] - وظيفة تعمل عند حدث من الاحداث وتحتوي على امر او أوامر&lt;br /&gt;
أيضاً لو رأينا في المعالج &lt;br /&gt;
*[[addEventHandler]] - إضافة معالج للحدث&lt;br /&gt;
نرى 3 أشياء&lt;br /&gt;
*: onPlayerJoin - عند دخول اللاعب&lt;br /&gt;
وهو الحدث .. حيث يحدد متى يتم تشغيل المعالج - في هذه الحالة عند دخول اللاعب&lt;br /&gt;
*getRootElement() - جلب العنصر الحالي&lt;br /&gt;
هذا يقوم بتعيين العنصر الذي يقوم بتشغيل الحدث &lt;br /&gt;
*joinHandler &lt;br /&gt;
وهو إسم الوظيفة التي قمنا بصناعتها &lt;br /&gt;
&lt;br /&gt;
يمكنك التوسع أكثر في : [[addEventHandler]]&lt;br /&gt;
&lt;br /&gt;
===تشغيل السكربت===&lt;br /&gt;
بعد أن تقوم بحفظ أجزاء السكربت في ملف واحد ويمكن حفظه في الملفات التالية :&lt;br /&gt;
* مجلد&lt;br /&gt;
* أرشيف .zip&lt;br /&gt;
ونقوم بنسخه إلى مجلد السكربتات داخل سيرفرك ونقوم بتشغيله بالطريقة العادية.&lt;br /&gt;
&lt;br /&gt;
الآن إنتهينا من صنع السكربت .. بعد هذا سنقوم بصنع سكربت مع أمر &lt;br /&gt;
* command&lt;br /&gt;
يمكنك المتابعة أو الذهاب إلى دورة صناعة النوافذ&lt;br /&gt;
*[[Introduction to Scripting GUI]]&lt;br /&gt;
&lt;br /&gt;
===إنشاء سكربت بطريقة مفصلة===&lt;br /&gt;
&lt;br /&gt;
==صناعة أمر بسيط==&lt;br /&gt;
لنعد الآن إلى ملف&lt;br /&gt;
*script.lua&lt;br /&gt;
ونقوم بتعديله قليلاً لإنشاء أمر بسيط يقوم بإنشاء سيارة بجانب اللاعب&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- في البداية نقوم بكتب وظيفة إنشاء السيارة&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
   -- هنا نقوم بكتابة وظيفة إنشاء السيارة كـ&lt;br /&gt;
   -- createVehicle&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- نقوم بإضافة الأمر&lt;br /&gt;
addCommandHandler(&amp;quot;createvehicle&amp;quot;, createVehicleForPlayer) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
''ملاحظة: يمكنك الضغط على الوظائف والتعمق فيها بداخل الويكي.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== الوظيفة ==&lt;br /&gt;
الوظيفة هي شيء يسمى&lt;br /&gt;
&lt;br /&gt;
function&lt;br /&gt;
&lt;br /&gt;
الوظيفة هي الشيء التي يتكون عليها الحدث&lt;br /&gt;
&lt;br /&gt;
يمكنك ان تسمي الوظيفة كما شئت ويمكنك أيضاً عدم وضع اسم للوظيفة&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''مثال لـ وظيفة لها إسم'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function arabs( ) -- الوظيفة&lt;br /&gt;
    outputChatBox(&amp;quot;مرحباً بك&amp;quot;) --s  ستلاحظ بـ أن كلمة &amp;quot; مرحباً بك &amp;quot; ظهرت في الشات عند دخول الاعب &lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, root, arabs) -- .الحدث مع اسم الوظيفة&lt;br /&gt;
-- root = getRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''مثال لـ وظيفة ليس لها إسم'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerWasted&amp;quot;, root,&lt;br /&gt;
function(_,killer)&lt;br /&gt;
    outputChatBox( killer .. &amp;quot; من قبل&amp;quot; .. getPlayerName(source) .. &amp;quot; لقد قُتل الاعب&amp;quot; )&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
كما تلاحظ ووضع قوس قريباً من&lt;br /&gt;
&lt;br /&gt;
end)&lt;br /&gt;
&lt;br /&gt;
هذا القوس يكمل القوس الآخر كما نلاحظ في الحدث &lt;br /&gt;
&lt;br /&gt;
addEventHandler(&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== الحدث ==&lt;br /&gt;
الحدث هو شيء يسمى&lt;br /&gt;
&lt;br /&gt;
event&lt;br /&gt;
&lt;br /&gt;
الحدث هو الذي يتكون على بناء الوظيفة&lt;br /&gt;
فـ اذا رجعنا الى الامثلة التي في الاعلى سوف نرى عدة احداث ومنها&lt;br /&gt;
&lt;br /&gt;
[[onPlayerWasted]]&lt;br /&gt;
&lt;br /&gt;
الحدث ببساطة يحدد متى سوف تحدث او كيف سوف تحدث الوظائف التي ادخلتها&lt;br /&gt;
&lt;br /&gt;
onPlayerWasted&lt;br /&gt;
&lt;br /&gt;
عند موت الاعب&lt;br /&gt;
&lt;br /&gt;
'''مثال للحدث'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onJoin()&lt;br /&gt;
    x, y, z = getElementPosition(source) -- s يآتي بمكان الاعب x, y, z&lt;br /&gt;
	    local theVehicle = createVehicle(445, x, y, z) -- s السيارة التي سـ تصنع بمكان الاعب الذي تم تحديده مسبقاً&lt;br /&gt;
		    warpPedIntoVehicle(source, theVehicle) -- s يجعل الاعب داخل السيارة&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, root, onJoin) -- s الحدث&lt;br /&gt;
-- root = getRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
هذه الوظيفة مع هذا الحدث سوف يعطون الاعب سيارة عند دخوله السيرفر&lt;br /&gt;
&lt;br /&gt;
ملاحظة الحدث ليس دائم على الوظيفة فـ أيصاً يمكنك تكوين هذه الوظيفة على حدث آخر&lt;br /&gt;
&lt;br /&gt;
'''مثال'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onJoin()&lt;br /&gt;
    x, y, z = getElementPosition(source)&lt;br /&gt;
	    local theVehicle = createVehicle(445, x, y, z)&lt;br /&gt;
		    warpPedIntoVehicle(source, theVehicle)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerLogin&amp;quot;, root, onJoin)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
هذا سوف يعطي الاعب سيارة لاكن ليس عند دخوله السيرفر , إنما عند دخوله حسابه&lt;br /&gt;
&lt;br /&gt;
'''Edit'''&lt;br /&gt;
&lt;br /&gt;
مثال آخر&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onVehicleExplode&amp;quot;,root, -- نضيف حدث عند إنفجار اي سيارة&lt;br /&gt;
    function() -- الوظيفة&lt;br /&gt;
        setTimer(destroyElement,5000,1,source) -- يخفي السيارة بعد 5 ثواني من انفاجرها &lt;br /&gt;
    end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
يمكنك ان تجد&lt;br /&gt;
الاحداث&lt;br /&gt;
والوظائف &lt;br /&gt;
كلنت وسيرفر&lt;br /&gt;
هنا&lt;br /&gt;
&lt;br /&gt;
كلنت:&lt;br /&gt;
&lt;br /&gt;
'''وظائف كلنت'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Client_Scripting_Functions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''احداث كلنت'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Client_Scripting_Events&lt;br /&gt;
&lt;br /&gt;
سيرفر:&lt;br /&gt;
&lt;br /&gt;
'''وظائف سيرفر'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Server_Scripting_Functions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''احداث سيرفر'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Server_Scripting_Events&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== String الـ ==&lt;br /&gt;
السترنج هو شيء يوجد في بعض الوظايف التي توجد داخل الام تي اي&lt;br /&gt;
&lt;br /&gt;
مثلاً&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onResourceStart&amp;quot;,resourceRoot, -- الايفنت هنا يجب ان تكون بين سترنق كما الموضح هنا&lt;br /&gt;
    function()&lt;br /&gt;
        outputChatBox(&amp;quot;تم بدء السكربت&amp;quot;) -- s هنا سوف يظهر رسالة بالشات &amp;quot; تم بدء السكربت &amp;quot; عند بدء السكربت ويجب ان تكون سترنق&lt;br /&gt;
    end&lt;br /&gt;
) -- نهاية قوس الحدث&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
السترنق له عدة أشكال , فيمكن ان يكون كالآتي&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
أو&lt;br /&gt;
&lt;br /&gt;
' '&lt;br /&gt;
&lt;br /&gt;
أو&lt;br /&gt;
&lt;br /&gt;
[[]]&lt;br /&gt;
&lt;br /&gt;
فمثلاً اذا نريد ان نخرج رسالة بعلبة الشات&lt;br /&gt;
&lt;br /&gt;
يمكن ان تكون كذلك &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
outputChatBox([[مرحباً]])&lt;br /&gt;
&lt;br /&gt;
-- أو كذلك&lt;br /&gt;
outputChatBox('مرحباً')&lt;br /&gt;
&lt;br /&gt;
-- أو كذلك&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;مرحباً&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Command handlerعن الـ====&lt;br /&gt;
.(`) أو زر F8 التي يمكن للاعب ان يعرضها باستخدام زر Consoleهو اسم الامر الذي يمكن للاعب ان يدخله في الـ [[addCommandHandler]] في argument أول&lt;br /&gt;
&lt;br /&gt;
.&amp;quot;createVehicleForPlayer&amp;quot;هي وظيفة تُنفذ عند كتابة اللاعب الامر في هذه الحالة لـ [[addCommandHandler]] في argument ثاني&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:اذا كنت متمرس في البرمجة, ستعرف انك ستحتاج ان تنفذ وظيفة مثل&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
functionName(argument1, argument2, argument3, ..)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
functionName(thePlayer, commandName, argument3, ..)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If we have a closer look on the lower example above, we can see argument1 is thePlayer and argument2 the commandName. thePlayer is simply the one who typed the command, so whatever you call it, the variable will contain the player who activated the command. commandName is simply the command they typed. So if they typed &amp;quot;/greet&amp;quot;, this argument will contain &amp;quot;greet&amp;quot;. Argument 3 is something extra the player typed, you'll learn it a little bit further in the tutorial. Never forget that the first 2 arguments are standard arguments, but you can name them to anything you want.&lt;br /&gt;
&lt;br /&gt;
We called the [[addCommandHandler]] function this way already and since ''createVehicleForPlayer'' is a function too, it can be called that way as well. But we are using a command handler for that, which calls it in a similiar manner, internally.&lt;br /&gt;
&lt;br /&gt;
For example: Someone types &amp;quot;createvehicle 468&amp;quot; ingame in the console to spawn a Sanchez, the command handler calls the createVehicleForPlayer function, as '''if''' we would have this line of code in the script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
createVehicleForPlayer(thePlayer,&amp;quot;createvehicle&amp;quot;,&amp;quot;468&amp;quot;) -- thePlayer هو الشيء الي كتب الكومند&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
As we can see, it provides several parameters: the player who called the command, the command he entered and whatever text he had after that, in this case &amp;quot;468&amp;quot; as vehicle id for the Sanchez. The first two parameters are the same with all command handlers, which you can read on the [[addEventHandler]] page. For this fact, you always have to define at least those two parameters to use any after that (for example to process text that was entered after the command, like in our example the vehicle model id).&lt;br /&gt;
&lt;br /&gt;
''Note: You have to add the command handler AFTER you defined the handler function, else it can't find it. The order of execution matters.''&lt;br /&gt;
&lt;br /&gt;
====Writing the function====&lt;br /&gt;
In order to fill the function we created, we need to think about what we have to do:&lt;br /&gt;
* Get the players position, so we know where to spawn the vehicle (we want it to appear right beside the player)&lt;br /&gt;
* Calculate the position we want to spawn the vehicle at (we don't want it to appear in the player)&lt;br /&gt;
* Spawn the vehicle&lt;br /&gt;
* Check if it has been spawned successfully, or output a message&lt;br /&gt;
&lt;br /&gt;
In order to achieve our goals, we have to use several functions. To find function we need to use, we should visit the [[Scripting Functions|Server Functions List]]. First we need a function to get the players position. Since players are Elements, we first jump to the '''Element functions''' where we find the [[getElementPosition]] function. By clicking on the function name in the list, you get to the function description. There we can see the syntax, what it returns and usually an example. The syntax shows us what arguments we can or have to submit.&lt;br /&gt;
&lt;br /&gt;
For [[getElementPosition]], the syntax is:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float, float, float getElementPosition ( element theElement )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three ''float'' in front of the function name are the return type. In this case it means the function returns three floating point numbers. (x, y and z) Within the parentheses, you can see what arguments you have to submit. In this case only the element whose position you want to get, which is the player in our example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	-- نأتي باحداثيات المكان الي نبغي نضع فيه السيارة بشكل x, y, z&lt;br /&gt;
	-- (local  تعني ان هاد الاختصار ما رح يشغل غير في هاد الفنكشن)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we want to ensure that the vehicle won't spawn directly in the player, so we add a few units to the ''x'' variable, which will make it spawn east from the player.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) -- نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- add 5 units to the x position&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we need another function, one to spawn a vehicle. We once again search for it on the [[Scripting Functions|Server Functions List]], this time - since we are talking about vehicles - in the '''Vehicle functions''' section, where we will choose [[createVehicle]]. In this function's syntax, we only have one return type (which is more common), a vehicle element that points to the vehicle we just created. Also, we see that some arguments are enclosed within [ ] which means that those are optional.&lt;br /&gt;
&lt;br /&gt;
We already have all arguments we need for [[createVehicle]] in our function: The position we just calculated in the ''x,y,z'' variables and the model id that we provided through the command (&amp;quot;createvehicle 468&amp;quot;) and can access in the function as ''vehicleModel'' variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) --  نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- add 5 units to the x position&lt;br /&gt;
	-- create the vehicle and store the returned vehicle element in the ''createdVehicle'' variable&lt;br /&gt;
	local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course this code can be improved in many ways, but at least we want to add a check whether the vehicle was created successfully or not. As we can read on the [[createVehicle]] page under '''Returns''', the function returns ''false'' when it was unable to create the vehicle. Thus, we check the value of the ''createVehicle'' variable.&lt;br /&gt;
&lt;br /&gt;
Now we have our complete script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) --  نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- نضيف 5 وحد ل الاحداثيات X&lt;br /&gt;
	local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z)&lt;br /&gt;
	-- نشوف لو السيارة اتعملت ام لا&lt;br /&gt;
	if (createdVehicle == false) then&lt;br /&gt;
		-- لو السياره اتعملت يبقي نعمل رسالة,لكن للاعب فقط&lt;br /&gt;
		outputChatBox(&amp;quot;Failed to create vehicle.&amp;quot;,thePlayer)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;createvehicle&amp;quot;, createVehicleForPlayer)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, we introduced another function with [[outputChatBox]]. By now, you should be able to explore the function's documentation page yourself. For more advanced scripting, please check out the [[Map manager|Map Manager]].&lt;br /&gt;
&lt;br /&gt;
==What you need to know==&lt;br /&gt;
You already read some things about resources, command handlers and finding functions in the documentation in the first paragraph, but there is much more to learn. This section will give you a rather short overview over some of these things, while linking to related pages if possible.&lt;br /&gt;
===Clientside and Serverside scripts===&lt;br /&gt;
You may have already noticed these or similiar terms (Server/Client) somewhere on this wiki, mostly in conjunction with functions. MTA not only supports scripts that run on the server and provide commands (like the one we wrote above) or other features, but also scripts that run on the MTA client the players use to connect to the server. The reason for this is, that some features MTA provides have to be clientside (like a GUI - Graphical User Interface), others should be because they work better and still others are better off to be serverside or just don't work clientside.&lt;br /&gt;
&lt;br /&gt;
Most scripts you will make (gamemodes, maps) will probably be serverside, like the one we wrote in the first section. If you run into something that can't be solved serverside, you will probably have to make it clientside. For a clientside script for example, you would create a ordinary script file (for example called ''client.lua'') and specify it in the meta.xml, like this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;client.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The ''type'' attribute defaults to 'server', so you only need to specify it for clientside scripts. When you do this, the clientside script will be downloaded to the player's computer once he connects to the server. Read more about [[Client side scripts]].&lt;br /&gt;
&lt;br /&gt;
===More complex resources===&lt;br /&gt;
The previous section showed briefly how to add clientside scripts to the resource, but there is also much more possible. As mentioned at the very top of this page, resources can be pretty much everything. Their purpose is defined by what they do. Let's have some theoretical resources, by looking at the files it contains, the ''meta.xml'' and what they might do:&lt;br /&gt;
&lt;br /&gt;
====First example - A utility script====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/admin_commands&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/commands.lua&lt;br /&gt;
	/client.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;admin commands&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;commands.lua&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;client.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''commands.lua'' provides some admin commands, like banning a player, muting or something else that can be used to admin the server&lt;br /&gt;
* The ''client.lua'' provides a GUI to be able to perform the mentioned actions easily&lt;br /&gt;
&lt;br /&gt;
This example might be running all the time (maybe even auto-started when the server starts) as it's useful during the whole gaming experience and also wont interfere with the gameplay, unless an admin decides to take some action of course.&lt;br /&gt;
&lt;br /&gt;
====Second example - A gamemode====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/counterstrike&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/counterstrike.lua&lt;br /&gt;
	/buymenu.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;Counterstrike remake&amp;quot; type=&amp;quot;gamemode&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;counterstrike.lua&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;buymenu.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''counterstrike.lua'' contains similiar to the following features:&lt;br /&gt;
** Let players choose their team and spawn them&lt;br /&gt;
** Provide them with weapons, targets and instructions (maybe read from a Map, see below)&lt;br /&gt;
** Define the game's rules, e.g. when does the round end, what happens when a player dies&lt;br /&gt;
** .. and maybe some more&lt;br /&gt;
* The ''buymenu.lua'' is a clientside script and creates a menu to buy weapons&lt;br /&gt;
&lt;br /&gt;
This example can be called a gamemode, since it not only intereferes with the gameplay, but actually defines the rules of it. The ''type'' attribute indicates that this example works with the [[Map manager]], yet another resource that was written by the QA Team to manage gamemodes and map loading. It is highly recommended that you base your gamemodes on the techniques it provides.&lt;br /&gt;
&lt;br /&gt;
This also means that the gamemode probably won't run without a map. Gamemodes should always be as generic as possible. An example for a map is stated in the next example.&lt;br /&gt;
&lt;br /&gt;
====Third example - A Map====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/cs-airport&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/airport.map&lt;br /&gt;
	/airport.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;Counterstrike airport map&amp;quot; type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;counterstrike&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;map src=&amp;quot;airport.map&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;airport.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''airport.map'' in a XML file that provides information about the map to the gamemode, these may include:&lt;br /&gt;
** Where the players should spawn, with what weapons, what teams there are&lt;br /&gt;
** What the targets are&lt;br /&gt;
** Weather, World Time, Timelimit&lt;br /&gt;
** Provide vehicles&lt;br /&gt;
* The ''airport.lua'' might contain map-specific features, that may include:&lt;br /&gt;
** Opening some door/make something explode when something specific happens&lt;br /&gt;
** Create or move some custom objects, or manipulate objects that are created through the .map file&lt;br /&gt;
** .. anything else map-specific you can think of&lt;br /&gt;
&lt;br /&gt;
As you can see, the ''type'' attribute changed to 'map', telling the [[Map manager]] that this resource is a map, while the ''gamemodes'' attribute tells it for which gamemodes this map is valid, in this case the gamemode from the above example.&lt;br /&gt;
What may come as a surprise is that there is also a script in the Map resource. Of course this is not necessarily needed in a map, but opens a wide range of possibilities for map makers to create their own world within the rules of the gamemode they create it for.&lt;br /&gt;
&lt;br /&gt;
The ''airport.map'' file might look similiar to this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map mode=&amp;quot;deathmatch&amp;quot; version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;terrorists&amp;gt;&lt;br /&gt;
		&amp;lt;spawnpoint posX=&amp;quot;2332.23&amp;quot; posY=&amp;quot;-12232.33&amp;quot; posZ=&amp;quot;4.42223&amp;quot; skins=&amp;quot;23-40&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/terrorists&amp;gt;&lt;br /&gt;
	&amp;lt;counterterrorists&amp;gt;&lt;br /&gt;
		&amp;lt;spawnpoint posX=&amp;quot;2334.23443&amp;quot; posY=&amp;quot;-12300.233&amp;quot; posZ=&amp;quot;10.2344&amp;quot; skins=&amp;quot;40-50&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/counterterrorists&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;bomb posX=&amp;quot;23342.23&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
	&amp;lt;vehicle posX=&amp;quot;&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; model=&amp;quot;602&amp;quot; /&amp;gt;	&lt;br /&gt;
	&amp;lt;vehicle posX=&amp;quot;&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; model=&amp;quot;603&amp;quot; /&amp;gt;	&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When a gamemode is started with a map, the map resources is automatically started by the mapmanager and the information it contains can be read by the gamemode resource. When the map changes, the current map resource is stopped and the next map resource is started. For a more in-depth explanation and examples of how map resources are utilized in the main script, please visit the [[Writing Gamemodes]] page.&lt;br /&gt;
&lt;br /&gt;
===Events===&lt;br /&gt;
Events are the way MTA tells scripts about things that happen. For example when a player dies, the [[onPlayerWasted]] event is triggered. In order to perform any actions when a player dies, you have to prepare yourself similiar to adding a command handler, as shown in [[#Writing_the_script|the first chapter]].&lt;br /&gt;
&lt;br /&gt;
This example will output a message with the name of the player who died:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function playerDied(totalAmmo, killer, killerWeapon, bodypart)&lt;br /&gt;
	outputChatBox(getPlayerName(source)..&amp;quot; died!&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerWasted&amp;quot;,getRootElement(),playerDied)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead of showing what arguments are needed, the documentation page for Events shows what parameters are passed to the handler function, similiar to the way a [[#About_command_handlers|command handler]] does, just that it is different from event to event. Another important point is the ''source'' variable, that exists in handler functions. It doesn't have to be added to the parameter list of the function, but it still exists. It has a different value from event to event, for player events (as in the example above) it is the player element. As another example, you can take a look at the basic spawning player script in the first section to get an idea how ''source'' is used.&lt;br /&gt;
&lt;br /&gt;
==Where to go from here==&lt;br /&gt;
You should now be familiar with the most basic aspects of MTA scripting and also a bit with the documentation. The [[Main Page]] provides you with links to more information, Tutorials and References that allow a deeper look into the topics you desire to learn about.&lt;br /&gt;
&lt;br /&gt;
From here we recommend reading the [[debugging]] tutorial. Good debugging skills are an absolute necessity when you are making scripts.&lt;br /&gt;
&lt;br /&gt;
[[ru:Scripting Introduction]]&lt;br /&gt;
[[it:Introduzione allo scripting]]&lt;br /&gt;
[[es:Introducción a la Programación]]&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/%D9%85%D9%82%D8%AF%D9%85%D9%87_%D9%81%D9%8A_%D8%A7%D9%84%D8%A8%D8%B1%D9%85%D8%AC%D9%87&amp;diff=47524</id>
		<title>AR/مقدمه في البرمجه</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/%D9%85%D9%82%D8%AF%D9%85%D9%87_%D9%81%D9%8A_%D8%A7%D9%84%D8%A8%D8%B1%D9%85%D8%AC%D9%87&amp;diff=47524"/>
		<updated>2016-05-15T15:10:37Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p align=&amp;quot;right&amp;quot;&amp;gt;  &lt;br /&gt;
السكربتات جزء أساسي في تشغيل MTA فتستطيع بإستخدامهم إنشاء تطبيقات لتحسين اللعب ، تختلف أنواع السكربتات فمنها خريطة أو وضع للعب &amp;quot; freeroam , race , deathmatch &amp;quot; وغيرها ..&lt;br /&gt;
&lt;br /&gt;
برمجة السكربتات تعتمد على لغة البرمجة (Lua) [www.lua.org] .&lt;br /&gt;
لغة البرمجة تعتمد إعتماداً كلياً على اللغة الإنجليزية , فيجب أن تكون لديك خلفية في اللغة الإنجليزية قبل المتابعة.&lt;br /&gt;
لبرمجة سكربت ما تحتاج لمحرر .. ويفضل إستخدام محرر إحترافي لكي يسهل عليك البرمجة مثل :&lt;br /&gt;
*Notepad++ [http://notepad-plus-plus.org/download]&lt;br /&gt;
*Lua Edit [http://luaedit.sourceforge.net/ LuaEdit]&lt;br /&gt;
لكن يفضل إستخدام برنامج MTASE فهو يسهل عملية إنشاء السكربتات وبرمجتها :&lt;br /&gt;
* [[MTASE|MTA Script Editor]].'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==إنشاء سكربت ==&lt;br /&gt;
سوف نتعلم كيف نقوم بإنشاء سكربت يدخل اللاعب إلى اللعبة .. خطوة بحطوة&lt;br /&gt;
اولا لا بد من معرفة انواع ملفات السكربت    &lt;br /&gt;
                                                                                                          &lt;br /&gt;
1-Meta.xml -- يقوم هذا الملف بتعرف الملفات الموجود في السكربت للسيرفر               &lt;br /&gt;
                                                                                          &lt;br /&gt;
2-Client -- يقوم هذا الملف بتشغيل جميع أوامر المتعلقة بالاعب فقط                                       &lt;br /&gt;
&lt;br /&gt;
3-Server -- يقوم هذا الملف بتشغيل جميع الاوامر سواء كانت للسيرفر او الاعب&lt;br /&gt;
&lt;br /&gt;
===أين مسار كل البرامج النصية (السكريبتات أو المودات)؟===&lt;br /&gt;
الان نتعرف على مجلد المودات أو السكربتات.&lt;br /&gt;
اذهب إلى مجلد Multi Theft Auto واتبع المسار التالي:&lt;br /&gt;
&lt;br /&gt;
	/Your MTA Server/mods/deathmatch/resources/&lt;br /&gt;
&lt;br /&gt;
سترى الكثير من الملفات. ربما ترى مجلدات صيغتها .zip أو مجلد عادي , وجميعها يقبله الـ MTA ..&lt;br /&gt;
ولإنشاء المودات الخاصة بك: قم بعمل مجلد جديد واجعل اسمه كما تريد فمثلاً قم بتسميته &amp;quot;myserver&amp;quot; وهو الذي سنستخدمه بالبرنامج التعليمي&lt;br /&gt;
والان يجب أن يكون مسار المجلد الذي قمت بعمله هذا:&lt;br /&gt;
&lt;br /&gt;
	/Your MTA Server/mods/deathmatch/resources/myserver/&lt;br /&gt;
&lt;br /&gt;
* myserver: اسم المجلد الذي قمت بتسميته&lt;br /&gt;
&lt;br /&gt;
===تعريف السكربت (إضافة ملف meta.xml)===&lt;br /&gt;
حتى يستطيع السيرفر من معرفة المودات, يجب علينا إنشاء ملف meta.xml &lt;br /&gt;
&amp;quot; ويكون بداخل مجلد السكربت الذي قمنا بإنشائه وهو &amp;quot;myserver&amp;quot; &lt;br /&gt;
ولإنشاء ملف meta.xml : أفتح ملف نصي جديد وقم بتسميته meta.xml وافتحه باستخدام المفكرة =)&lt;br /&gt;
ولا تنسى ان يكون بداخل مجلد السكربت .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
أدخل الكود التالي في ملف ''meta.xml'':&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
     &amp;lt;info author=&amp;quot;إسمك&amp;quot; type=&amp;quot;gamemode&amp;quot; name=&amp;quot;إسم السكربت&amp;quot; description=&amp;quot;وصف بسيط للسكربت&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;script src=&amp;quot;script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
هنا يتم تعريف أجزاء السكربت فمثلاً :&lt;br /&gt;
* &amp;lt;info ..&amp;gt;&lt;br /&gt;
تضع فيه بيانات السكربت .. مثل الإسم والنوع والوصف&lt;br /&gt;
* type=&amp;quot;gamemode&amp;quot;&lt;br /&gt;
تعني أن نوع السكربت هو مود لعب وتوجد أنواع عديدة مثل :&lt;br /&gt;
**gamemode&lt;br /&gt;
**map&lt;br /&gt;
**script&lt;br /&gt;
&lt;br /&gt;
===إنشاء ملف السكربت Lua===&lt;br /&gt;
قمنا بوضع هذا السطر في :&lt;br /&gt;
*meta.xml&lt;br /&gt;
:&lt;br /&gt;
		&amp;lt;script src=&amp;quot;script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
الآن نقوم بإنشاء ملف نصي بنفس الإسم&lt;br /&gt;
**script.lua&lt;br /&gt;
بإستخدام برنامج التحرير لديك .. نقوم بإنشاء الكود&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function joinHandler() -- الوظيفة .. وبعدها نقوم بكتابة الإسم&lt;br /&gt;
	local x = 1959.55 -- تعريف x&lt;br /&gt;
	local y = -1714.46 -- تعريف y&lt;br /&gt;
	local z = 10 -- تعريف z&lt;br /&gt;
	spawnPlayer(source, x, y, z) -- نقوم بإستخدام هذه الوظيفة لإنتاج اللاعب ونقوم بتحديد اللاعب وهو المصدر : source&lt;br /&gt;
	fadeCamera(source, true) -- نقوم بعمل fade للكاميرا&lt;br /&gt;
	setCameraTarget(source, source) -- نجعل هدف الكاميرا هو اللاعب &lt;br /&gt;
	outputChatBox(&amp;quot;مرحباً بك في السيرفر&amp;quot;, source) -- نقوم بإخراج نص في الدردشة&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, getRootElement(), joinHandler) -- نقوم بإضافة المعالج حيث سيتم تشغيله بعد الحدث المحدد وهو عند دخول اللا&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
وصف وشرح الكود اعلاه : &lt;br /&gt;
	سيقوم السكربت بوضع اللاعب في الاحداثيات (x,y,z) المحدده اعلاه, عند دخوله الى السيرفر&lt;br /&gt;
	لاحظ انه يجب استخدام  وظيفة [ ''fadeCamera'' ] ستكون الشاشة سوداء وأيضاً يجب تعيين الكاميرا ( setTargetCamera ) ..&lt;br /&gt;
&lt;br /&gt;
نرى أن '''source''' هو المصدر وهو اللاعب الذي يقوم بالدخول &lt;br /&gt;
&lt;br /&gt;
*[[addEventHandler]] - الاحداث وهي ما يجب فعله من قبل المستخدم او السيرفر&lt;br /&gt;
*[[function]] - وظيفة تعمل عند حدث من الاحداث وتحتوي على امر او أوامر&lt;br /&gt;
أيضاً لو رأينا في المعالج &lt;br /&gt;
*[[addEventHandler]] - إضافة معالج للحدث&lt;br /&gt;
نرى 3 أشياء&lt;br /&gt;
*: onPlayerJoin - عند دخول اللاعب&lt;br /&gt;
وهو الحدث .. حيث يحدد متى يتم تشغيل المعالج - في هذه الحالة عند دخول اللاعب&lt;br /&gt;
*getRootElement() - جلب العنصر الحالي&lt;br /&gt;
هذا يقوم بتعيين العنصر الذي يقوم بتشغيل الحدث &lt;br /&gt;
*joinHandler &lt;br /&gt;
وهو إسم الوظيفة التي قمنا بصناعتها &lt;br /&gt;
&lt;br /&gt;
يمكنك التوسع أكثر في : [[addEventHandler]]&lt;br /&gt;
&lt;br /&gt;
===تشغيل السكربت===&lt;br /&gt;
بعد أن تقوم بحفظ أجزاء السكربت في ملف واحد ويمكن حفظه في الملفات التالية :&lt;br /&gt;
* مجلد&lt;br /&gt;
* أرشيف .zip&lt;br /&gt;
ونقوم بنسخه إلى مجلد السكربتات داخل سيرفرك ونقوم بتشغيله بالطريقة العادية.&lt;br /&gt;
&lt;br /&gt;
الآن إنتهينا من صنع السكربت .. بعد هذا سنقوم بصنع سكربت مع أمر &lt;br /&gt;
* command&lt;br /&gt;
يمكنك المتابعة أو الذهاب إلى دورة صناعة النوافذ&lt;br /&gt;
*[[Introduction to Scripting GUI]]&lt;br /&gt;
&lt;br /&gt;
===إنشاء سكربت بطريقة مفصلة===&lt;br /&gt;
&lt;br /&gt;
==صناعة أمر بسيط==&lt;br /&gt;
لنعد الآن إلى ملف&lt;br /&gt;
*script.lua&lt;br /&gt;
ونقوم بتعديله قليلاً لإنشاء أمر بسيط يقوم بإنشاء سيارة بجانب اللاعب&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- في البداية نقوم بكتب وظيفة إنشاء السيارة&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
   -- هنا نقوم بكتابة وظيفة إنشاء السيارة كـ&lt;br /&gt;
   -- createVehicle&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- نقوم بإضافة الأمر&lt;br /&gt;
addCommandHandler(&amp;quot;createvehicle&amp;quot;, createVehicleForPlayer) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
''ملاحظة: يمكنك الضغط على الوظائف والتعمق فيها بداخل الويكي.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== الوظيفة ==&lt;br /&gt;
الوظيفة هي شيء يسمى&lt;br /&gt;
&lt;br /&gt;
function&lt;br /&gt;
&lt;br /&gt;
الوظيفة هي الشيء التي يتكون عليها الحدث&lt;br /&gt;
&lt;br /&gt;
يمكنك ان تسمي الوظيفة كما شئت ويمكنك أيضاً عدم وضع اسم للوظيفة&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''مثال لـ وظيفة لها إسم'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function arabs( ) -- الوظيفة&lt;br /&gt;
    outputChatBox(&amp;quot;مرحباً بك&amp;quot;) --s  ستلاحظ بـ أن كلمة &amp;quot; مرحباً بك &amp;quot; ظهرت في الشات عند دخول الاعب &lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, root, arabs) -- .الحدث مع اسم الوظيفة&lt;br /&gt;
-- root = getRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''مثال لـ وظيفة ليس لها إسم'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerWasted&amp;quot;, root,&lt;br /&gt;
function(_,killer)&lt;br /&gt;
    outputChatBox( killer .. &amp;quot; من قبل&amp;quot; .. getPlayerName(source) .. &amp;quot; لقد قُتل الاعب&amp;quot; )&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
كما تلاحظ ووضع قوس قريباً من&lt;br /&gt;
&lt;br /&gt;
end)&lt;br /&gt;
&lt;br /&gt;
هذا القوس يكمل القوس الآخر كما نلاحظ في الحدث &lt;br /&gt;
&lt;br /&gt;
addEventHandler(&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== الحدث ==&lt;br /&gt;
الحدث هو شيء يسمى&lt;br /&gt;
&lt;br /&gt;
event&lt;br /&gt;
&lt;br /&gt;
الحدث هو الذي يتكون على بناء الوظيفة&lt;br /&gt;
فـ اذا رجعنا الى الامثلة التي في الاعلى سوف نرى عدة احداث ومنها&lt;br /&gt;
&lt;br /&gt;
[[onPlayerWasted]]&lt;br /&gt;
&lt;br /&gt;
الحدث ببساطة يحدد متى سوف تحدث او كيف سوف تحدث الوظائف التي ادخلتها&lt;br /&gt;
&lt;br /&gt;
onPlayerWasted&lt;br /&gt;
&lt;br /&gt;
عند موت الاعب&lt;br /&gt;
&lt;br /&gt;
'''مثال للحدث'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onJoin()&lt;br /&gt;
    x, y, z = getElementPosition(source) -- s يآتي بمكان الاعب x, y, z&lt;br /&gt;
	    local theVehicle = createVehicle(445, x, y, z) -- s السيارة التي سـ تصنع بمكان الاعب الذي تم تحديده مسبقاً&lt;br /&gt;
		    warpPedIntoVehicle(source, theVehicle) -- s يجعل الاعب داخل السيارة&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, root, onJoin) -- s الحدث&lt;br /&gt;
-- root = getRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
هذه الوظيفة مع هذا الحدث سوف يعطون الاعب سيارة عند دخوله السيرفر&lt;br /&gt;
&lt;br /&gt;
ملاحظة الحدث ليس دائم على الوظيفة فـ أيصاً يمكنك تكوين هذه الوظيفة على حدث آخر&lt;br /&gt;
&lt;br /&gt;
'''مثال'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onJoin()&lt;br /&gt;
    x, y, z = getElementPosition(source)&lt;br /&gt;
	    local theVehicle = createVehicle(445, x, y, z)&lt;br /&gt;
		    warpPedIntoVehicle(source, theVehicle)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerLogin&amp;quot;, root, onJoin)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
هذا سوف يعطي الاعب سيارة لاكن ليس عند دخوله السيرفر , إنما عند دخوله حسابه&lt;br /&gt;
&lt;br /&gt;
'''Edit'''&lt;br /&gt;
&lt;br /&gt;
مثال آخر&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onVehicleExplode&amp;quot;,root, -- نضيف حدث عند إنفجار اي سيارة&lt;br /&gt;
    function() -- الوظيفة&lt;br /&gt;
        setTimer(destroyElement,5000,1,source) -- يخفي السيارة بعد 5 ثواني من انفاجرها &lt;br /&gt;
    end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
يمكنك ان تجد&lt;br /&gt;
الاحداث&lt;br /&gt;
والوظائف &lt;br /&gt;
كلنت وسيرفر&lt;br /&gt;
هنا&lt;br /&gt;
&lt;br /&gt;
كلنت:&lt;br /&gt;
&lt;br /&gt;
'''وظائف كلنت'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Client_Scripting_Functions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''احداث كلنت'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Client_Scripting_Events&lt;br /&gt;
&lt;br /&gt;
سيرفر:&lt;br /&gt;
&lt;br /&gt;
'''وظائف سيرفر'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Server_Scripting_Functions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''احداث سيرفر'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Server_Scripting_Events&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== String الـ ==&lt;br /&gt;
السترنج هو شيء يوجد في بعض الوظايف التي توجد داخل الام تي اي&lt;br /&gt;
&lt;br /&gt;
مثلاً&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onResourceStart&amp;quot;,resourceRoot, -- الايفنت هنا يجب ان تكون بين سترنق كما الموضح هنا&lt;br /&gt;
    function()&lt;br /&gt;
        outputChatBox(&amp;quot;تم بدء السكربت&amp;quot;) -- s هنا سوف يظهر رسالة بالشات &amp;quot; تم بدء السكربت &amp;quot; عند بدء السكربت ويجب ان تكون سترنق&lt;br /&gt;
    end&lt;br /&gt;
) -- نهاية قوس الحدث&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
السترنق له عدة أشكال , فيمكن ان يكون كالآتي&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
أو&lt;br /&gt;
&lt;br /&gt;
' '&lt;br /&gt;
&lt;br /&gt;
أو&lt;br /&gt;
&lt;br /&gt;
[[]]&lt;br /&gt;
&lt;br /&gt;
فمثلاً اذا نريد ان نخرج رسالة بعلبة الشات&lt;br /&gt;
&lt;br /&gt;
يمكن ان تكون كذلك &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
outputChatBox([[مرحباً]])&lt;br /&gt;
&lt;br /&gt;
-- أو كذلك&lt;br /&gt;
outputChatBox('مرحباً')&lt;br /&gt;
&lt;br /&gt;
-- أو كذلك&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;مرحباً&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Command handlerعن الـ====&lt;br /&gt;
.(`) أو زر F8 التي يمكن للاعب ان يعرضها باستخدام زر Consoleهو اسم الامر الذي يمكن للاعب ان يدخله في الـ [[addCommandHandler]] في argument أول&lt;br /&gt;
&lt;br /&gt;
.&amp;quot;createVehicleForPlayer&amp;quot;هي وظيفة تُنفذ عند كتابة اللاعب الامر في هذه الحالة لـ [[addCommandHandler]] في argument ثاني&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:اذا كنت متمرس في البرمجة, ستعرف انك ستحتاج ان تنفذ وظيفة مثل&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
functionName(argument1, argument2, argument3, ..)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
functionName(thePlayer, commandName, argument3, ..)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If we have a closer look on the lower example above, we can see argument1 is thePlayer and argument2 the commandName. thePlayer is simply the one who typed the command, so whatever you call it, the variable will contain the player who activated the command. commandName is simply the command they typed. So if they typed &amp;quot;/greet&amp;quot;, this argument will contain &amp;quot;greet&amp;quot;. Argument 3 is something extra the player typed, you'll learn it a little bit further in the tutorial. Never forget that the first 2 arguments are standard arguments, but you can name them to anything you want.&lt;br /&gt;
&lt;br /&gt;
We called the [[addCommandHandler]] function this way already and since ''createVehicleForPlayer'' is a function too, it can be called that way as well. But we are using a command handler for that, which calls it in a similiar manner, internally.&lt;br /&gt;
&lt;br /&gt;
For example: Someone types &amp;quot;createvehicle 468&amp;quot; ingame in the console to spawn a Sanchez, the command handler calls the createVehicleForPlayer function, as '''if''' we would have this line of code in the script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
createVehicleForPlayer(thePlayer,&amp;quot;createvehicle&amp;quot;,&amp;quot;468&amp;quot;) -- thePlayer هو الشيء الي كتب الكومند&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
As we can see, it provides several parameters: the player who called the command, the command he entered and whatever text he had after that, in this case &amp;quot;468&amp;quot; as vehicle id for the Sanchez. The first two parameters are the same with all command handlers, which you can read on the [[addEventHandler]] page. For this fact, you always have to define at least those two parameters to use any after that (for example to process text that was entered after the command, like in our example the vehicle model id).&lt;br /&gt;
&lt;br /&gt;
''Note: You have to add the command handler AFTER you defined the handler function, else it can't find it. The order of execution matters.''&lt;br /&gt;
&lt;br /&gt;
====Writing the function====&lt;br /&gt;
In order to fill the function we created, we need to think about what we have to do:&lt;br /&gt;
* Get the players position, so we know where to spawn the vehicle (we want it to appear right beside the player)&lt;br /&gt;
* Calculate the position we want to spawn the vehicle at (we don't want it to appear in the player)&lt;br /&gt;
* Spawn the vehicle&lt;br /&gt;
* Check if it has been spawned successfully, or output a message&lt;br /&gt;
&lt;br /&gt;
In order to achieve our goals, we have to use several functions. To find function we need to use, we should visit the [[Scripting Functions|Server Functions List]]. First we need a function to get the players position. Since players are Elements, we first jump to the '''Element functions''' where we find the [[getElementPosition]] function. By clicking on the function name in the list, you get to the function description. There we can see the syntax, what it returns and usually an example. The syntax shows us what arguments we can or have to submit.&lt;br /&gt;
&lt;br /&gt;
For [[getElementPosition]], the syntax is:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float, float, float getElementPosition ( element theElement )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three ''float'' in front of the function name are the return type. In this case it means the function returns three floating point numbers. (x, y and z) Within the parentheses, you can see what arguments you have to submit. In this case only the element whose position you want to get, which is the player in our example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	-- نأتي باحداثيات المكان الي نبغي نضع فيه السيارة بشكل x, y, z&lt;br /&gt;
	-- (local  تعني ان هاد الاختصار ما رح يشغل غير في هاد الفنكشن)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we want to ensure that the vehicle won't spawn directly in the player, so we add a few units to the ''x'' variable, which will make it spawn east from the player.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) -- نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- add 5 units to the x position&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we need another function, one to spawn a vehicle. We once again search for it on the [[Scripting Functions|Server Functions List]], this time - since we are talking about vehicles - in the '''Vehicle functions''' section, where we will choose [[createVehicle]]. In this function's syntax, we only have one return type (which is more common), a vehicle element that points to the vehicle we just created. Also, we see that some arguments are enclosed within [ ] which means that those are optional.&lt;br /&gt;
&lt;br /&gt;
We already have all arguments we need for [[createVehicle]] in our function: The position we just calculated in the ''x,y,z'' variables and the model id that we provided through the command (&amp;quot;createvehicle 468&amp;quot;) and can access in the function as ''vehicleModel'' variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) --  نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- add 5 units to the x position&lt;br /&gt;
	-- create the vehicle and store the returned vehicle element in the ''createdVehicle'' variable&lt;br /&gt;
	local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course this code can be improved in many ways, but at least we want to add a check whether the vehicle was created successfully or not. As we can read on the [[createVehicle]] page under '''Returns''', the function returns ''false'' when it was unable to create the vehicle. Thus, we check the value of the ''createVehicle'' variable.&lt;br /&gt;
&lt;br /&gt;
Now we have our complete script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) --  نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- نضيف 5 وحد ل الاحداثيات X&lt;br /&gt;
	local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z)&lt;br /&gt;
	-- نشوف لو السيارة اتعملت ام لا&lt;br /&gt;
	if (createdVehicle == false) then&lt;br /&gt;
		-- لو السياره اتعملت يبقي نعمل رسالة,لكن للاعب فقط&lt;br /&gt;
		outputChatBox(&amp;quot;Failed to create vehicle.&amp;quot;,thePlayer)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;createvehicle&amp;quot;, createVehicleForPlayer)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, we introduced another function with [[outputChatBox]]. By now, you should be able to explore the function's documentation page yourself. For more advanced scripting, please check out the [[Map manager|Map Manager]].&lt;br /&gt;
&lt;br /&gt;
==What you need to know==&lt;br /&gt;
You already read some things about resources, command handlers and finding functions in the documentation in the first paragraph, but there is much more to learn. This section will give you a rather short overview over some of these things, while linking to related pages if possible.&lt;br /&gt;
===Clientside and Serverside scripts===&lt;br /&gt;
You may have already noticed these or similiar terms (Server/Client) somewhere on this wiki, mostly in conjunction with functions. MTA not only supports scripts that run on the server and provide commands (like the one we wrote above) or other features, but also scripts that run on the MTA client the players use to connect to the server. The reason for this is, that some features MTA provides have to be clientside (like a GUI - Graphical User Interface), others should be because they work better and still others are better off to be serverside or just don't work clientside.&lt;br /&gt;
&lt;br /&gt;
Most scripts you will make (gamemodes, maps) will probably be serverside, like the one we wrote in the first section. If you run into something that can't be solved serverside, you will probably have to make it clientside. For a clientside script for example, you would create a ordinary script file (for example called ''client.lua'') and specify it in the meta.xml, like this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;client.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The ''type'' attribute defaults to 'server', so you only need to specify it for clientside scripts. When you do this, the clientside script will be downloaded to the player's computer once he connects to the server. Read more about [[Client side scripts]].&lt;br /&gt;
&lt;br /&gt;
===More complex resources===&lt;br /&gt;
The previous section showed briefly how to add clientside scripts to the resource, but there is also much more possible. As mentioned at the very top of this page, resources can be pretty much everything. Their purpose is defined by what they do. Let's have some theoretical resources, by looking at the files it contains, the ''meta.xml'' and what they might do:&lt;br /&gt;
&lt;br /&gt;
====First example - A utility script====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/admin_commands&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/commands.lua&lt;br /&gt;
	/client.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;admin commands&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;commands.lua&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;client.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''commands.lua'' provides some admin commands, like banning a player, muting or something else that can be used to admin the server&lt;br /&gt;
* The ''client.lua'' provides a GUI to be able to perform the mentioned actions easily&lt;br /&gt;
&lt;br /&gt;
This example might be running all the time (maybe even auto-started when the server starts) as it's useful during the whole gaming experience and also wont interfere with the gameplay, unless an admin decides to take some action of course.&lt;br /&gt;
&lt;br /&gt;
====Second example - A gamemode====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/counterstrike&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/counterstrike.lua&lt;br /&gt;
	/buymenu.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;Counterstrike remake&amp;quot; type=&amp;quot;gamemode&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;counterstrike.lua&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;buymenu.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''counterstrike.lua'' contains similiar to the following features:&lt;br /&gt;
** Let players choose their team and spawn them&lt;br /&gt;
** Provide them with weapons, targets and instructions (maybe read from a Map, see below)&lt;br /&gt;
** Define the game's rules, e.g. when does the round end, what happens when a player dies&lt;br /&gt;
** .. and maybe some more&lt;br /&gt;
* The ''buymenu.lua'' is a clientside script and creates a menu to buy weapons&lt;br /&gt;
&lt;br /&gt;
This example can be called a gamemode, since it not only intereferes with the gameplay, but actually defines the rules of it. The ''type'' attribute indicates that this example works with the [[Map manager]], yet another resource that was written by the QA Team to manage gamemodes and map loading. It is highly recommended that you base your gamemodes on the techniques it provides.&lt;br /&gt;
&lt;br /&gt;
This also means that the gamemode probably won't run without a map. Gamemodes should always be as generic as possible. An example for a map is stated in the next example.&lt;br /&gt;
&lt;br /&gt;
====Third example - A Map====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/cs-airport&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/airport.map&lt;br /&gt;
	/airport.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;Counterstrike airport map&amp;quot; type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;counterstrike&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;map src=&amp;quot;airport.map&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;airport.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''airport.map'' in a XML file that provides information about the map to the gamemode, these may include:&lt;br /&gt;
** Where the players should spawn, with what weapons, what teams there are&lt;br /&gt;
** What the targets are&lt;br /&gt;
** Weather, World Time, Timelimit&lt;br /&gt;
** Provide vehicles&lt;br /&gt;
* The ''airport.lua'' might contain map-specific features, that may include:&lt;br /&gt;
** Opening some door/make something explode when something specific happens&lt;br /&gt;
** Create or move some custom objects, or manipulate objects that are created through the .map file&lt;br /&gt;
** .. anything else map-specific you can think of&lt;br /&gt;
&lt;br /&gt;
As you can see, the ''type'' attribute changed to 'map', telling the [[Map manager]] that this resource is a map, while the ''gamemodes'' attribute tells it for which gamemodes this map is valid, in this case the gamemode from the above example.&lt;br /&gt;
What may come as a surprise is that there is also a script in the Map resource. Of course this is not necessarily needed in a map, but opens a wide range of possibilities for map makers to create their own world within the rules of the gamemode they create it for.&lt;br /&gt;
&lt;br /&gt;
The ''airport.map'' file might look similiar to this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map mode=&amp;quot;deathmatch&amp;quot; version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;terrorists&amp;gt;&lt;br /&gt;
		&amp;lt;spawnpoint posX=&amp;quot;2332.23&amp;quot; posY=&amp;quot;-12232.33&amp;quot; posZ=&amp;quot;4.42223&amp;quot; skins=&amp;quot;23-40&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/terrorists&amp;gt;&lt;br /&gt;
	&amp;lt;counterterrorists&amp;gt;&lt;br /&gt;
		&amp;lt;spawnpoint posX=&amp;quot;2334.23443&amp;quot; posY=&amp;quot;-12300.233&amp;quot; posZ=&amp;quot;10.2344&amp;quot; skins=&amp;quot;40-50&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/counterterrorists&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;bomb posX=&amp;quot;23342.23&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
	&amp;lt;vehicle posX=&amp;quot;&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; model=&amp;quot;602&amp;quot; /&amp;gt;	&lt;br /&gt;
	&amp;lt;vehicle posX=&amp;quot;&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; model=&amp;quot;603&amp;quot; /&amp;gt;	&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When a gamemode is started with a map, the map resources is automatically started by the mapmanager and the information it contains can be read by the gamemode resource. When the map changes, the current map resource is stopped and the next map resource is started. For a more in-depth explanation and examples of how map resources are utilized in the main script, please visit the [[Writing Gamemodes]] page.&lt;br /&gt;
&lt;br /&gt;
===Events===&lt;br /&gt;
Events are the way MTA tells scripts about things that happen. For example when a player dies, the [[onPlayerWasted]] event is triggered. In order to perform any actions when a player dies, you have to prepare yourself similiar to adding a command handler, as shown in [[#Writing_the_script|the first chapter]].&lt;br /&gt;
&lt;br /&gt;
This example will output a message with the name of the player who died:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function playerDied(totalAmmo, killer, killerWeapon, bodypart)&lt;br /&gt;
	outputChatBox(getPlayerName(source)..&amp;quot; died!&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerWasted&amp;quot;,getRootElement(),playerDied)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead of showing what arguments are needed, the documentation page for Events shows what parameters are passed to the handler function, similiar to the way a [[#About_command_handlers|command handler]] does, just that it is different from event to event. Another important point is the ''source'' variable, that exists in handler functions. It doesn't have to be added to the parameter list of the function, but it still exists. It has a different value from event to event, for player events (as in the example above) it is the player element. As another example, you can take a look at the basic spawning player script in the first section to get an idea how ''source'' is used.&lt;br /&gt;
&lt;br /&gt;
==Where to go from here==&lt;br /&gt;
You should now be familiar with the most basic aspects of MTA scripting and also a bit with the documentation. The [[Main Page]] provides you with links to more information, Tutorials and References that allow a deeper look into the topics you desire to learn about.&lt;br /&gt;
&lt;br /&gt;
From here we recommend reading the [[debugging]] tutorial. Good debugging skills are an absolute necessity when you are making scripts.&lt;br /&gt;
&lt;br /&gt;
[[ru:Scripting Introduction]]&lt;br /&gt;
[[it:Introduzione allo scripting]]&lt;br /&gt;
[[es:Introducción a la Programación]]&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/%D9%85%D9%82%D8%AF%D9%85%D9%87_%D9%81%D9%8A_%D8%A7%D9%84%D8%A8%D8%B1%D9%85%D8%AC%D9%87&amp;diff=47523</id>
		<title>AR/مقدمه في البرمجه</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/%D9%85%D9%82%D8%AF%D9%85%D9%87_%D9%81%D9%8A_%D8%A7%D9%84%D8%A8%D8%B1%D9%85%D8%AC%D9%87&amp;diff=47523"/>
		<updated>2016-05-15T15:10:10Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p align=&amp;quot;right&amp;quot;&amp;gt;  &lt;br /&gt;
السكربتات جزء أساسي في تشغيل MTA فتستطيع بإستخدامهم إنشاء تطبيقات لتحسين اللعب ، تختلف أنواع السكربتات فمنها خريطة أو وضع للعب &amp;quot; freeroam , race , deathmatch &amp;quot; وغيرها ..&lt;br /&gt;
&lt;br /&gt;
برمجة السكربتات تعتمد على لغة البرمجة (Lua) [www.lua.org] .&lt;br /&gt;
لغة البرمجة تعتمد إعتماداً كلياً على اللغة الإنجليزية , فيجب أن تكون لديك خلفية في اللغة الإنجليزية قبل المتابعة.&lt;br /&gt;
لبرمجة سكربت ما تحتاج لمحرر .. ويفضل إستخدام محرر إحترافي لكي يسهل عليك البرمجة مثل :&lt;br /&gt;
*Notepad++ [http://notepad-plus-plus.org/download]&lt;br /&gt;
*Lua Edit [http://luaedit.sourceforge.net/ LuaEdit]&lt;br /&gt;
لكن يفضل إستخدام برنامج MTASE فهو يسهل عملية إنشاء السكربتات وبرمجتها :&lt;br /&gt;
* [[MTASE|MTA Script Editor]].'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==إنشاء سكربت ==&lt;br /&gt;
سوف نتعلم كيف نقوم بإنشاء سكربت يدخل اللاعب إلى اللعبة .. خطوة بحطوة&lt;br /&gt;
اولا لا بد من معرفة انواع ملفات السكربت    &lt;br /&gt;
                                                                                                          &lt;br /&gt;
1-Meta.xml -- يقوم هذا الملف بتعرف الملفات الموجود في السكربت للسيرفر                                           &lt;br /&gt;
2-Client -- يقوم هذا الملف بتشغيل جميع أوامر المتعلقة بالاعب فقط                                       &lt;br /&gt;
&lt;br /&gt;
3-Server -- يقوم هذا الملف بتشغيل جميع الاوامر سواء كانت للسيرفر او الاعب&lt;br /&gt;
&lt;br /&gt;
===أين مسار كل البرامج النصية (السكريبتات أو المودات)؟===&lt;br /&gt;
الان نتعرف على مجلد المودات أو السكربتات.&lt;br /&gt;
اذهب إلى مجلد Multi Theft Auto واتبع المسار التالي:&lt;br /&gt;
&lt;br /&gt;
	/Your MTA Server/mods/deathmatch/resources/&lt;br /&gt;
&lt;br /&gt;
سترى الكثير من الملفات. ربما ترى مجلدات صيغتها .zip أو مجلد عادي , وجميعها يقبله الـ MTA ..&lt;br /&gt;
ولإنشاء المودات الخاصة بك: قم بعمل مجلد جديد واجعل اسمه كما تريد فمثلاً قم بتسميته &amp;quot;myserver&amp;quot; وهو الذي سنستخدمه بالبرنامج التعليمي&lt;br /&gt;
والان يجب أن يكون مسار المجلد الذي قمت بعمله هذا:&lt;br /&gt;
&lt;br /&gt;
	/Your MTA Server/mods/deathmatch/resources/myserver/&lt;br /&gt;
&lt;br /&gt;
* myserver: اسم المجلد الذي قمت بتسميته&lt;br /&gt;
&lt;br /&gt;
===تعريف السكربت (إضافة ملف meta.xml)===&lt;br /&gt;
حتى يستطيع السيرفر من معرفة المودات, يجب علينا إنشاء ملف meta.xml &lt;br /&gt;
&amp;quot; ويكون بداخل مجلد السكربت الذي قمنا بإنشائه وهو &amp;quot;myserver&amp;quot; &lt;br /&gt;
ولإنشاء ملف meta.xml : أفتح ملف نصي جديد وقم بتسميته meta.xml وافتحه باستخدام المفكرة =)&lt;br /&gt;
ولا تنسى ان يكون بداخل مجلد السكربت .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
أدخل الكود التالي في ملف ''meta.xml'':&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
     &amp;lt;info author=&amp;quot;إسمك&amp;quot; type=&amp;quot;gamemode&amp;quot; name=&amp;quot;إسم السكربت&amp;quot; description=&amp;quot;وصف بسيط للسكربت&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;script src=&amp;quot;script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
هنا يتم تعريف أجزاء السكربت فمثلاً :&lt;br /&gt;
* &amp;lt;info ..&amp;gt;&lt;br /&gt;
تضع فيه بيانات السكربت .. مثل الإسم والنوع والوصف&lt;br /&gt;
* type=&amp;quot;gamemode&amp;quot;&lt;br /&gt;
تعني أن نوع السكربت هو مود لعب وتوجد أنواع عديدة مثل :&lt;br /&gt;
**gamemode&lt;br /&gt;
**map&lt;br /&gt;
**script&lt;br /&gt;
&lt;br /&gt;
===إنشاء ملف السكربت Lua===&lt;br /&gt;
قمنا بوضع هذا السطر في :&lt;br /&gt;
*meta.xml&lt;br /&gt;
:&lt;br /&gt;
		&amp;lt;script src=&amp;quot;script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
الآن نقوم بإنشاء ملف نصي بنفس الإسم&lt;br /&gt;
**script.lua&lt;br /&gt;
بإستخدام برنامج التحرير لديك .. نقوم بإنشاء الكود&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function joinHandler() -- الوظيفة .. وبعدها نقوم بكتابة الإسم&lt;br /&gt;
	local x = 1959.55 -- تعريف x&lt;br /&gt;
	local y = -1714.46 -- تعريف y&lt;br /&gt;
	local z = 10 -- تعريف z&lt;br /&gt;
	spawnPlayer(source, x, y, z) -- نقوم بإستخدام هذه الوظيفة لإنتاج اللاعب ونقوم بتحديد اللاعب وهو المصدر : source&lt;br /&gt;
	fadeCamera(source, true) -- نقوم بعمل fade للكاميرا&lt;br /&gt;
	setCameraTarget(source, source) -- نجعل هدف الكاميرا هو اللاعب &lt;br /&gt;
	outputChatBox(&amp;quot;مرحباً بك في السيرفر&amp;quot;, source) -- نقوم بإخراج نص في الدردشة&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, getRootElement(), joinHandler) -- نقوم بإضافة المعالج حيث سيتم تشغيله بعد الحدث المحدد وهو عند دخول اللا&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
وصف وشرح الكود اعلاه : &lt;br /&gt;
	سيقوم السكربت بوضع اللاعب في الاحداثيات (x,y,z) المحدده اعلاه, عند دخوله الى السيرفر&lt;br /&gt;
	لاحظ انه يجب استخدام  وظيفة [ ''fadeCamera'' ] ستكون الشاشة سوداء وأيضاً يجب تعيين الكاميرا ( setTargetCamera ) ..&lt;br /&gt;
&lt;br /&gt;
نرى أن '''source''' هو المصدر وهو اللاعب الذي يقوم بالدخول &lt;br /&gt;
&lt;br /&gt;
*[[addEventHandler]] - الاحداث وهي ما يجب فعله من قبل المستخدم او السيرفر&lt;br /&gt;
*[[function]] - وظيفة تعمل عند حدث من الاحداث وتحتوي على امر او أوامر&lt;br /&gt;
أيضاً لو رأينا في المعالج &lt;br /&gt;
*[[addEventHandler]] - إضافة معالج للحدث&lt;br /&gt;
نرى 3 أشياء&lt;br /&gt;
*: onPlayerJoin - عند دخول اللاعب&lt;br /&gt;
وهو الحدث .. حيث يحدد متى يتم تشغيل المعالج - في هذه الحالة عند دخول اللاعب&lt;br /&gt;
*getRootElement() - جلب العنصر الحالي&lt;br /&gt;
هذا يقوم بتعيين العنصر الذي يقوم بتشغيل الحدث &lt;br /&gt;
*joinHandler &lt;br /&gt;
وهو إسم الوظيفة التي قمنا بصناعتها &lt;br /&gt;
&lt;br /&gt;
يمكنك التوسع أكثر في : [[addEventHandler]]&lt;br /&gt;
&lt;br /&gt;
===تشغيل السكربت===&lt;br /&gt;
بعد أن تقوم بحفظ أجزاء السكربت في ملف واحد ويمكن حفظه في الملفات التالية :&lt;br /&gt;
* مجلد&lt;br /&gt;
* أرشيف .zip&lt;br /&gt;
ونقوم بنسخه إلى مجلد السكربتات داخل سيرفرك ونقوم بتشغيله بالطريقة العادية.&lt;br /&gt;
&lt;br /&gt;
الآن إنتهينا من صنع السكربت .. بعد هذا سنقوم بصنع سكربت مع أمر &lt;br /&gt;
* command&lt;br /&gt;
يمكنك المتابعة أو الذهاب إلى دورة صناعة النوافذ&lt;br /&gt;
*[[Introduction to Scripting GUI]]&lt;br /&gt;
&lt;br /&gt;
===إنشاء سكربت بطريقة مفصلة===&lt;br /&gt;
&lt;br /&gt;
==صناعة أمر بسيط==&lt;br /&gt;
لنعد الآن إلى ملف&lt;br /&gt;
*script.lua&lt;br /&gt;
ونقوم بتعديله قليلاً لإنشاء أمر بسيط يقوم بإنشاء سيارة بجانب اللاعب&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- في البداية نقوم بكتب وظيفة إنشاء السيارة&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
   -- هنا نقوم بكتابة وظيفة إنشاء السيارة كـ&lt;br /&gt;
   -- createVehicle&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- نقوم بإضافة الأمر&lt;br /&gt;
addCommandHandler(&amp;quot;createvehicle&amp;quot;, createVehicleForPlayer) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
''ملاحظة: يمكنك الضغط على الوظائف والتعمق فيها بداخل الويكي.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== الوظيفة ==&lt;br /&gt;
الوظيفة هي شيء يسمى&lt;br /&gt;
&lt;br /&gt;
function&lt;br /&gt;
&lt;br /&gt;
الوظيفة هي الشيء التي يتكون عليها الحدث&lt;br /&gt;
&lt;br /&gt;
يمكنك ان تسمي الوظيفة كما شئت ويمكنك أيضاً عدم وضع اسم للوظيفة&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''مثال لـ وظيفة لها إسم'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function arabs( ) -- الوظيفة&lt;br /&gt;
    outputChatBox(&amp;quot;مرحباً بك&amp;quot;) --s  ستلاحظ بـ أن كلمة &amp;quot; مرحباً بك &amp;quot; ظهرت في الشات عند دخول الاعب &lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, root, arabs) -- .الحدث مع اسم الوظيفة&lt;br /&gt;
-- root = getRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''مثال لـ وظيفة ليس لها إسم'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerWasted&amp;quot;, root,&lt;br /&gt;
function(_,killer)&lt;br /&gt;
    outputChatBox( killer .. &amp;quot; من قبل&amp;quot; .. getPlayerName(source) .. &amp;quot; لقد قُتل الاعب&amp;quot; )&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
كما تلاحظ ووضع قوس قريباً من&lt;br /&gt;
&lt;br /&gt;
end)&lt;br /&gt;
&lt;br /&gt;
هذا القوس يكمل القوس الآخر كما نلاحظ في الحدث &lt;br /&gt;
&lt;br /&gt;
addEventHandler(&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== الحدث ==&lt;br /&gt;
الحدث هو شيء يسمى&lt;br /&gt;
&lt;br /&gt;
event&lt;br /&gt;
&lt;br /&gt;
الحدث هو الذي يتكون على بناء الوظيفة&lt;br /&gt;
فـ اذا رجعنا الى الامثلة التي في الاعلى سوف نرى عدة احداث ومنها&lt;br /&gt;
&lt;br /&gt;
[[onPlayerWasted]]&lt;br /&gt;
&lt;br /&gt;
الحدث ببساطة يحدد متى سوف تحدث او كيف سوف تحدث الوظائف التي ادخلتها&lt;br /&gt;
&lt;br /&gt;
onPlayerWasted&lt;br /&gt;
&lt;br /&gt;
عند موت الاعب&lt;br /&gt;
&lt;br /&gt;
'''مثال للحدث'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onJoin()&lt;br /&gt;
    x, y, z = getElementPosition(source) -- s يآتي بمكان الاعب x, y, z&lt;br /&gt;
	    local theVehicle = createVehicle(445, x, y, z) -- s السيارة التي سـ تصنع بمكان الاعب الذي تم تحديده مسبقاً&lt;br /&gt;
		    warpPedIntoVehicle(source, theVehicle) -- s يجعل الاعب داخل السيارة&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, root, onJoin) -- s الحدث&lt;br /&gt;
-- root = getRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
هذه الوظيفة مع هذا الحدث سوف يعطون الاعب سيارة عند دخوله السيرفر&lt;br /&gt;
&lt;br /&gt;
ملاحظة الحدث ليس دائم على الوظيفة فـ أيصاً يمكنك تكوين هذه الوظيفة على حدث آخر&lt;br /&gt;
&lt;br /&gt;
'''مثال'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onJoin()&lt;br /&gt;
    x, y, z = getElementPosition(source)&lt;br /&gt;
	    local theVehicle = createVehicle(445, x, y, z)&lt;br /&gt;
		    warpPedIntoVehicle(source, theVehicle)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerLogin&amp;quot;, root, onJoin)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
هذا سوف يعطي الاعب سيارة لاكن ليس عند دخوله السيرفر , إنما عند دخوله حسابه&lt;br /&gt;
&lt;br /&gt;
'''Edit'''&lt;br /&gt;
&lt;br /&gt;
مثال آخر&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onVehicleExplode&amp;quot;,root, -- نضيف حدث عند إنفجار اي سيارة&lt;br /&gt;
    function() -- الوظيفة&lt;br /&gt;
        setTimer(destroyElement,5000,1,source) -- يخفي السيارة بعد 5 ثواني من انفاجرها &lt;br /&gt;
    end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
يمكنك ان تجد&lt;br /&gt;
الاحداث&lt;br /&gt;
والوظائف &lt;br /&gt;
كلنت وسيرفر&lt;br /&gt;
هنا&lt;br /&gt;
&lt;br /&gt;
كلنت:&lt;br /&gt;
&lt;br /&gt;
'''وظائف كلنت'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Client_Scripting_Functions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''احداث كلنت'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Client_Scripting_Events&lt;br /&gt;
&lt;br /&gt;
سيرفر:&lt;br /&gt;
&lt;br /&gt;
'''وظائف سيرفر'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Server_Scripting_Functions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''احداث سيرفر'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Server_Scripting_Events&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== String الـ ==&lt;br /&gt;
السترنج هو شيء يوجد في بعض الوظايف التي توجد داخل الام تي اي&lt;br /&gt;
&lt;br /&gt;
مثلاً&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onResourceStart&amp;quot;,resourceRoot, -- الايفنت هنا يجب ان تكون بين سترنق كما الموضح هنا&lt;br /&gt;
    function()&lt;br /&gt;
        outputChatBox(&amp;quot;تم بدء السكربت&amp;quot;) -- s هنا سوف يظهر رسالة بالشات &amp;quot; تم بدء السكربت &amp;quot; عند بدء السكربت ويجب ان تكون سترنق&lt;br /&gt;
    end&lt;br /&gt;
) -- نهاية قوس الحدث&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
السترنق له عدة أشكال , فيمكن ان يكون كالآتي&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
أو&lt;br /&gt;
&lt;br /&gt;
' '&lt;br /&gt;
&lt;br /&gt;
أو&lt;br /&gt;
&lt;br /&gt;
[[]]&lt;br /&gt;
&lt;br /&gt;
فمثلاً اذا نريد ان نخرج رسالة بعلبة الشات&lt;br /&gt;
&lt;br /&gt;
يمكن ان تكون كذلك &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
outputChatBox([[مرحباً]])&lt;br /&gt;
&lt;br /&gt;
-- أو كذلك&lt;br /&gt;
outputChatBox('مرحباً')&lt;br /&gt;
&lt;br /&gt;
-- أو كذلك&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;مرحباً&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Command handlerعن الـ====&lt;br /&gt;
.(`) أو زر F8 التي يمكن للاعب ان يعرضها باستخدام زر Consoleهو اسم الامر الذي يمكن للاعب ان يدخله في الـ [[addCommandHandler]] في argument أول&lt;br /&gt;
&lt;br /&gt;
.&amp;quot;createVehicleForPlayer&amp;quot;هي وظيفة تُنفذ عند كتابة اللاعب الامر في هذه الحالة لـ [[addCommandHandler]] في argument ثاني&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:اذا كنت متمرس في البرمجة, ستعرف انك ستحتاج ان تنفذ وظيفة مثل&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
functionName(argument1, argument2, argument3, ..)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
functionName(thePlayer, commandName, argument3, ..)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If we have a closer look on the lower example above, we can see argument1 is thePlayer and argument2 the commandName. thePlayer is simply the one who typed the command, so whatever you call it, the variable will contain the player who activated the command. commandName is simply the command they typed. So if they typed &amp;quot;/greet&amp;quot;, this argument will contain &amp;quot;greet&amp;quot;. Argument 3 is something extra the player typed, you'll learn it a little bit further in the tutorial. Never forget that the first 2 arguments are standard arguments, but you can name them to anything you want.&lt;br /&gt;
&lt;br /&gt;
We called the [[addCommandHandler]] function this way already and since ''createVehicleForPlayer'' is a function too, it can be called that way as well. But we are using a command handler for that, which calls it in a similiar manner, internally.&lt;br /&gt;
&lt;br /&gt;
For example: Someone types &amp;quot;createvehicle 468&amp;quot; ingame in the console to spawn a Sanchez, the command handler calls the createVehicleForPlayer function, as '''if''' we would have this line of code in the script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
createVehicleForPlayer(thePlayer,&amp;quot;createvehicle&amp;quot;,&amp;quot;468&amp;quot;) -- thePlayer هو الشيء الي كتب الكومند&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
As we can see, it provides several parameters: the player who called the command, the command he entered and whatever text he had after that, in this case &amp;quot;468&amp;quot; as vehicle id for the Sanchez. The first two parameters are the same with all command handlers, which you can read on the [[addEventHandler]] page. For this fact, you always have to define at least those two parameters to use any after that (for example to process text that was entered after the command, like in our example the vehicle model id).&lt;br /&gt;
&lt;br /&gt;
''Note: You have to add the command handler AFTER you defined the handler function, else it can't find it. The order of execution matters.''&lt;br /&gt;
&lt;br /&gt;
====Writing the function====&lt;br /&gt;
In order to fill the function we created, we need to think about what we have to do:&lt;br /&gt;
* Get the players position, so we know where to spawn the vehicle (we want it to appear right beside the player)&lt;br /&gt;
* Calculate the position we want to spawn the vehicle at (we don't want it to appear in the player)&lt;br /&gt;
* Spawn the vehicle&lt;br /&gt;
* Check if it has been spawned successfully, or output a message&lt;br /&gt;
&lt;br /&gt;
In order to achieve our goals, we have to use several functions. To find function we need to use, we should visit the [[Scripting Functions|Server Functions List]]. First we need a function to get the players position. Since players are Elements, we first jump to the '''Element functions''' where we find the [[getElementPosition]] function. By clicking on the function name in the list, you get to the function description. There we can see the syntax, what it returns and usually an example. The syntax shows us what arguments we can or have to submit.&lt;br /&gt;
&lt;br /&gt;
For [[getElementPosition]], the syntax is:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float, float, float getElementPosition ( element theElement )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three ''float'' in front of the function name are the return type. In this case it means the function returns three floating point numbers. (x, y and z) Within the parentheses, you can see what arguments you have to submit. In this case only the element whose position you want to get, which is the player in our example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	-- نأتي باحداثيات المكان الي نبغي نضع فيه السيارة بشكل x, y, z&lt;br /&gt;
	-- (local  تعني ان هاد الاختصار ما رح يشغل غير في هاد الفنكشن)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we want to ensure that the vehicle won't spawn directly in the player, so we add a few units to the ''x'' variable, which will make it spawn east from the player.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) -- نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- add 5 units to the x position&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we need another function, one to spawn a vehicle. We once again search for it on the [[Scripting Functions|Server Functions List]], this time - since we are talking about vehicles - in the '''Vehicle functions''' section, where we will choose [[createVehicle]]. In this function's syntax, we only have one return type (which is more common), a vehicle element that points to the vehicle we just created. Also, we see that some arguments are enclosed within [ ] which means that those are optional.&lt;br /&gt;
&lt;br /&gt;
We already have all arguments we need for [[createVehicle]] in our function: The position we just calculated in the ''x,y,z'' variables and the model id that we provided through the command (&amp;quot;createvehicle 468&amp;quot;) and can access in the function as ''vehicleModel'' variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) --  نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- add 5 units to the x position&lt;br /&gt;
	-- create the vehicle and store the returned vehicle element in the ''createdVehicle'' variable&lt;br /&gt;
	local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course this code can be improved in many ways, but at least we want to add a check whether the vehicle was created successfully or not. As we can read on the [[createVehicle]] page under '''Returns''', the function returns ''false'' when it was unable to create the vehicle. Thus, we check the value of the ''createVehicle'' variable.&lt;br /&gt;
&lt;br /&gt;
Now we have our complete script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) --  نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- نضيف 5 وحد ل الاحداثيات X&lt;br /&gt;
	local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z)&lt;br /&gt;
	-- نشوف لو السيارة اتعملت ام لا&lt;br /&gt;
	if (createdVehicle == false) then&lt;br /&gt;
		-- لو السياره اتعملت يبقي نعمل رسالة,لكن للاعب فقط&lt;br /&gt;
		outputChatBox(&amp;quot;Failed to create vehicle.&amp;quot;,thePlayer)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;createvehicle&amp;quot;, createVehicleForPlayer)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, we introduced another function with [[outputChatBox]]. By now, you should be able to explore the function's documentation page yourself. For more advanced scripting, please check out the [[Map manager|Map Manager]].&lt;br /&gt;
&lt;br /&gt;
==What you need to know==&lt;br /&gt;
You already read some things about resources, command handlers and finding functions in the documentation in the first paragraph, but there is much more to learn. This section will give you a rather short overview over some of these things, while linking to related pages if possible.&lt;br /&gt;
===Clientside and Serverside scripts===&lt;br /&gt;
You may have already noticed these or similiar terms (Server/Client) somewhere on this wiki, mostly in conjunction with functions. MTA not only supports scripts that run on the server and provide commands (like the one we wrote above) or other features, but also scripts that run on the MTA client the players use to connect to the server. The reason for this is, that some features MTA provides have to be clientside (like a GUI - Graphical User Interface), others should be because they work better and still others are better off to be serverside or just don't work clientside.&lt;br /&gt;
&lt;br /&gt;
Most scripts you will make (gamemodes, maps) will probably be serverside, like the one we wrote in the first section. If you run into something that can't be solved serverside, you will probably have to make it clientside. For a clientside script for example, you would create a ordinary script file (for example called ''client.lua'') and specify it in the meta.xml, like this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;client.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The ''type'' attribute defaults to 'server', so you only need to specify it for clientside scripts. When you do this, the clientside script will be downloaded to the player's computer once he connects to the server. Read more about [[Client side scripts]].&lt;br /&gt;
&lt;br /&gt;
===More complex resources===&lt;br /&gt;
The previous section showed briefly how to add clientside scripts to the resource, but there is also much more possible. As mentioned at the very top of this page, resources can be pretty much everything. Their purpose is defined by what they do. Let's have some theoretical resources, by looking at the files it contains, the ''meta.xml'' and what they might do:&lt;br /&gt;
&lt;br /&gt;
====First example - A utility script====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/admin_commands&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/commands.lua&lt;br /&gt;
	/client.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;admin commands&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;commands.lua&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;client.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''commands.lua'' provides some admin commands, like banning a player, muting or something else that can be used to admin the server&lt;br /&gt;
* The ''client.lua'' provides a GUI to be able to perform the mentioned actions easily&lt;br /&gt;
&lt;br /&gt;
This example might be running all the time (maybe even auto-started when the server starts) as it's useful during the whole gaming experience and also wont interfere with the gameplay, unless an admin decides to take some action of course.&lt;br /&gt;
&lt;br /&gt;
====Second example - A gamemode====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/counterstrike&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/counterstrike.lua&lt;br /&gt;
	/buymenu.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;Counterstrike remake&amp;quot; type=&amp;quot;gamemode&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;counterstrike.lua&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;buymenu.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''counterstrike.lua'' contains similiar to the following features:&lt;br /&gt;
** Let players choose their team and spawn them&lt;br /&gt;
** Provide them with weapons, targets and instructions (maybe read from a Map, see below)&lt;br /&gt;
** Define the game's rules, e.g. when does the round end, what happens when a player dies&lt;br /&gt;
** .. and maybe some more&lt;br /&gt;
* The ''buymenu.lua'' is a clientside script and creates a menu to buy weapons&lt;br /&gt;
&lt;br /&gt;
This example can be called a gamemode, since it not only intereferes with the gameplay, but actually defines the rules of it. The ''type'' attribute indicates that this example works with the [[Map manager]], yet another resource that was written by the QA Team to manage gamemodes and map loading. It is highly recommended that you base your gamemodes on the techniques it provides.&lt;br /&gt;
&lt;br /&gt;
This also means that the gamemode probably won't run without a map. Gamemodes should always be as generic as possible. An example for a map is stated in the next example.&lt;br /&gt;
&lt;br /&gt;
====Third example - A Map====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/cs-airport&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/airport.map&lt;br /&gt;
	/airport.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;Counterstrike airport map&amp;quot; type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;counterstrike&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;map src=&amp;quot;airport.map&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;airport.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''airport.map'' in a XML file that provides information about the map to the gamemode, these may include:&lt;br /&gt;
** Where the players should spawn, with what weapons, what teams there are&lt;br /&gt;
** What the targets are&lt;br /&gt;
** Weather, World Time, Timelimit&lt;br /&gt;
** Provide vehicles&lt;br /&gt;
* The ''airport.lua'' might contain map-specific features, that may include:&lt;br /&gt;
** Opening some door/make something explode when something specific happens&lt;br /&gt;
** Create or move some custom objects, or manipulate objects that are created through the .map file&lt;br /&gt;
** .. anything else map-specific you can think of&lt;br /&gt;
&lt;br /&gt;
As you can see, the ''type'' attribute changed to 'map', telling the [[Map manager]] that this resource is a map, while the ''gamemodes'' attribute tells it for which gamemodes this map is valid, in this case the gamemode from the above example.&lt;br /&gt;
What may come as a surprise is that there is also a script in the Map resource. Of course this is not necessarily needed in a map, but opens a wide range of possibilities for map makers to create their own world within the rules of the gamemode they create it for.&lt;br /&gt;
&lt;br /&gt;
The ''airport.map'' file might look similiar to this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map mode=&amp;quot;deathmatch&amp;quot; version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;terrorists&amp;gt;&lt;br /&gt;
		&amp;lt;spawnpoint posX=&amp;quot;2332.23&amp;quot; posY=&amp;quot;-12232.33&amp;quot; posZ=&amp;quot;4.42223&amp;quot; skins=&amp;quot;23-40&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/terrorists&amp;gt;&lt;br /&gt;
	&amp;lt;counterterrorists&amp;gt;&lt;br /&gt;
		&amp;lt;spawnpoint posX=&amp;quot;2334.23443&amp;quot; posY=&amp;quot;-12300.233&amp;quot; posZ=&amp;quot;10.2344&amp;quot; skins=&amp;quot;40-50&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/counterterrorists&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;bomb posX=&amp;quot;23342.23&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
	&amp;lt;vehicle posX=&amp;quot;&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; model=&amp;quot;602&amp;quot; /&amp;gt;	&lt;br /&gt;
	&amp;lt;vehicle posX=&amp;quot;&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; model=&amp;quot;603&amp;quot; /&amp;gt;	&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When a gamemode is started with a map, the map resources is automatically started by the mapmanager and the information it contains can be read by the gamemode resource. When the map changes, the current map resource is stopped and the next map resource is started. For a more in-depth explanation and examples of how map resources are utilized in the main script, please visit the [[Writing Gamemodes]] page.&lt;br /&gt;
&lt;br /&gt;
===Events===&lt;br /&gt;
Events are the way MTA tells scripts about things that happen. For example when a player dies, the [[onPlayerWasted]] event is triggered. In order to perform any actions when a player dies, you have to prepare yourself similiar to adding a command handler, as shown in [[#Writing_the_script|the first chapter]].&lt;br /&gt;
&lt;br /&gt;
This example will output a message with the name of the player who died:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function playerDied(totalAmmo, killer, killerWeapon, bodypart)&lt;br /&gt;
	outputChatBox(getPlayerName(source)..&amp;quot; died!&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerWasted&amp;quot;,getRootElement(),playerDied)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead of showing what arguments are needed, the documentation page for Events shows what parameters are passed to the handler function, similiar to the way a [[#About_command_handlers|command handler]] does, just that it is different from event to event. Another important point is the ''source'' variable, that exists in handler functions. It doesn't have to be added to the parameter list of the function, but it still exists. It has a different value from event to event, for player events (as in the example above) it is the player element. As another example, you can take a look at the basic spawning player script in the first section to get an idea how ''source'' is used.&lt;br /&gt;
&lt;br /&gt;
==Where to go from here==&lt;br /&gt;
You should now be familiar with the most basic aspects of MTA scripting and also a bit with the documentation. The [[Main Page]] provides you with links to more information, Tutorials and References that allow a deeper look into the topics you desire to learn about.&lt;br /&gt;
&lt;br /&gt;
From here we recommend reading the [[debugging]] tutorial. Good debugging skills are an absolute necessity when you are making scripts.&lt;br /&gt;
&lt;br /&gt;
[[ru:Scripting Introduction]]&lt;br /&gt;
[[it:Introduzione allo scripting]]&lt;br /&gt;
[[es:Introducción a la Programación]]&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/%D9%85%D9%82%D8%AF%D9%85%D9%87_%D9%81%D9%8A_%D8%A7%D9%84%D8%A8%D8%B1%D9%85%D8%AC%D9%87&amp;diff=47522</id>
		<title>AR/مقدمه في البرمجه</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/%D9%85%D9%82%D8%AF%D9%85%D9%87_%D9%81%D9%8A_%D8%A7%D9%84%D8%A8%D8%B1%D9%85%D8%AC%D9%87&amp;diff=47522"/>
		<updated>2016-05-15T15:09:44Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p align=&amp;quot;right&amp;quot;&amp;gt;  &lt;br /&gt;
السكربتات جزء أساسي في تشغيل MTA فتستطيع بإستخدامهم إنشاء تطبيقات لتحسين اللعب ، تختلف أنواع السكربتات فمنها خريطة أو وضع للعب &amp;quot; freeroam , race , deathmatch &amp;quot; وغيرها ..&lt;br /&gt;
&lt;br /&gt;
برمجة السكربتات تعتمد على لغة البرمجة (Lua) [www.lua.org] .&lt;br /&gt;
لغة البرمجة تعتمد إعتماداً كلياً على اللغة الإنجليزية , فيجب أن تكون لديك خلفية في اللغة الإنجليزية قبل المتابعة.&lt;br /&gt;
لبرمجة سكربت ما تحتاج لمحرر .. ويفضل إستخدام محرر إحترافي لكي يسهل عليك البرمجة مثل :&lt;br /&gt;
*Notepad++ [http://notepad-plus-plus.org/download]&lt;br /&gt;
*Lua Edit [http://luaedit.sourceforge.net/ LuaEdit]&lt;br /&gt;
لكن يفضل إستخدام برنامج MTASE فهو يسهل عملية إنشاء السكربتات وبرمجتها :&lt;br /&gt;
* [[MTASE|MTA Script Editor]].'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==إنشاء سكربت ==&lt;br /&gt;
سوف نتعلم كيف نقوم بإنشاء سكربت يدخل اللاعب إلى اللعبة .. خطوة بحطوة&lt;br /&gt;
اولا لا بد من معرفة انواع ملفات السكربت                                      &lt;br /&gt;
1-Meta.xml -- يقوم هذا الملف بتعرف الملفات الموجود في السكربت للسيرفر                                           &lt;br /&gt;
2-Client -- يقوم هذا الملف بتشغيل جميع أوامر المتعلقة بالاعب فقط                                       &lt;br /&gt;
&lt;br /&gt;
3-Server -- يقوم هذا الملف بتشغيل جميع الاوامر سواء كانت للسيرفر او الاعب&lt;br /&gt;
&lt;br /&gt;
===أين مسار كل البرامج النصية (السكريبتات أو المودات)؟===&lt;br /&gt;
الان نتعرف على مجلد المودات أو السكربتات.&lt;br /&gt;
اذهب إلى مجلد Multi Theft Auto واتبع المسار التالي:&lt;br /&gt;
&lt;br /&gt;
	/Your MTA Server/mods/deathmatch/resources/&lt;br /&gt;
&lt;br /&gt;
سترى الكثير من الملفات. ربما ترى مجلدات صيغتها .zip أو مجلد عادي , وجميعها يقبله الـ MTA ..&lt;br /&gt;
ولإنشاء المودات الخاصة بك: قم بعمل مجلد جديد واجعل اسمه كما تريد فمثلاً قم بتسميته &amp;quot;myserver&amp;quot; وهو الذي سنستخدمه بالبرنامج التعليمي&lt;br /&gt;
والان يجب أن يكون مسار المجلد الذي قمت بعمله هذا:&lt;br /&gt;
&lt;br /&gt;
	/Your MTA Server/mods/deathmatch/resources/myserver/&lt;br /&gt;
&lt;br /&gt;
* myserver: اسم المجلد الذي قمت بتسميته&lt;br /&gt;
&lt;br /&gt;
===تعريف السكربت (إضافة ملف meta.xml)===&lt;br /&gt;
حتى يستطيع السيرفر من معرفة المودات, يجب علينا إنشاء ملف meta.xml &lt;br /&gt;
&amp;quot; ويكون بداخل مجلد السكربت الذي قمنا بإنشائه وهو &amp;quot;myserver&amp;quot; &lt;br /&gt;
ولإنشاء ملف meta.xml : أفتح ملف نصي جديد وقم بتسميته meta.xml وافتحه باستخدام المفكرة =)&lt;br /&gt;
ولا تنسى ان يكون بداخل مجلد السكربت .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
أدخل الكود التالي في ملف ''meta.xml'':&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
     &amp;lt;info author=&amp;quot;إسمك&amp;quot; type=&amp;quot;gamemode&amp;quot; name=&amp;quot;إسم السكربت&amp;quot; description=&amp;quot;وصف بسيط للسكربت&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;script src=&amp;quot;script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
هنا يتم تعريف أجزاء السكربت فمثلاً :&lt;br /&gt;
* &amp;lt;info ..&amp;gt;&lt;br /&gt;
تضع فيه بيانات السكربت .. مثل الإسم والنوع والوصف&lt;br /&gt;
* type=&amp;quot;gamemode&amp;quot;&lt;br /&gt;
تعني أن نوع السكربت هو مود لعب وتوجد أنواع عديدة مثل :&lt;br /&gt;
**gamemode&lt;br /&gt;
**map&lt;br /&gt;
**script&lt;br /&gt;
&lt;br /&gt;
===إنشاء ملف السكربت Lua===&lt;br /&gt;
قمنا بوضع هذا السطر في :&lt;br /&gt;
*meta.xml&lt;br /&gt;
:&lt;br /&gt;
		&amp;lt;script src=&amp;quot;script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
الآن نقوم بإنشاء ملف نصي بنفس الإسم&lt;br /&gt;
**script.lua&lt;br /&gt;
بإستخدام برنامج التحرير لديك .. نقوم بإنشاء الكود&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function joinHandler() -- الوظيفة .. وبعدها نقوم بكتابة الإسم&lt;br /&gt;
	local x = 1959.55 -- تعريف x&lt;br /&gt;
	local y = -1714.46 -- تعريف y&lt;br /&gt;
	local z = 10 -- تعريف z&lt;br /&gt;
	spawnPlayer(source, x, y, z) -- نقوم بإستخدام هذه الوظيفة لإنتاج اللاعب ونقوم بتحديد اللاعب وهو المصدر : source&lt;br /&gt;
	fadeCamera(source, true) -- نقوم بعمل fade للكاميرا&lt;br /&gt;
	setCameraTarget(source, source) -- نجعل هدف الكاميرا هو اللاعب &lt;br /&gt;
	outputChatBox(&amp;quot;مرحباً بك في السيرفر&amp;quot;, source) -- نقوم بإخراج نص في الدردشة&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, getRootElement(), joinHandler) -- نقوم بإضافة المعالج حيث سيتم تشغيله بعد الحدث المحدد وهو عند دخول اللا&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
وصف وشرح الكود اعلاه : &lt;br /&gt;
	سيقوم السكربت بوضع اللاعب في الاحداثيات (x,y,z) المحدده اعلاه, عند دخوله الى السيرفر&lt;br /&gt;
	لاحظ انه يجب استخدام  وظيفة [ ''fadeCamera'' ] ستكون الشاشة سوداء وأيضاً يجب تعيين الكاميرا ( setTargetCamera ) ..&lt;br /&gt;
&lt;br /&gt;
نرى أن '''source''' هو المصدر وهو اللاعب الذي يقوم بالدخول &lt;br /&gt;
&lt;br /&gt;
*[[addEventHandler]] - الاحداث وهي ما يجب فعله من قبل المستخدم او السيرفر&lt;br /&gt;
*[[function]] - وظيفة تعمل عند حدث من الاحداث وتحتوي على امر او أوامر&lt;br /&gt;
أيضاً لو رأينا في المعالج &lt;br /&gt;
*[[addEventHandler]] - إضافة معالج للحدث&lt;br /&gt;
نرى 3 أشياء&lt;br /&gt;
*: onPlayerJoin - عند دخول اللاعب&lt;br /&gt;
وهو الحدث .. حيث يحدد متى يتم تشغيل المعالج - في هذه الحالة عند دخول اللاعب&lt;br /&gt;
*getRootElement() - جلب العنصر الحالي&lt;br /&gt;
هذا يقوم بتعيين العنصر الذي يقوم بتشغيل الحدث &lt;br /&gt;
*joinHandler &lt;br /&gt;
وهو إسم الوظيفة التي قمنا بصناعتها &lt;br /&gt;
&lt;br /&gt;
يمكنك التوسع أكثر في : [[addEventHandler]]&lt;br /&gt;
&lt;br /&gt;
===تشغيل السكربت===&lt;br /&gt;
بعد أن تقوم بحفظ أجزاء السكربت في ملف واحد ويمكن حفظه في الملفات التالية :&lt;br /&gt;
* مجلد&lt;br /&gt;
* أرشيف .zip&lt;br /&gt;
ونقوم بنسخه إلى مجلد السكربتات داخل سيرفرك ونقوم بتشغيله بالطريقة العادية.&lt;br /&gt;
&lt;br /&gt;
الآن إنتهينا من صنع السكربت .. بعد هذا سنقوم بصنع سكربت مع أمر &lt;br /&gt;
* command&lt;br /&gt;
يمكنك المتابعة أو الذهاب إلى دورة صناعة النوافذ&lt;br /&gt;
*[[Introduction to Scripting GUI]]&lt;br /&gt;
&lt;br /&gt;
===إنشاء سكربت بطريقة مفصلة===&lt;br /&gt;
&lt;br /&gt;
==صناعة أمر بسيط==&lt;br /&gt;
لنعد الآن إلى ملف&lt;br /&gt;
*script.lua&lt;br /&gt;
ونقوم بتعديله قليلاً لإنشاء أمر بسيط يقوم بإنشاء سيارة بجانب اللاعب&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- في البداية نقوم بكتب وظيفة إنشاء السيارة&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
   -- هنا نقوم بكتابة وظيفة إنشاء السيارة كـ&lt;br /&gt;
   -- createVehicle&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- نقوم بإضافة الأمر&lt;br /&gt;
addCommandHandler(&amp;quot;createvehicle&amp;quot;, createVehicleForPlayer) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
''ملاحظة: يمكنك الضغط على الوظائف والتعمق فيها بداخل الويكي.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== الوظيفة ==&lt;br /&gt;
الوظيفة هي شيء يسمى&lt;br /&gt;
&lt;br /&gt;
function&lt;br /&gt;
&lt;br /&gt;
الوظيفة هي الشيء التي يتكون عليها الحدث&lt;br /&gt;
&lt;br /&gt;
يمكنك ان تسمي الوظيفة كما شئت ويمكنك أيضاً عدم وضع اسم للوظيفة&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''مثال لـ وظيفة لها إسم'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function arabs( ) -- الوظيفة&lt;br /&gt;
    outputChatBox(&amp;quot;مرحباً بك&amp;quot;) --s  ستلاحظ بـ أن كلمة &amp;quot; مرحباً بك &amp;quot; ظهرت في الشات عند دخول الاعب &lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, root, arabs) -- .الحدث مع اسم الوظيفة&lt;br /&gt;
-- root = getRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''مثال لـ وظيفة ليس لها إسم'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerWasted&amp;quot;, root,&lt;br /&gt;
function(_,killer)&lt;br /&gt;
    outputChatBox( killer .. &amp;quot; من قبل&amp;quot; .. getPlayerName(source) .. &amp;quot; لقد قُتل الاعب&amp;quot; )&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
كما تلاحظ ووضع قوس قريباً من&lt;br /&gt;
&lt;br /&gt;
end)&lt;br /&gt;
&lt;br /&gt;
هذا القوس يكمل القوس الآخر كما نلاحظ في الحدث &lt;br /&gt;
&lt;br /&gt;
addEventHandler(&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== الحدث ==&lt;br /&gt;
الحدث هو شيء يسمى&lt;br /&gt;
&lt;br /&gt;
event&lt;br /&gt;
&lt;br /&gt;
الحدث هو الذي يتكون على بناء الوظيفة&lt;br /&gt;
فـ اذا رجعنا الى الامثلة التي في الاعلى سوف نرى عدة احداث ومنها&lt;br /&gt;
&lt;br /&gt;
[[onPlayerWasted]]&lt;br /&gt;
&lt;br /&gt;
الحدث ببساطة يحدد متى سوف تحدث او كيف سوف تحدث الوظائف التي ادخلتها&lt;br /&gt;
&lt;br /&gt;
onPlayerWasted&lt;br /&gt;
&lt;br /&gt;
عند موت الاعب&lt;br /&gt;
&lt;br /&gt;
'''مثال للحدث'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onJoin()&lt;br /&gt;
    x, y, z = getElementPosition(source) -- s يآتي بمكان الاعب x, y, z&lt;br /&gt;
	    local theVehicle = createVehicle(445, x, y, z) -- s السيارة التي سـ تصنع بمكان الاعب الذي تم تحديده مسبقاً&lt;br /&gt;
		    warpPedIntoVehicle(source, theVehicle) -- s يجعل الاعب داخل السيارة&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, root, onJoin) -- s الحدث&lt;br /&gt;
-- root = getRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
هذه الوظيفة مع هذا الحدث سوف يعطون الاعب سيارة عند دخوله السيرفر&lt;br /&gt;
&lt;br /&gt;
ملاحظة الحدث ليس دائم على الوظيفة فـ أيصاً يمكنك تكوين هذه الوظيفة على حدث آخر&lt;br /&gt;
&lt;br /&gt;
'''مثال'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onJoin()&lt;br /&gt;
    x, y, z = getElementPosition(source)&lt;br /&gt;
	    local theVehicle = createVehicle(445, x, y, z)&lt;br /&gt;
		    warpPedIntoVehicle(source, theVehicle)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerLogin&amp;quot;, root, onJoin)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
هذا سوف يعطي الاعب سيارة لاكن ليس عند دخوله السيرفر , إنما عند دخوله حسابه&lt;br /&gt;
&lt;br /&gt;
'''Edit'''&lt;br /&gt;
&lt;br /&gt;
مثال آخر&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onVehicleExplode&amp;quot;,root, -- نضيف حدث عند إنفجار اي سيارة&lt;br /&gt;
    function() -- الوظيفة&lt;br /&gt;
        setTimer(destroyElement,5000,1,source) -- يخفي السيارة بعد 5 ثواني من انفاجرها &lt;br /&gt;
    end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
يمكنك ان تجد&lt;br /&gt;
الاحداث&lt;br /&gt;
والوظائف &lt;br /&gt;
كلنت وسيرفر&lt;br /&gt;
هنا&lt;br /&gt;
&lt;br /&gt;
كلنت:&lt;br /&gt;
&lt;br /&gt;
'''وظائف كلنت'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Client_Scripting_Functions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''احداث كلنت'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Client_Scripting_Events&lt;br /&gt;
&lt;br /&gt;
سيرفر:&lt;br /&gt;
&lt;br /&gt;
'''وظائف سيرفر'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Server_Scripting_Functions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''احداث سيرفر'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Server_Scripting_Events&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== String الـ ==&lt;br /&gt;
السترنج هو شيء يوجد في بعض الوظايف التي توجد داخل الام تي اي&lt;br /&gt;
&lt;br /&gt;
مثلاً&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onResourceStart&amp;quot;,resourceRoot, -- الايفنت هنا يجب ان تكون بين سترنق كما الموضح هنا&lt;br /&gt;
    function()&lt;br /&gt;
        outputChatBox(&amp;quot;تم بدء السكربت&amp;quot;) -- s هنا سوف يظهر رسالة بالشات &amp;quot; تم بدء السكربت &amp;quot; عند بدء السكربت ويجب ان تكون سترنق&lt;br /&gt;
    end&lt;br /&gt;
) -- نهاية قوس الحدث&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
السترنق له عدة أشكال , فيمكن ان يكون كالآتي&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
أو&lt;br /&gt;
&lt;br /&gt;
' '&lt;br /&gt;
&lt;br /&gt;
أو&lt;br /&gt;
&lt;br /&gt;
[[]]&lt;br /&gt;
&lt;br /&gt;
فمثلاً اذا نريد ان نخرج رسالة بعلبة الشات&lt;br /&gt;
&lt;br /&gt;
يمكن ان تكون كذلك &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
outputChatBox([[مرحباً]])&lt;br /&gt;
&lt;br /&gt;
-- أو كذلك&lt;br /&gt;
outputChatBox('مرحباً')&lt;br /&gt;
&lt;br /&gt;
-- أو كذلك&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;مرحباً&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Command handlerعن الـ====&lt;br /&gt;
.(`) أو زر F8 التي يمكن للاعب ان يعرضها باستخدام زر Consoleهو اسم الامر الذي يمكن للاعب ان يدخله في الـ [[addCommandHandler]] في argument أول&lt;br /&gt;
&lt;br /&gt;
.&amp;quot;createVehicleForPlayer&amp;quot;هي وظيفة تُنفذ عند كتابة اللاعب الامر في هذه الحالة لـ [[addCommandHandler]] في argument ثاني&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:اذا كنت متمرس في البرمجة, ستعرف انك ستحتاج ان تنفذ وظيفة مثل&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
functionName(argument1, argument2, argument3, ..)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
functionName(thePlayer, commandName, argument3, ..)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If we have a closer look on the lower example above, we can see argument1 is thePlayer and argument2 the commandName. thePlayer is simply the one who typed the command, so whatever you call it, the variable will contain the player who activated the command. commandName is simply the command they typed. So if they typed &amp;quot;/greet&amp;quot;, this argument will contain &amp;quot;greet&amp;quot;. Argument 3 is something extra the player typed, you'll learn it a little bit further in the tutorial. Never forget that the first 2 arguments are standard arguments, but you can name them to anything you want.&lt;br /&gt;
&lt;br /&gt;
We called the [[addCommandHandler]] function this way already and since ''createVehicleForPlayer'' is a function too, it can be called that way as well. But we are using a command handler for that, which calls it in a similiar manner, internally.&lt;br /&gt;
&lt;br /&gt;
For example: Someone types &amp;quot;createvehicle 468&amp;quot; ingame in the console to spawn a Sanchez, the command handler calls the createVehicleForPlayer function, as '''if''' we would have this line of code in the script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
createVehicleForPlayer(thePlayer,&amp;quot;createvehicle&amp;quot;,&amp;quot;468&amp;quot;) -- thePlayer هو الشيء الي كتب الكومند&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
As we can see, it provides several parameters: the player who called the command, the command he entered and whatever text he had after that, in this case &amp;quot;468&amp;quot; as vehicle id for the Sanchez. The first two parameters are the same with all command handlers, which you can read on the [[addEventHandler]] page. For this fact, you always have to define at least those two parameters to use any after that (for example to process text that was entered after the command, like in our example the vehicle model id).&lt;br /&gt;
&lt;br /&gt;
''Note: You have to add the command handler AFTER you defined the handler function, else it can't find it. The order of execution matters.''&lt;br /&gt;
&lt;br /&gt;
====Writing the function====&lt;br /&gt;
In order to fill the function we created, we need to think about what we have to do:&lt;br /&gt;
* Get the players position, so we know where to spawn the vehicle (we want it to appear right beside the player)&lt;br /&gt;
* Calculate the position we want to spawn the vehicle at (we don't want it to appear in the player)&lt;br /&gt;
* Spawn the vehicle&lt;br /&gt;
* Check if it has been spawned successfully, or output a message&lt;br /&gt;
&lt;br /&gt;
In order to achieve our goals, we have to use several functions. To find function we need to use, we should visit the [[Scripting Functions|Server Functions List]]. First we need a function to get the players position. Since players are Elements, we first jump to the '''Element functions''' where we find the [[getElementPosition]] function. By clicking on the function name in the list, you get to the function description. There we can see the syntax, what it returns and usually an example. The syntax shows us what arguments we can or have to submit.&lt;br /&gt;
&lt;br /&gt;
For [[getElementPosition]], the syntax is:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float, float, float getElementPosition ( element theElement )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three ''float'' in front of the function name are the return type. In this case it means the function returns three floating point numbers. (x, y and z) Within the parentheses, you can see what arguments you have to submit. In this case only the element whose position you want to get, which is the player in our example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	-- نأتي باحداثيات المكان الي نبغي نضع فيه السيارة بشكل x, y, z&lt;br /&gt;
	-- (local  تعني ان هاد الاختصار ما رح يشغل غير في هاد الفنكشن)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we want to ensure that the vehicle won't spawn directly in the player, so we add a few units to the ''x'' variable, which will make it spawn east from the player.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) -- نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- add 5 units to the x position&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we need another function, one to spawn a vehicle. We once again search for it on the [[Scripting Functions|Server Functions List]], this time - since we are talking about vehicles - in the '''Vehicle functions''' section, where we will choose [[createVehicle]]. In this function's syntax, we only have one return type (which is more common), a vehicle element that points to the vehicle we just created. Also, we see that some arguments are enclosed within [ ] which means that those are optional.&lt;br /&gt;
&lt;br /&gt;
We already have all arguments we need for [[createVehicle]] in our function: The position we just calculated in the ''x,y,z'' variables and the model id that we provided through the command (&amp;quot;createvehicle 468&amp;quot;) and can access in the function as ''vehicleModel'' variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) --  نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- add 5 units to the x position&lt;br /&gt;
	-- create the vehicle and store the returned vehicle element in the ''createdVehicle'' variable&lt;br /&gt;
	local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course this code can be improved in many ways, but at least we want to add a check whether the vehicle was created successfully or not. As we can read on the [[createVehicle]] page under '''Returns''', the function returns ''false'' when it was unable to create the vehicle. Thus, we check the value of the ''createVehicle'' variable.&lt;br /&gt;
&lt;br /&gt;
Now we have our complete script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) --  نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- نضيف 5 وحد ل الاحداثيات X&lt;br /&gt;
	local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z)&lt;br /&gt;
	-- نشوف لو السيارة اتعملت ام لا&lt;br /&gt;
	if (createdVehicle == false) then&lt;br /&gt;
		-- لو السياره اتعملت يبقي نعمل رسالة,لكن للاعب فقط&lt;br /&gt;
		outputChatBox(&amp;quot;Failed to create vehicle.&amp;quot;,thePlayer)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;createvehicle&amp;quot;, createVehicleForPlayer)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, we introduced another function with [[outputChatBox]]. By now, you should be able to explore the function's documentation page yourself. For more advanced scripting, please check out the [[Map manager|Map Manager]].&lt;br /&gt;
&lt;br /&gt;
==What you need to know==&lt;br /&gt;
You already read some things about resources, command handlers and finding functions in the documentation in the first paragraph, but there is much more to learn. This section will give you a rather short overview over some of these things, while linking to related pages if possible.&lt;br /&gt;
===Clientside and Serverside scripts===&lt;br /&gt;
You may have already noticed these or similiar terms (Server/Client) somewhere on this wiki, mostly in conjunction with functions. MTA not only supports scripts that run on the server and provide commands (like the one we wrote above) or other features, but also scripts that run on the MTA client the players use to connect to the server. The reason for this is, that some features MTA provides have to be clientside (like a GUI - Graphical User Interface), others should be because they work better and still others are better off to be serverside or just don't work clientside.&lt;br /&gt;
&lt;br /&gt;
Most scripts you will make (gamemodes, maps) will probably be serverside, like the one we wrote in the first section. If you run into something that can't be solved serverside, you will probably have to make it clientside. For a clientside script for example, you would create a ordinary script file (for example called ''client.lua'') and specify it in the meta.xml, like this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;client.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The ''type'' attribute defaults to 'server', so you only need to specify it for clientside scripts. When you do this, the clientside script will be downloaded to the player's computer once he connects to the server. Read more about [[Client side scripts]].&lt;br /&gt;
&lt;br /&gt;
===More complex resources===&lt;br /&gt;
The previous section showed briefly how to add clientside scripts to the resource, but there is also much more possible. As mentioned at the very top of this page, resources can be pretty much everything. Their purpose is defined by what they do. Let's have some theoretical resources, by looking at the files it contains, the ''meta.xml'' and what they might do:&lt;br /&gt;
&lt;br /&gt;
====First example - A utility script====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/admin_commands&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/commands.lua&lt;br /&gt;
	/client.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;admin commands&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;commands.lua&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;client.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''commands.lua'' provides some admin commands, like banning a player, muting or something else that can be used to admin the server&lt;br /&gt;
* The ''client.lua'' provides a GUI to be able to perform the mentioned actions easily&lt;br /&gt;
&lt;br /&gt;
This example might be running all the time (maybe even auto-started when the server starts) as it's useful during the whole gaming experience and also wont interfere with the gameplay, unless an admin decides to take some action of course.&lt;br /&gt;
&lt;br /&gt;
====Second example - A gamemode====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/counterstrike&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/counterstrike.lua&lt;br /&gt;
	/buymenu.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;Counterstrike remake&amp;quot; type=&amp;quot;gamemode&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;counterstrike.lua&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;buymenu.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''counterstrike.lua'' contains similiar to the following features:&lt;br /&gt;
** Let players choose their team and spawn them&lt;br /&gt;
** Provide them with weapons, targets and instructions (maybe read from a Map, see below)&lt;br /&gt;
** Define the game's rules, e.g. when does the round end, what happens when a player dies&lt;br /&gt;
** .. and maybe some more&lt;br /&gt;
* The ''buymenu.lua'' is a clientside script and creates a menu to buy weapons&lt;br /&gt;
&lt;br /&gt;
This example can be called a gamemode, since it not only intereferes with the gameplay, but actually defines the rules of it. The ''type'' attribute indicates that this example works with the [[Map manager]], yet another resource that was written by the QA Team to manage gamemodes and map loading. It is highly recommended that you base your gamemodes on the techniques it provides.&lt;br /&gt;
&lt;br /&gt;
This also means that the gamemode probably won't run without a map. Gamemodes should always be as generic as possible. An example for a map is stated in the next example.&lt;br /&gt;
&lt;br /&gt;
====Third example - A Map====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/cs-airport&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/airport.map&lt;br /&gt;
	/airport.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;Counterstrike airport map&amp;quot; type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;counterstrike&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;map src=&amp;quot;airport.map&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;airport.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''airport.map'' in a XML file that provides information about the map to the gamemode, these may include:&lt;br /&gt;
** Where the players should spawn, with what weapons, what teams there are&lt;br /&gt;
** What the targets are&lt;br /&gt;
** Weather, World Time, Timelimit&lt;br /&gt;
** Provide vehicles&lt;br /&gt;
* The ''airport.lua'' might contain map-specific features, that may include:&lt;br /&gt;
** Opening some door/make something explode when something specific happens&lt;br /&gt;
** Create or move some custom objects, or manipulate objects that are created through the .map file&lt;br /&gt;
** .. anything else map-specific you can think of&lt;br /&gt;
&lt;br /&gt;
As you can see, the ''type'' attribute changed to 'map', telling the [[Map manager]] that this resource is a map, while the ''gamemodes'' attribute tells it for which gamemodes this map is valid, in this case the gamemode from the above example.&lt;br /&gt;
What may come as a surprise is that there is also a script in the Map resource. Of course this is not necessarily needed in a map, but opens a wide range of possibilities for map makers to create their own world within the rules of the gamemode they create it for.&lt;br /&gt;
&lt;br /&gt;
The ''airport.map'' file might look similiar to this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map mode=&amp;quot;deathmatch&amp;quot; version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;terrorists&amp;gt;&lt;br /&gt;
		&amp;lt;spawnpoint posX=&amp;quot;2332.23&amp;quot; posY=&amp;quot;-12232.33&amp;quot; posZ=&amp;quot;4.42223&amp;quot; skins=&amp;quot;23-40&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/terrorists&amp;gt;&lt;br /&gt;
	&amp;lt;counterterrorists&amp;gt;&lt;br /&gt;
		&amp;lt;spawnpoint posX=&amp;quot;2334.23443&amp;quot; posY=&amp;quot;-12300.233&amp;quot; posZ=&amp;quot;10.2344&amp;quot; skins=&amp;quot;40-50&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/counterterrorists&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;bomb posX=&amp;quot;23342.23&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
	&amp;lt;vehicle posX=&amp;quot;&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; model=&amp;quot;602&amp;quot; /&amp;gt;	&lt;br /&gt;
	&amp;lt;vehicle posX=&amp;quot;&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; model=&amp;quot;603&amp;quot; /&amp;gt;	&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When a gamemode is started with a map, the map resources is automatically started by the mapmanager and the information it contains can be read by the gamemode resource. When the map changes, the current map resource is stopped and the next map resource is started. For a more in-depth explanation and examples of how map resources are utilized in the main script, please visit the [[Writing Gamemodes]] page.&lt;br /&gt;
&lt;br /&gt;
===Events===&lt;br /&gt;
Events are the way MTA tells scripts about things that happen. For example when a player dies, the [[onPlayerWasted]] event is triggered. In order to perform any actions when a player dies, you have to prepare yourself similiar to adding a command handler, as shown in [[#Writing_the_script|the first chapter]].&lt;br /&gt;
&lt;br /&gt;
This example will output a message with the name of the player who died:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function playerDied(totalAmmo, killer, killerWeapon, bodypart)&lt;br /&gt;
	outputChatBox(getPlayerName(source)..&amp;quot; died!&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerWasted&amp;quot;,getRootElement(),playerDied)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead of showing what arguments are needed, the documentation page for Events shows what parameters are passed to the handler function, similiar to the way a [[#About_command_handlers|command handler]] does, just that it is different from event to event. Another important point is the ''source'' variable, that exists in handler functions. It doesn't have to be added to the parameter list of the function, but it still exists. It has a different value from event to event, for player events (as in the example above) it is the player element. As another example, you can take a look at the basic spawning player script in the first section to get an idea how ''source'' is used.&lt;br /&gt;
&lt;br /&gt;
==Where to go from here==&lt;br /&gt;
You should now be familiar with the most basic aspects of MTA scripting and also a bit with the documentation. The [[Main Page]] provides you with links to more information, Tutorials and References that allow a deeper look into the topics you desire to learn about.&lt;br /&gt;
&lt;br /&gt;
From here we recommend reading the [[debugging]] tutorial. Good debugging skills are an absolute necessity when you are making scripts.&lt;br /&gt;
&lt;br /&gt;
[[ru:Scripting Introduction]]&lt;br /&gt;
[[it:Introduzione allo scripting]]&lt;br /&gt;
[[es:Introducción a la Programación]]&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/%D9%85%D9%82%D8%AF%D9%85%D9%87_%D9%81%D9%8A_%D8%A7%D9%84%D8%A8%D8%B1%D9%85%D8%AC%D9%87&amp;diff=47521</id>
		<title>AR/مقدمه في البرمجه</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/%D9%85%D9%82%D8%AF%D9%85%D9%87_%D9%81%D9%8A_%D8%A7%D9%84%D8%A8%D8%B1%D9%85%D8%AC%D9%87&amp;diff=47521"/>
		<updated>2016-05-15T15:08:52Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p align=&amp;quot;right&amp;quot;&amp;gt;  &lt;br /&gt;
السكربتات جزء أساسي في تشغيل MTA فتستطيع بإستخدامهم إنشاء تطبيقات لتحسين اللعب ، تختلف أنواع السكربتات فمنها خريطة أو وضع للعب &amp;quot; freeroam , race , deathmatch &amp;quot; وغيرها ..&lt;br /&gt;
&lt;br /&gt;
برمجة السكربتات تعتمد على لغة البرمجة (Lua) [www.lua.org] .&lt;br /&gt;
لغة البرمجة تعتمد إعتماداً كلياً على اللغة الإنجليزية , فيجب أن تكون لديك خلفية في اللغة الإنجليزية قبل المتابعة.&lt;br /&gt;
لبرمجة سكربت ما تحتاج لمحرر .. ويفضل إستخدام محرر إحترافي لكي يسهل عليك البرمجة مثل :&lt;br /&gt;
*Notepad++ [http://notepad-plus-plus.org/download]&lt;br /&gt;
*Lua Edit [http://luaedit.sourceforge.net/ LuaEdit]&lt;br /&gt;
لكن يفضل إستخدام برنامج MTASE فهو يسهل عملية إنشاء السكربتات وبرمجتها :&lt;br /&gt;
* [[MTASE|MTA Script Editor]].'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==إنشاء سكربت ==&lt;br /&gt;
سوف نتعلم كيف نقوم بإنشاء سكربت يدخل اللاعب إلى اللعبة .. خطوة بحطوة&lt;br /&gt;
اولا للابد من معرفة انواع ملفات السكربت&lt;br /&gt;
1-Meta.xml -- يقوم هذا الملف بتعرف الملفات الموجود في السكربت للسيرفر                                           &lt;br /&gt;
2-Client -- يقوم هذا الملف بتشغيل جميع أوامر المتعلقة بالاعب فقط                                       &lt;br /&gt;
&lt;br /&gt;
3-Server -- يقوم هذا الملف بتشغيل جميع الاوامر سواء كانت للسيرفر او الاعب&lt;br /&gt;
&lt;br /&gt;
===أين مسار كل البرامج النصية (السكريبتات أو المودات)؟===&lt;br /&gt;
الان نتعرف على مجلد المودات أو السكربتات.&lt;br /&gt;
اذهب إلى مجلد Multi Theft Auto واتبع المسار التالي:&lt;br /&gt;
&lt;br /&gt;
	/Your MTA Server/mods/deathmatch/resources/&lt;br /&gt;
&lt;br /&gt;
سترى الكثير من الملفات. ربما ترى مجلدات صيغتها .zip أو مجلد عادي , وجميعها يقبله الـ MTA ..&lt;br /&gt;
ولإنشاء المودات الخاصة بك: قم بعمل مجلد جديد واجعل اسمه كما تريد فمثلاً قم بتسميته &amp;quot;myserver&amp;quot; وهو الذي سنستخدمه بالبرنامج التعليمي&lt;br /&gt;
والان يجب أن يكون مسار المجلد الذي قمت بعمله هذا:&lt;br /&gt;
&lt;br /&gt;
	/Your MTA Server/mods/deathmatch/resources/myserver/&lt;br /&gt;
&lt;br /&gt;
* myserver: اسم المجلد الذي قمت بتسميته&lt;br /&gt;
&lt;br /&gt;
===تعريف السكربت (إضافة ملف meta.xml)===&lt;br /&gt;
حتى يستطيع السيرفر من معرفة المودات, يجب علينا إنشاء ملف meta.xml &lt;br /&gt;
&amp;quot; ويكون بداخل مجلد السكربت الذي قمنا بإنشائه وهو &amp;quot;myserver&amp;quot; &lt;br /&gt;
ولإنشاء ملف meta.xml : أفتح ملف نصي جديد وقم بتسميته meta.xml وافتحه باستخدام المفكرة =)&lt;br /&gt;
ولا تنسى ان يكون بداخل مجلد السكربت .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
أدخل الكود التالي في ملف ''meta.xml'':&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
     &amp;lt;info author=&amp;quot;إسمك&amp;quot; type=&amp;quot;gamemode&amp;quot; name=&amp;quot;إسم السكربت&amp;quot; description=&amp;quot;وصف بسيط للسكربت&amp;quot; /&amp;gt;&lt;br /&gt;
     &amp;lt;script src=&amp;quot;script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
هنا يتم تعريف أجزاء السكربت فمثلاً :&lt;br /&gt;
* &amp;lt;info ..&amp;gt;&lt;br /&gt;
تضع فيه بيانات السكربت .. مثل الإسم والنوع والوصف&lt;br /&gt;
* type=&amp;quot;gamemode&amp;quot;&lt;br /&gt;
تعني أن نوع السكربت هو مود لعب وتوجد أنواع عديدة مثل :&lt;br /&gt;
**gamemode&lt;br /&gt;
**map&lt;br /&gt;
**script&lt;br /&gt;
&lt;br /&gt;
===إنشاء ملف السكربت Lua===&lt;br /&gt;
قمنا بوضع هذا السطر في :&lt;br /&gt;
*meta.xml&lt;br /&gt;
:&lt;br /&gt;
		&amp;lt;script src=&amp;quot;script.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
الآن نقوم بإنشاء ملف نصي بنفس الإسم&lt;br /&gt;
**script.lua&lt;br /&gt;
بإستخدام برنامج التحرير لديك .. نقوم بإنشاء الكود&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function joinHandler() -- الوظيفة .. وبعدها نقوم بكتابة الإسم&lt;br /&gt;
	local x = 1959.55 -- تعريف x&lt;br /&gt;
	local y = -1714.46 -- تعريف y&lt;br /&gt;
	local z = 10 -- تعريف z&lt;br /&gt;
	spawnPlayer(source, x, y, z) -- نقوم بإستخدام هذه الوظيفة لإنتاج اللاعب ونقوم بتحديد اللاعب وهو المصدر : source&lt;br /&gt;
	fadeCamera(source, true) -- نقوم بعمل fade للكاميرا&lt;br /&gt;
	setCameraTarget(source, source) -- نجعل هدف الكاميرا هو اللاعب &lt;br /&gt;
	outputChatBox(&amp;quot;مرحباً بك في السيرفر&amp;quot;, source) -- نقوم بإخراج نص في الدردشة&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, getRootElement(), joinHandler) -- نقوم بإضافة المعالج حيث سيتم تشغيله بعد الحدث المحدد وهو عند دخول اللا&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
وصف وشرح الكود اعلاه : &lt;br /&gt;
	سيقوم السكربت بوضع اللاعب في الاحداثيات (x,y,z) المحدده اعلاه, عند دخوله الى السيرفر&lt;br /&gt;
	لاحظ انه يجب استخدام  وظيفة [ ''fadeCamera'' ] ستكون الشاشة سوداء وأيضاً يجب تعيين الكاميرا ( setTargetCamera ) ..&lt;br /&gt;
&lt;br /&gt;
نرى أن '''source''' هو المصدر وهو اللاعب الذي يقوم بالدخول &lt;br /&gt;
&lt;br /&gt;
*[[addEventHandler]] - الاحداث وهي ما يجب فعله من قبل المستخدم او السيرفر&lt;br /&gt;
*[[function]] - وظيفة تعمل عند حدث من الاحداث وتحتوي على امر او أوامر&lt;br /&gt;
أيضاً لو رأينا في المعالج &lt;br /&gt;
*[[addEventHandler]] - إضافة معالج للحدث&lt;br /&gt;
نرى 3 أشياء&lt;br /&gt;
*: onPlayerJoin - عند دخول اللاعب&lt;br /&gt;
وهو الحدث .. حيث يحدد متى يتم تشغيل المعالج - في هذه الحالة عند دخول اللاعب&lt;br /&gt;
*getRootElement() - جلب العنصر الحالي&lt;br /&gt;
هذا يقوم بتعيين العنصر الذي يقوم بتشغيل الحدث &lt;br /&gt;
*joinHandler &lt;br /&gt;
وهو إسم الوظيفة التي قمنا بصناعتها &lt;br /&gt;
&lt;br /&gt;
يمكنك التوسع أكثر في : [[addEventHandler]]&lt;br /&gt;
&lt;br /&gt;
===تشغيل السكربت===&lt;br /&gt;
بعد أن تقوم بحفظ أجزاء السكربت في ملف واحد ويمكن حفظه في الملفات التالية :&lt;br /&gt;
* مجلد&lt;br /&gt;
* أرشيف .zip&lt;br /&gt;
ونقوم بنسخه إلى مجلد السكربتات داخل سيرفرك ونقوم بتشغيله بالطريقة العادية.&lt;br /&gt;
&lt;br /&gt;
الآن إنتهينا من صنع السكربت .. بعد هذا سنقوم بصنع سكربت مع أمر &lt;br /&gt;
* command&lt;br /&gt;
يمكنك المتابعة أو الذهاب إلى دورة صناعة النوافذ&lt;br /&gt;
*[[Introduction to Scripting GUI]]&lt;br /&gt;
&lt;br /&gt;
===إنشاء سكربت بطريقة مفصلة===&lt;br /&gt;
&lt;br /&gt;
==صناعة أمر بسيط==&lt;br /&gt;
لنعد الآن إلى ملف&lt;br /&gt;
*script.lua&lt;br /&gt;
ونقوم بتعديله قليلاً لإنشاء أمر بسيط يقوم بإنشاء سيارة بجانب اللاعب&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- في البداية نقوم بكتب وظيفة إنشاء السيارة&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
   -- هنا نقوم بكتابة وظيفة إنشاء السيارة كـ&lt;br /&gt;
   -- createVehicle&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- نقوم بإضافة الأمر&lt;br /&gt;
addCommandHandler(&amp;quot;createvehicle&amp;quot;, createVehicleForPlayer) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
''ملاحظة: يمكنك الضغط على الوظائف والتعمق فيها بداخل الويكي.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== الوظيفة ==&lt;br /&gt;
الوظيفة هي شيء يسمى&lt;br /&gt;
&lt;br /&gt;
function&lt;br /&gt;
&lt;br /&gt;
الوظيفة هي الشيء التي يتكون عليها الحدث&lt;br /&gt;
&lt;br /&gt;
يمكنك ان تسمي الوظيفة كما شئت ويمكنك أيضاً عدم وضع اسم للوظيفة&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''مثال لـ وظيفة لها إسم'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function arabs( ) -- الوظيفة&lt;br /&gt;
    outputChatBox(&amp;quot;مرحباً بك&amp;quot;) --s  ستلاحظ بـ أن كلمة &amp;quot; مرحباً بك &amp;quot; ظهرت في الشات عند دخول الاعب &lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, root, arabs) -- .الحدث مع اسم الوظيفة&lt;br /&gt;
-- root = getRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''مثال لـ وظيفة ليس لها إسم'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerWasted&amp;quot;, root,&lt;br /&gt;
function(_,killer)&lt;br /&gt;
    outputChatBox( killer .. &amp;quot; من قبل&amp;quot; .. getPlayerName(source) .. &amp;quot; لقد قُتل الاعب&amp;quot; )&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
كما تلاحظ ووضع قوس قريباً من&lt;br /&gt;
&lt;br /&gt;
end)&lt;br /&gt;
&lt;br /&gt;
هذا القوس يكمل القوس الآخر كما نلاحظ في الحدث &lt;br /&gt;
&lt;br /&gt;
addEventHandler(&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== الحدث ==&lt;br /&gt;
الحدث هو شيء يسمى&lt;br /&gt;
&lt;br /&gt;
event&lt;br /&gt;
&lt;br /&gt;
الحدث هو الذي يتكون على بناء الوظيفة&lt;br /&gt;
فـ اذا رجعنا الى الامثلة التي في الاعلى سوف نرى عدة احداث ومنها&lt;br /&gt;
&lt;br /&gt;
[[onPlayerWasted]]&lt;br /&gt;
&lt;br /&gt;
الحدث ببساطة يحدد متى سوف تحدث او كيف سوف تحدث الوظائف التي ادخلتها&lt;br /&gt;
&lt;br /&gt;
onPlayerWasted&lt;br /&gt;
&lt;br /&gt;
عند موت الاعب&lt;br /&gt;
&lt;br /&gt;
'''مثال للحدث'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onJoin()&lt;br /&gt;
    x, y, z = getElementPosition(source) -- s يآتي بمكان الاعب x, y, z&lt;br /&gt;
	    local theVehicle = createVehicle(445, x, y, z) -- s السيارة التي سـ تصنع بمكان الاعب الذي تم تحديده مسبقاً&lt;br /&gt;
		    warpPedIntoVehicle(source, theVehicle) -- s يجعل الاعب داخل السيارة&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, root, onJoin) -- s الحدث&lt;br /&gt;
-- root = getRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
هذه الوظيفة مع هذا الحدث سوف يعطون الاعب سيارة عند دخوله السيرفر&lt;br /&gt;
&lt;br /&gt;
ملاحظة الحدث ليس دائم على الوظيفة فـ أيصاً يمكنك تكوين هذه الوظيفة على حدث آخر&lt;br /&gt;
&lt;br /&gt;
'''مثال'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onJoin()&lt;br /&gt;
    x, y, z = getElementPosition(source)&lt;br /&gt;
	    local theVehicle = createVehicle(445, x, y, z)&lt;br /&gt;
		    warpPedIntoVehicle(source, theVehicle)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerLogin&amp;quot;, root, onJoin)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
هذا سوف يعطي الاعب سيارة لاكن ليس عند دخوله السيرفر , إنما عند دخوله حسابه&lt;br /&gt;
&lt;br /&gt;
'''Edit'''&lt;br /&gt;
&lt;br /&gt;
مثال آخر&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onVehicleExplode&amp;quot;,root, -- نضيف حدث عند إنفجار اي سيارة&lt;br /&gt;
    function() -- الوظيفة&lt;br /&gt;
        setTimer(destroyElement,5000,1,source) -- يخفي السيارة بعد 5 ثواني من انفاجرها &lt;br /&gt;
    end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
يمكنك ان تجد&lt;br /&gt;
الاحداث&lt;br /&gt;
والوظائف &lt;br /&gt;
كلنت وسيرفر&lt;br /&gt;
هنا&lt;br /&gt;
&lt;br /&gt;
كلنت:&lt;br /&gt;
&lt;br /&gt;
'''وظائف كلنت'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Client_Scripting_Functions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''احداث كلنت'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Client_Scripting_Events&lt;br /&gt;
&lt;br /&gt;
سيرفر:&lt;br /&gt;
&lt;br /&gt;
'''وظائف سيرفر'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Server_Scripting_Functions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''احداث سيرفر'''&lt;br /&gt;
&lt;br /&gt;
http://wiki.multitheftauto.com/wiki/Server_Scripting_Events&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== String الـ ==&lt;br /&gt;
السترنج هو شيء يوجد في بعض الوظايف التي توجد داخل الام تي اي&lt;br /&gt;
&lt;br /&gt;
مثلاً&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onResourceStart&amp;quot;,resourceRoot, -- الايفنت هنا يجب ان تكون بين سترنق كما الموضح هنا&lt;br /&gt;
    function()&lt;br /&gt;
        outputChatBox(&amp;quot;تم بدء السكربت&amp;quot;) -- s هنا سوف يظهر رسالة بالشات &amp;quot; تم بدء السكربت &amp;quot; عند بدء السكربت ويجب ان تكون سترنق&lt;br /&gt;
    end&lt;br /&gt;
) -- نهاية قوس الحدث&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
السترنق له عدة أشكال , فيمكن ان يكون كالآتي&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
أو&lt;br /&gt;
&lt;br /&gt;
' '&lt;br /&gt;
&lt;br /&gt;
أو&lt;br /&gt;
&lt;br /&gt;
[[]]&lt;br /&gt;
&lt;br /&gt;
فمثلاً اذا نريد ان نخرج رسالة بعلبة الشات&lt;br /&gt;
&lt;br /&gt;
يمكن ان تكون كذلك &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
outputChatBox([[مرحباً]])&lt;br /&gt;
&lt;br /&gt;
-- أو كذلك&lt;br /&gt;
outputChatBox('مرحباً')&lt;br /&gt;
&lt;br /&gt;
-- أو كذلك&lt;br /&gt;
&lt;br /&gt;
outputChatBox(&amp;quot;مرحباً&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Command handlerعن الـ====&lt;br /&gt;
.(`) أو زر F8 التي يمكن للاعب ان يعرضها باستخدام زر Consoleهو اسم الامر الذي يمكن للاعب ان يدخله في الـ [[addCommandHandler]] في argument أول&lt;br /&gt;
&lt;br /&gt;
.&amp;quot;createVehicleForPlayer&amp;quot;هي وظيفة تُنفذ عند كتابة اللاعب الامر في هذه الحالة لـ [[addCommandHandler]] في argument ثاني&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:اذا كنت متمرس في البرمجة, ستعرف انك ستحتاج ان تنفذ وظيفة مثل&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
functionName(argument1, argument2, argument3, ..)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
functionName(thePlayer, commandName, argument3, ..)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If we have a closer look on the lower example above, we can see argument1 is thePlayer and argument2 the commandName. thePlayer is simply the one who typed the command, so whatever you call it, the variable will contain the player who activated the command. commandName is simply the command they typed. So if they typed &amp;quot;/greet&amp;quot;, this argument will contain &amp;quot;greet&amp;quot;. Argument 3 is something extra the player typed, you'll learn it a little bit further in the tutorial. Never forget that the first 2 arguments are standard arguments, but you can name them to anything you want.&lt;br /&gt;
&lt;br /&gt;
We called the [[addCommandHandler]] function this way already and since ''createVehicleForPlayer'' is a function too, it can be called that way as well. But we are using a command handler for that, which calls it in a similiar manner, internally.&lt;br /&gt;
&lt;br /&gt;
For example: Someone types &amp;quot;createvehicle 468&amp;quot; ingame in the console to spawn a Sanchez, the command handler calls the createVehicleForPlayer function, as '''if''' we would have this line of code in the script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
createVehicleForPlayer(thePlayer,&amp;quot;createvehicle&amp;quot;,&amp;quot;468&amp;quot;) -- thePlayer هو الشيء الي كتب الكومند&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
As we can see, it provides several parameters: the player who called the command, the command he entered and whatever text he had after that, in this case &amp;quot;468&amp;quot; as vehicle id for the Sanchez. The first two parameters are the same with all command handlers, which you can read on the [[addEventHandler]] page. For this fact, you always have to define at least those two parameters to use any after that (for example to process text that was entered after the command, like in our example the vehicle model id).&lt;br /&gt;
&lt;br /&gt;
''Note: You have to add the command handler AFTER you defined the handler function, else it can't find it. The order of execution matters.''&lt;br /&gt;
&lt;br /&gt;
====Writing the function====&lt;br /&gt;
In order to fill the function we created, we need to think about what we have to do:&lt;br /&gt;
* Get the players position, so we know where to spawn the vehicle (we want it to appear right beside the player)&lt;br /&gt;
* Calculate the position we want to spawn the vehicle at (we don't want it to appear in the player)&lt;br /&gt;
* Spawn the vehicle&lt;br /&gt;
* Check if it has been spawned successfully, or output a message&lt;br /&gt;
&lt;br /&gt;
In order to achieve our goals, we have to use several functions. To find function we need to use, we should visit the [[Scripting Functions|Server Functions List]]. First we need a function to get the players position. Since players are Elements, we first jump to the '''Element functions''' where we find the [[getElementPosition]] function. By clicking on the function name in the list, you get to the function description. There we can see the syntax, what it returns and usually an example. The syntax shows us what arguments we can or have to submit.&lt;br /&gt;
&lt;br /&gt;
For [[getElementPosition]], the syntax is:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float, float, float getElementPosition ( element theElement )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three ''float'' in front of the function name are the return type. In this case it means the function returns three floating point numbers. (x, y and z) Within the parentheses, you can see what arguments you have to submit. In this case only the element whose position you want to get, which is the player in our example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	-- نأتي باحداثيات المكان الي نبغي نضع فيه السيارة بشكل x, y, z&lt;br /&gt;
	-- (local  تعني ان هاد الاختصار ما رح يشغل غير في هاد الفنكشن)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we want to ensure that the vehicle won't spawn directly in the player, so we add a few units to the ''x'' variable, which will make it spawn east from the player.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) -- نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- add 5 units to the x position&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we need another function, one to spawn a vehicle. We once again search for it on the [[Scripting Functions|Server Functions List]], this time - since we are talking about vehicles - in the '''Vehicle functions''' section, where we will choose [[createVehicle]]. In this function's syntax, we only have one return type (which is more common), a vehicle element that points to the vehicle we just created. Also, we see that some arguments are enclosed within [ ] which means that those are optional.&lt;br /&gt;
&lt;br /&gt;
We already have all arguments we need for [[createVehicle]] in our function: The position we just calculated in the ''x,y,z'' variables and the model id that we provided through the command (&amp;quot;createvehicle 468&amp;quot;) and can access in the function as ''vehicleModel'' variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) --  نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- add 5 units to the x position&lt;br /&gt;
	-- create the vehicle and store the returned vehicle element in the ''createdVehicle'' variable&lt;br /&gt;
	local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course this code can be improved in many ways, but at least we want to add a check whether the vehicle was created successfully or not. As we can read on the [[createVehicle]] page under '''Returns''', the function returns ''false'' when it was unable to create the vehicle. Thus, we check the value of the ''createVehicle'' variable.&lt;br /&gt;
&lt;br /&gt;
Now we have our complete script:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createVehicleForPlayer(thePlayer, command, vehicleModel)&lt;br /&gt;
	local x,y,z = getElementPosition(thePlayer) --  نأتي بمكان الاعب&lt;br /&gt;
	x = x + 5 -- نضيف 5 وحد ل الاحداثيات X&lt;br /&gt;
	local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z)&lt;br /&gt;
	-- نشوف لو السيارة اتعملت ام لا&lt;br /&gt;
	if (createdVehicle == false) then&lt;br /&gt;
		-- لو السياره اتعملت يبقي نعمل رسالة,لكن للاعب فقط&lt;br /&gt;
		outputChatBox(&amp;quot;Failed to create vehicle.&amp;quot;,thePlayer)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;createvehicle&amp;quot;, createVehicleForPlayer)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, we introduced another function with [[outputChatBox]]. By now, you should be able to explore the function's documentation page yourself. For more advanced scripting, please check out the [[Map manager|Map Manager]].&lt;br /&gt;
&lt;br /&gt;
==What you need to know==&lt;br /&gt;
You already read some things about resources, command handlers and finding functions in the documentation in the first paragraph, but there is much more to learn. This section will give you a rather short overview over some of these things, while linking to related pages if possible.&lt;br /&gt;
===Clientside and Serverside scripts===&lt;br /&gt;
You may have already noticed these or similiar terms (Server/Client) somewhere on this wiki, mostly in conjunction with functions. MTA not only supports scripts that run on the server and provide commands (like the one we wrote above) or other features, but also scripts that run on the MTA client the players use to connect to the server. The reason for this is, that some features MTA provides have to be clientside (like a GUI - Graphical User Interface), others should be because they work better and still others are better off to be serverside or just don't work clientside.&lt;br /&gt;
&lt;br /&gt;
Most scripts you will make (gamemodes, maps) will probably be serverside, like the one we wrote in the first section. If you run into something that can't be solved serverside, you will probably have to make it clientside. For a clientside script for example, you would create a ordinary script file (for example called ''client.lua'') and specify it in the meta.xml, like this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;client.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The ''type'' attribute defaults to 'server', so you only need to specify it for clientside scripts. When you do this, the clientside script will be downloaded to the player's computer once he connects to the server. Read more about [[Client side scripts]].&lt;br /&gt;
&lt;br /&gt;
===More complex resources===&lt;br /&gt;
The previous section showed briefly how to add clientside scripts to the resource, but there is also much more possible. As mentioned at the very top of this page, resources can be pretty much everything. Their purpose is defined by what they do. Let's have some theoretical resources, by looking at the files it contains, the ''meta.xml'' and what they might do:&lt;br /&gt;
&lt;br /&gt;
====First example - A utility script====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/admin_commands&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/commands.lua&lt;br /&gt;
	/client.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;admin commands&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;commands.lua&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;client.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''commands.lua'' provides some admin commands, like banning a player, muting or something else that can be used to admin the server&lt;br /&gt;
* The ''client.lua'' provides a GUI to be able to perform the mentioned actions easily&lt;br /&gt;
&lt;br /&gt;
This example might be running all the time (maybe even auto-started when the server starts) as it's useful during the whole gaming experience and also wont interfere with the gameplay, unless an admin decides to take some action of course.&lt;br /&gt;
&lt;br /&gt;
====Second example - A gamemode====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/counterstrike&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/counterstrike.lua&lt;br /&gt;
	/buymenu.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;Counterstrike remake&amp;quot; type=&amp;quot;gamemode&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;counterstrike.lua&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;buymenu.lua&amp;quot; type=&amp;quot;client&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''counterstrike.lua'' contains similiar to the following features:&lt;br /&gt;
** Let players choose their team and spawn them&lt;br /&gt;
** Provide them with weapons, targets and instructions (maybe read from a Map, see below)&lt;br /&gt;
** Define the game's rules, e.g. when does the round end, what happens when a player dies&lt;br /&gt;
** .. and maybe some more&lt;br /&gt;
* The ''buymenu.lua'' is a clientside script and creates a menu to buy weapons&lt;br /&gt;
&lt;br /&gt;
This example can be called a gamemode, since it not only intereferes with the gameplay, but actually defines the rules of it. The ''type'' attribute indicates that this example works with the [[Map manager]], yet another resource that was written by the QA Team to manage gamemodes and map loading. It is highly recommended that you base your gamemodes on the techniques it provides.&lt;br /&gt;
&lt;br /&gt;
This also means that the gamemode probably won't run without a map. Gamemodes should always be as generic as possible. An example for a map is stated in the next example.&lt;br /&gt;
&lt;br /&gt;
====Third example - A Map====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
/cs-airport&lt;br /&gt;
	/meta.xml&lt;br /&gt;
	/airport.map&lt;br /&gt;
	/airport.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta&amp;gt;&lt;br /&gt;
	&amp;lt;info author=&amp;quot;Someguy&amp;quot; description=&amp;quot;Counterstrike airport map&amp;quot; type=&amp;quot;map&amp;quot; gamemodes=&amp;quot;counterstrike&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;map src=&amp;quot;airport.map&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;script src=&amp;quot;airport.lua&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/meta&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The ''airport.map'' in a XML file that provides information about the map to the gamemode, these may include:&lt;br /&gt;
** Where the players should spawn, with what weapons, what teams there are&lt;br /&gt;
** What the targets are&lt;br /&gt;
** Weather, World Time, Timelimit&lt;br /&gt;
** Provide vehicles&lt;br /&gt;
* The ''airport.lua'' might contain map-specific features, that may include:&lt;br /&gt;
** Opening some door/make something explode when something specific happens&lt;br /&gt;
** Create or move some custom objects, or manipulate objects that are created through the .map file&lt;br /&gt;
** .. anything else map-specific you can think of&lt;br /&gt;
&lt;br /&gt;
As you can see, the ''type'' attribute changed to 'map', telling the [[Map manager]] that this resource is a map, while the ''gamemodes'' attribute tells it for which gamemodes this map is valid, in this case the gamemode from the above example.&lt;br /&gt;
What may come as a surprise is that there is also a script in the Map resource. Of course this is not necessarily needed in a map, but opens a wide range of possibilities for map makers to create their own world within the rules of the gamemode they create it for.&lt;br /&gt;
&lt;br /&gt;
The ''airport.map'' file might look similiar to this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;map mode=&amp;quot;deathmatch&amp;quot; version=&amp;quot;1.0&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;terrorists&amp;gt;&lt;br /&gt;
		&amp;lt;spawnpoint posX=&amp;quot;2332.23&amp;quot; posY=&amp;quot;-12232.33&amp;quot; posZ=&amp;quot;4.42223&amp;quot; skins=&amp;quot;23-40&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/terrorists&amp;gt;&lt;br /&gt;
	&amp;lt;counterterrorists&amp;gt;&lt;br /&gt;
		&amp;lt;spawnpoint posX=&amp;quot;2334.23443&amp;quot; posY=&amp;quot;-12300.233&amp;quot; posZ=&amp;quot;10.2344&amp;quot; skins=&amp;quot;40-50&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/counterterrorists&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;bomb posX=&amp;quot;23342.23&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
	&amp;lt;vehicle posX=&amp;quot;&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; model=&amp;quot;602&amp;quot; /&amp;gt;	&lt;br /&gt;
	&amp;lt;vehicle posX=&amp;quot;&amp;quot; posY=&amp;quot;&amp;quot; posZ=&amp;quot;&amp;quot; model=&amp;quot;603&amp;quot; /&amp;gt;	&lt;br /&gt;
&amp;lt;/map&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When a gamemode is started with a map, the map resources is automatically started by the mapmanager and the information it contains can be read by the gamemode resource. When the map changes, the current map resource is stopped and the next map resource is started. For a more in-depth explanation and examples of how map resources are utilized in the main script, please visit the [[Writing Gamemodes]] page.&lt;br /&gt;
&lt;br /&gt;
===Events===&lt;br /&gt;
Events are the way MTA tells scripts about things that happen. For example when a player dies, the [[onPlayerWasted]] event is triggered. In order to perform any actions when a player dies, you have to prepare yourself similiar to adding a command handler, as shown in [[#Writing_the_script|the first chapter]].&lt;br /&gt;
&lt;br /&gt;
This example will output a message with the name of the player who died:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function playerDied(totalAmmo, killer, killerWeapon, bodypart)&lt;br /&gt;
	outputChatBox(getPlayerName(source)..&amp;quot; died!&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerWasted&amp;quot;,getRootElement(),playerDied)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead of showing what arguments are needed, the documentation page for Events shows what parameters are passed to the handler function, similiar to the way a [[#About_command_handlers|command handler]] does, just that it is different from event to event. Another important point is the ''source'' variable, that exists in handler functions. It doesn't have to be added to the parameter list of the function, but it still exists. It has a different value from event to event, for player events (as in the example above) it is the player element. As another example, you can take a look at the basic spawning player script in the first section to get an idea how ''source'' is used.&lt;br /&gt;
&lt;br /&gt;
==Where to go from here==&lt;br /&gt;
You should now be familiar with the most basic aspects of MTA scripting and also a bit with the documentation. The [[Main Page]] provides you with links to more information, Tutorials and References that allow a deeper look into the topics you desire to learn about.&lt;br /&gt;
&lt;br /&gt;
From here we recommend reading the [[debugging]] tutorial. Good debugging skills are an absolute necessity when you are making scripts.&lt;br /&gt;
&lt;br /&gt;
[[ru:Scripting Introduction]]&lt;br /&gt;
[[it:Introduzione allo scripting]]&lt;br /&gt;
[[es:Introducción a la Programación]]&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/showChat&amp;diff=47460</id>
		<title>AR/showChat</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/showChat&amp;diff=47460"/>
		<updated>2016-05-05T19:24:27Z</updated>

		<summary type="html">&lt;p&gt;Jaber: Created page with &amp;quot;__NOTOC__  {{Server client function}}  هذه الوظيفة تستخدم لاخفاء واظهار الكلام بالشات.  ==Syntax== &amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}} &lt;br /&gt;
هذه الوظيفة تستخدم لاخفاء واظهار الكلام بالشات.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool showChat ( bool show )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===شرح الارقمنات=== &lt;br /&gt;
*'''show:''' الظهور true = اظهار الشات , false = اخفاء الشات.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the player's chat was shown or hidden successfully, ''false'' otherwise.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool showChat ( player thePlayer, bool show )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===شرح الارقمنات=== &lt;br /&gt;
*'''thePlayer:''' الاعب الذي تبي تخفي له الشات.&lt;br /&gt;
*'''show:''' الظهور true = اظهار الشات , false = اخفاء الشات.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the player's chat was shown or hidden successfully, ''false'' otherwise.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
هذا المثال يخفي الشات عند الضغط على حر ف 'i'&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--This example below is for all versions until 1.4:&lt;br /&gt;
local isChatVisible = true --Let's assume the chat is visible as soon as the resource starts.&lt;br /&gt;
&lt;br /&gt;
function chat(key, keyState)&lt;br /&gt;
    if isChatVisible then --Check or the chat is visible.&lt;br /&gt;
        showChat(false) --If it is, hide it.&lt;br /&gt;
        isChatVisible = false&lt;br /&gt;
    else&lt;br /&gt;
        showChat(true) --If it is not, show it.&lt;br /&gt;
        isChatVisible = true&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
bindKey(&amp;quot;i&amp;quot;, &amp;quot;down&amp;quot;, chat) --Make a bind key to start the function as soon as a player presses the key 'i'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--This example below is for version 1.4 and up:&lt;br /&gt;
function chat(key, keyState)&lt;br /&gt;
    if isChatVisible() then --Check or the chat is visible.&lt;br /&gt;
        showChat(false) --If it is, hide it.&lt;br /&gt;
    else&lt;br /&gt;
        showChat(true) --If it is not, show it.&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
bindKey(&amp;quot;i&amp;quot;, &amp;quot;down&amp;quot;, chat) --Make a bind key to start the function as soon as a player presses the key 'i'&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Server functions}}&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/setElementPosition&amp;diff=47398</id>
		<title>AR/setElementPosition</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/setElementPosition&amp;diff=47398"/>
		<updated>2016-04-17T16:20:43Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
هذه الوظيفة تستخدم لنقل الالمنت او الشيئ لاحداثيات محددة.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background: #FF7070; border: 3px solid #FF0000;&amp;quot;&amp;gt;&lt;br /&gt;
'''Attention:''' Do not use this function to spawn a [[player]]. It will cause problems with other functions like [[warpPedIntoVehicle]]. &amp;lt;br&amp;gt;&lt;br /&gt;
Use [[spawnPlayer]] instead.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool setElementPosition ( element theElement, float x, float y, float z [, bool warp = true ] )  &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[element]]:setPosition|position|getElementPosition}}&lt;br /&gt;
&lt;br /&gt;
===شرح الارقمنتات=== &lt;br /&gt;
*'''theElement:''' الالمنت الذي تريد جلب احداثيات.&lt;br /&gt;
*'''x:''' الاحداثيات x.&lt;br /&gt;
*'''y:''' الاحداثيات y.&lt;br /&gt;
*'''z:''' الاحداثيات z.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''warp:''' ان كنت تريد نقل الاعب.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the function was successful, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 1&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
هذه الوظيفة عند كتابة امر باف8 تقوم بنقل الاعب.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function consoleSetPlayerPosition ( source, commandName, posX, posY, posZ )&lt;br /&gt;
	setElementPosition ( source, posX, posY, posZ )&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;setpos&amp;quot;, consoleSetPlayerPosition  )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 2&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function consoleSetPlayerPosition ( commandName, posX, posY, posZ )&lt;br /&gt;
	setElementPosition ( localPlayer, posX, posY, posZ )&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;setpos&amp;quot;, consoleSetPlayerPosition  )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 3&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
This example enables a player to type /warpto &amp;lt;playername&amp;gt; to warp to them. If the player being warped to is in a vehicle with a free passenger seat, it will warp into the vehicle.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function consoleWarpTo ( sourcePlayer, commandName, player2nick )&lt;br /&gt;
	-- Make sure required parameters are set&lt;br /&gt;
	if ( not sourcePlayer or not player2nick ) then return end&lt;br /&gt;
	-- Setup the variables we will be using for teleportation&lt;br /&gt;
	local x, y, z, r, d = 0, 0, 0, 0, 2.5&lt;br /&gt;
	-- Grab the element identifier of the player we are trying to warp to&lt;br /&gt;
	local player2 = getPlayerFromNick ( player2nick )&lt;br /&gt;
	-- Make sure it exists!&lt;br /&gt;
	if ( player2 ) then&lt;br /&gt;
		-- Is the player we're warping to in a vehicle?&lt;br /&gt;
		if ( isPlayerInVehicle ( player2 ) ) then&lt;br /&gt;
			-- Indeed they are, let's get the vehicle information such as the vehicle element itself, and the seats it's got.&lt;br /&gt;
			local player2vehicle = getPlayerOccupiedVehicle ( player2 )&lt;br /&gt;
			local numseats = getVehicleMaxPassengers ( player2vehicle )&lt;br /&gt;
			local i = 0&lt;br /&gt;
			-- Loop over the seats to see if there's a free one&lt;br /&gt;
			while ( i &amp;lt; numseats ) do&lt;br /&gt;
				if ( getVehicleOccupant ( player2vehicle, i ) ) then&lt;br /&gt;
					-- This seat isn't free, go ahead and check the next one&lt;br /&gt;
					i = i + 1&lt;br /&gt;
				else&lt;br /&gt;
					-- This seat is free, get out of the loop&lt;br /&gt;
					break&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			-- Check if 'i' is lower than the number of seats. If it is, it means it's the number of a free seat&lt;br /&gt;
			if ( i &amp;lt; numseats ) then&lt;br /&gt;
				-- Teleport the player into the seat&lt;br /&gt;
				warpPlayerIntoVehicle ( sourcePlayer, player2vehicle, i )&lt;br /&gt;
			else&lt;br /&gt;
				-- There are no free seats, tell the player that.&lt;br /&gt;
				outputChatBox ( &amp;quot;Sorry, the player's vehicle is full (&amp;quot; .. getVehicleName ( player2vehicle ) .. &amp;quot; &amp;quot; .. i .. &amp;quot;/&amp;quot; .. numseats .. &amp;quot;)&amp;quot;, sourcePlayer )&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			-- The player isn't in a vehicle, let's get the player's position and warp to them.&lt;br /&gt;
			x, y, z = getElementPosition ( player2 )&lt;br /&gt;
			r = getPlayerRotation ( player2 )&lt;br /&gt;
			-- Make sure we get interior data, they might be inside one!&lt;br /&gt;
			interior = getElementInterior ( player2 )&lt;br /&gt;
			dimension = getElementDimension ( player2 )&lt;br /&gt;
			-- Do some funky math to make sure that we dont teleport inside of them (get us both stuck inside each other)&lt;br /&gt;
			x = x - ( ( math.cos ( math.rad ( r + 90 ) ) ) * d )&lt;br /&gt;
			y = y - ( ( math.sin ( math.rad ( r + 90 ) ) ) * d )&lt;br /&gt;
			-- Set a few timers for setting interiors, dimensions and positions&lt;br /&gt;
			setTimer ( setElementInterior, 800, 1, sourcePlayer, interior )&lt;br /&gt;
			setTimer ( setElementDimension, 900, 1, sourcePlayer, dimension )&lt;br /&gt;
			setTimer ( setElementPosition, 1000, 1, sourcePlayer, x, y, z )&lt;br /&gt;
			setTimer ( setPlayerRotation, 1000, 1, sourcePlayer, r )&lt;br /&gt;
			-- Fade the camera to make it look nicer&lt;br /&gt;
			fadeCamera ( sourcePlayer, false, 1, 0, 0, 0 )&lt;br /&gt;
			-- Fade it back once it's all complete!&lt;br /&gt;
			setTimer ( fadeCamera, 1000, 1, sourcePlayer, true, 1 )&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		-- No player by the specified name was found, tell the warper this.&lt;br /&gt;
		outputChatBox ( &amp;quot;No such player.&amp;quot;, sourcePlayer )&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;warpto&amp;quot;, consoleWarpTo )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{AR/Element functions}}&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/setElementPosition&amp;diff=47397</id>
		<title>AR/setElementPosition</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/setElementPosition&amp;diff=47397"/>
		<updated>2016-04-17T16:18:45Z</updated>

		<summary type="html">&lt;p&gt;Jaber: Created page with &amp;quot;__NOTOC__ {{Server client function}} هذه الوظيفة تستخدم لنقل الالمنت او الشيئ لاحداثيات محددة.  &amp;lt;div style=&amp;quot;background: #FF7070...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
هذه الوظيفة تستخدم لنقل الالمنت او الشيئ لاحداثيات محددة.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background: #FF7070; border: 3px solid #FF0000;&amp;quot;&amp;gt;&lt;br /&gt;
'''Attention:''' Do not use this function to spawn a [[player]]. It will cause problems with other functions like [[warpPedIntoVehicle]]. &amp;lt;br&amp;gt;&lt;br /&gt;
Use [[spawnPlayer]] instead.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool setElementPosition ( element theElement, float x, float y, float z [, bool warp = true ] )  &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[element]]:setPosition|position|getElementPosition}}&lt;br /&gt;
&lt;br /&gt;
===شرح الارقمنتات=== &lt;br /&gt;
*'''theElement:''' الالمنت الذي تريد جلب احداثيات.&lt;br /&gt;
*'''x:''' الاحداثيات x.&lt;br /&gt;
*'''y:''' الاحداثيات y.&lt;br /&gt;
*'''z:''' الاحداثيات z.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''warp:''' ان كنت تريد نقل الاعب.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the function was successful, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 1&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
هذه الوظيفة عند كتابة امر باف8 تقوم بنقل الاعب.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function consoleSetPlayerPosition ( source, commandName, posX, posY, posZ )&lt;br /&gt;
	setElementPosition ( source, posX, posY, posZ )&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;setpos&amp;quot;, consoleSetPlayerPosition  )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 2&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function consoleSetPlayerPosition ( commandName, posX, posY, posZ )&lt;br /&gt;
	setElementPosition ( localPlayer, posX, posY, posZ )&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;setpos&amp;quot;, consoleSetPlayerPosition  )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 3&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
This example enables a player to type /warpto &amp;lt;playername&amp;gt; to warp to them. If the player being warped to is in a vehicle with a free passenger seat, it will warp into the vehicle.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function consoleWarpTo ( sourcePlayer, commandName, player2nick )&lt;br /&gt;
	-- Make sure required parameters are set&lt;br /&gt;
	if ( not sourcePlayer or not player2nick ) then return end&lt;br /&gt;
	-- Setup the variables we will be using for teleportation&lt;br /&gt;
	local x, y, z, r, d = 0, 0, 0, 0, 2.5&lt;br /&gt;
	-- Grab the element identifier of the player we are trying to warp to&lt;br /&gt;
	local player2 = getPlayerFromNick ( player2nick )&lt;br /&gt;
	-- Make sure it exists!&lt;br /&gt;
	if ( player2 ) then&lt;br /&gt;
		-- Is the player we're warping to in a vehicle?&lt;br /&gt;
		if ( isPlayerInVehicle ( player2 ) ) then&lt;br /&gt;
			-- Indeed they are, let's get the vehicle information such as the vehicle element itself, and the seats it's got.&lt;br /&gt;
			local player2vehicle = getPlayerOccupiedVehicle ( player2 )&lt;br /&gt;
			local numseats = getVehicleMaxPassengers ( player2vehicle )&lt;br /&gt;
			local i = 0&lt;br /&gt;
			-- Loop over the seats to see if there's a free one&lt;br /&gt;
			while ( i &amp;lt; numseats ) do&lt;br /&gt;
				if ( getVehicleOccupant ( player2vehicle, i ) ) then&lt;br /&gt;
					-- This seat isn't free, go ahead and check the next one&lt;br /&gt;
					i = i + 1&lt;br /&gt;
				else&lt;br /&gt;
					-- This seat is free, get out of the loop&lt;br /&gt;
					break&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			-- Check if 'i' is lower than the number of seats. If it is, it means it's the number of a free seat&lt;br /&gt;
			if ( i &amp;lt; numseats ) then&lt;br /&gt;
				-- Teleport the player into the seat&lt;br /&gt;
				warpPlayerIntoVehicle ( sourcePlayer, player2vehicle, i )&lt;br /&gt;
			else&lt;br /&gt;
				-- There are no free seats, tell the player that.&lt;br /&gt;
				outputChatBox ( &amp;quot;Sorry, the player's vehicle is full (&amp;quot; .. getVehicleName ( player2vehicle ) .. &amp;quot; &amp;quot; .. i .. &amp;quot;/&amp;quot; .. numseats .. &amp;quot;)&amp;quot;, sourcePlayer )&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			-- The player isn't in a vehicle, let's get the player's position and warp to them.&lt;br /&gt;
			x, y, z = getElementPosition ( player2 )&lt;br /&gt;
			r = getPlayerRotation ( player2 )&lt;br /&gt;
			-- Make sure we get interior data, they might be inside one!&lt;br /&gt;
			interior = getElementInterior ( player2 )&lt;br /&gt;
			dimension = getElementDimension ( player2 )&lt;br /&gt;
			-- Do some funky math to make sure that we dont teleport inside of them (get us both stuck inside each other)&lt;br /&gt;
			x = x - ( ( math.cos ( math.rad ( r + 90 ) ) ) * d )&lt;br /&gt;
			y = y - ( ( math.sin ( math.rad ( r + 90 ) ) ) * d )&lt;br /&gt;
			-- Set a few timers for setting interiors, dimensions and positions&lt;br /&gt;
			setTimer ( setElementInterior, 800, 1, sourcePlayer, interior )&lt;br /&gt;
			setTimer ( setElementDimension, 900, 1, sourcePlayer, dimension )&lt;br /&gt;
			setTimer ( setElementPosition, 1000, 1, sourcePlayer, x, y, z )&lt;br /&gt;
			setTimer ( setPlayerRotation, 1000, 1, sourcePlayer, r )&lt;br /&gt;
			-- Fade the camera to make it look nicer&lt;br /&gt;
			fadeCamera ( sourcePlayer, false, 1, 0, 0, 0 )&lt;br /&gt;
			-- Fade it back once it's all complete!&lt;br /&gt;
			setTimer ( fadeCamera, 1000, 1, sourcePlayer, true, 1 )&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		-- No player by the specified name was found, tell the warper this.&lt;br /&gt;
		outputChatBox ( &amp;quot;No such player.&amp;quot;, sourcePlayer )&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;warpto&amp;quot;, consoleWarpTo )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Element functions}}&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetElementInterior&amp;diff=47396</id>
		<title>GetElementInterior</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetElementInterior&amp;diff=47396"/>
		<updated>2016-04-17T16:13:05Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function allows you to retrieve the interior of any element. An interior is the current loaded place, 0 being outside.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int getElementInterior ( element theElement )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[element]]:getInterior|interior|setElementInterior}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theElement:''' The element of which you'd like to retrieve the interior&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns an [[int]] for the interior if '''theElement''' is valid, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section show=&amp;quot;true&amp;quot; name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;
This example shows a player if he is outside or not, when he enters the command 'AmIOutside'.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function AmIOutside ( thePlayer, command )&lt;br /&gt;
    if ( getElementInterior(thePlayer) == 0 ) then&lt;br /&gt;
        outputChatBox ( &amp;quot;Yes you are outside &amp;quot; .. getPlayerName(thePlayer), thePlayer )&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox ( &amp;quot;No you aren't outside &amp;quot; .. getPlayerName(thePlayer), thePlayer )&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;AmIOutside&amp;quot;, AmIOutside )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Element functions}}&lt;br /&gt;
&lt;br /&gt;
[[de:getElementInterior]]&lt;br /&gt;
[[ar:getElementInterior]]&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/getElementInterior&amp;diff=47395</id>
		<title>AR/getElementInterior</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/getElementInterior&amp;diff=47395"/>
		<updated>2016-04-17T16:12:46Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
هذه الوظيفة تقوم بجلب رقم المبنى الموجود به الالمنت.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int getElementInterior ( element theElement )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[element]]:getInterior|interior|setElementInterior}}&lt;br /&gt;
&lt;br /&gt;
===شرح الارقمنتات===&lt;br /&gt;
*'''theElement:''' الالمنت او الشيئ الذي تريد جلب رقم المبنى الموجود به&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns an [[int]] for the interior if '''theElement''' is valid, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section show=&amp;quot;true&amp;quot; name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;
هذا الكود يتحقق ان كان الاعب داخل المبنى 0 عند كتابة امر باف8'.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function AmIOutside ( thePlayer, command )&lt;br /&gt;
    if ( getElementInterior(thePlayer) == 0 ) then --ان كان الاعب داخل المبنى 0&lt;br /&gt;
        outputChatBox ( &amp;quot;Yes you are outside &amp;quot; .. getPlayerName(thePlayer), thePlayer ) --اخراج كلام بالشات&lt;br /&gt;
    else --ان لم يكن&lt;br /&gt;
        outputChatBox ( &amp;quot;No you aren't outside &amp;quot; .. getPlayerName(thePlayer), thePlayer ) --اخراج كلام بالشات&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;AmIOutside&amp;quot;, AmIOutside )--عند كتابة الامر باف8 &amp;quot;AmIOutside&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{AR/Element functions}}&lt;br /&gt;
&lt;br /&gt;
[[de:getElementInterior]]&lt;br /&gt;
[[en:getElementInterior]]&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/getElementInterior&amp;diff=47394</id>
		<title>AR/getElementInterior</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/getElementInterior&amp;diff=47394"/>
		<updated>2016-04-17T16:12:28Z</updated>

		<summary type="html">&lt;p&gt;Jaber: Created page with &amp;quot;__NOTOC__ {{Server client function}} هذه الوظيفة تقوم بجلب رقم المبنى الموجود به الالمنت.  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; int getElementIn...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
هذه الوظيفة تقوم بجلب رقم المبنى الموجود به الالمنت.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int getElementInterior ( element theElement )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[element]]:getInterior|interior|setElementInterior}}&lt;br /&gt;
&lt;br /&gt;
===شرح الارقمنتات===&lt;br /&gt;
*'''theElement:''' الالمنت او الشيئ الذي تريد جلب رقم المبنى الموجود به&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns an [[int]] for the interior if '''theElement''' is valid, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section show=&amp;quot;true&amp;quot; name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;
هذا الكود يتحقق ان كان الاعب داخل المبنى 0 عند كتابة امر باف8'.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function AmIOutside ( thePlayer, command )&lt;br /&gt;
    if ( getElementInterior(thePlayer) == 0 ) then --ان كان الاعب داخل المبنى 0&lt;br /&gt;
        outputChatBox ( &amp;quot;Yes you are outside &amp;quot; .. getPlayerName(thePlayer), thePlayer ) --اخراج كلام بالشات&lt;br /&gt;
    else --ان لم يكن&lt;br /&gt;
        outputChatBox ( &amp;quot;No you aren't outside &amp;quot; .. getPlayerName(thePlayer), thePlayer ) --اخراج كلام بالشات&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;AmIOutside&amp;quot;, AmIOutside )--عند كتابة الامر باف8 &amp;quot;AmIOutside&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Element functions}}&lt;br /&gt;
&lt;br /&gt;
[[de:getElementInterior]]&lt;br /&gt;
[[en:getElementInterior]]&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Client_Scripting_Events&amp;diff=47358</id>
		<title>Client Scripting Events</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Client_Scripting_Events&amp;diff=47358"/>
		<updated>2016-04-07T12:43:27Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;client&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
This page lists all '''client-side''' scripting [[event]]s that have been implemented and are available in the Deathmatch mod.&lt;br /&gt;
&lt;br /&gt;
To request a function or event, use [[Requested Functions and Events]].&lt;br /&gt;
&lt;br /&gt;
'''Server-side scripting events can be found here: [[Server Scripting Events]]&lt;br /&gt;
&lt;br /&gt;
==Browser events==&lt;br /&gt;
{{CEF_events}}&lt;br /&gt;
&lt;br /&gt;
==Colshape events==&lt;br /&gt;
{{Client_colshape_events}}&lt;br /&gt;
&lt;br /&gt;
==Element events==&lt;br /&gt;
{{Client_element_events}}&lt;br /&gt;
&lt;br /&gt;
==GUI events==&lt;br /&gt;
{{GUI_events}}&lt;br /&gt;
&lt;br /&gt;
==Marker events==&lt;br /&gt;
{{Client_marker_events}}&lt;br /&gt;
&lt;br /&gt;
==Ped events==&lt;br /&gt;
{{Client_ped_events}}&lt;br /&gt;
&lt;br /&gt;
==Pickup events==&lt;br /&gt;
{{Client_pickup_events}}&lt;br /&gt;
&lt;br /&gt;
==Player events==&lt;br /&gt;
{{Client_player_events}}&lt;br /&gt;
&lt;br /&gt;
==Object events==&lt;br /&gt;
{{Client_object_events}}&lt;br /&gt;
&lt;br /&gt;
==Projectile events==&lt;br /&gt;
{{Client_projectile_events}}&lt;br /&gt;
&lt;br /&gt;
==Resource events==&lt;br /&gt;
{{Client_resource_events}}&lt;br /&gt;
&lt;br /&gt;
==Sound events==&lt;br /&gt;
{{Sound_events}}&lt;br /&gt;
&lt;br /&gt;
==Vehicle events==&lt;br /&gt;
{{Client_vehicle_events}}&lt;br /&gt;
&lt;br /&gt;
==Weapon creation events==&lt;br /&gt;
{{Client_weapon_creation_events}}&lt;br /&gt;
&lt;br /&gt;
==Other events==&lt;br /&gt;
{{Client_other_events}}&lt;br /&gt;
&lt;br /&gt;
[[pl:PL/Client Scripting Events]]&lt;br /&gt;
[[ru:Client Scripting Events]]&lt;br /&gt;
[[es:Client Scripting Events]]&lt;br /&gt;
[[fr:Client Scripting Events]]&lt;br /&gt;
[[tr:Client Taraflı Eventler]]&lt;br /&gt;
[[ar:Client Scripting Events]]&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/setPlayerNametagShowing&amp;diff=46984</id>
		<title>AR/setPlayerNametagShowing</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/setPlayerNametagShowing&amp;diff=46984"/>
		<updated>2016-03-24T14:47:34Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
{{New feature|3|1.0|هذه الوظيفة تستخدم لحذف واظهار اسم الاعب الذي يكون عليه}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd --&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool setPlayerNametagShowing ( player thePlayer, bool showing )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===شرح الارقمنتات=== &lt;br /&gt;
*'''thePlayer:''' الاعب الذي تريد اظهار\اخفاء اسمه&lt;br /&gt;
*'''showing:''' استخدم true\false حتى تخفي\تظهر الاسم&lt;br /&gt;
&lt;br /&gt;
''true'' = اظهار الاسم , ''false'' = اخفاء الاسم .&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
هذه الامثلة تخفي اسم الاعب&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onResourceStart ( )&lt;br /&gt;
    local players = getElementsByType ( &amp;quot;player&amp;quot; ) &lt;br /&gt;
    for key, player in ipairs ( players ) do       -- لوب لكل الاعبين&lt;br /&gt;
        setPlayerNametagShowing ( player, false )  -- اخفاء اسمائهم (false)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onResourceStart&amp;quot;, resourceRoot, onResourceStart )&lt;br /&gt;
&lt;br /&gt;
--مثال اخر&lt;br /&gt;
&lt;br /&gt;
function onPlayerJoin ( )&lt;br /&gt;
	setPlayerNametagShowing ( source, false ) --اخفاء اسمه (false)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerJoin&amp;quot;, root, onPlayerJoin ) --حدث عندما الاعب يدخل&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{AR/Player functions}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[en:setPlayerNametagShowing]]&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetPlayerNametagShowing&amp;diff=46983</id>
		<title>SetPlayerNametagShowing</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetPlayerNametagShowing&amp;diff=46983"/>
		<updated>2016-03-24T14:12:28Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
{{New feature|3|1.0|This function allows you to set whether a player's nametag visibility both clientside and serverside}}&lt;br /&gt;
&lt;br /&gt;
Use this to define whether the player's name tag is visible or invisible.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd --&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool setPlayerNametagShowing ( player thePlayer, bool showing )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[player]]:setNametagShowing|nametagShowing|isPlayerNametagShowing}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''thePlayer:''' Define the player whos tag visiblity status you want to change&lt;br /&gt;
*'''showing:''' Use true or false to show/hide the tag&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if successful, ''false'' otherwise&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This script will turn off player tags for everyone&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onResourceStart ( )&lt;br /&gt;
    local players = getElementsByType ( &amp;quot;player&amp;quot; ) -- Store all the players in the server into a table&lt;br /&gt;
    for key, player in ipairs ( players ) do       -- for all the players in the table&lt;br /&gt;
        setPlayerNametagShowing ( player, false )  -- turn off their nametag&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onResourceStart&amp;quot;, resourceRoot, onResourceStart )&lt;br /&gt;
&lt;br /&gt;
function onPlayerJoin ( )&lt;br /&gt;
      -- Whoever joins the server should also have their nametags deactivated&lt;br /&gt;
	setPlayerNametagShowing ( source, false )&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerJoin&amp;quot;, root, onPlayerJoin )&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Player functions}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[ar:setPlayerNametagShowing]]&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/setPlayerNametagShowing&amp;diff=46982</id>
		<title>AR/setPlayerNametagShowing</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/setPlayerNametagShowing&amp;diff=46982"/>
		<updated>2016-03-24T14:12:16Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
{{New feature|3|1.0|هذه الوظيفة تستخدم لحذف واظهار اسم الاعب الذي يكون عليه}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd --&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool setPlayerNametagShowing ( player thePlayer, bool showing )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===شرح الارقمنتات=== &lt;br /&gt;
*'''thePlayer:''' الاعب الذي تريد اظهار\اخفاء اسمه&lt;br /&gt;
*'''showing:''' استخدم true\false حتى تخفي\تظهر الاسم&lt;br /&gt;
&lt;br /&gt;
''true'' = اظهار الاسم , ''false'' = اظفار الاسم .&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
هذه الامثلة تخفي اسم الاعب&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onResourceStart ( )&lt;br /&gt;
    local players = getElementsByType ( &amp;quot;player&amp;quot; ) &lt;br /&gt;
    for key, player in ipairs ( players ) do       -- لوب لكل الاعبين&lt;br /&gt;
        setPlayerNametagShowing ( player, false )  -- اخفاء اسمائهم (false)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onResourceStart&amp;quot;, resourceRoot, onResourceStart )&lt;br /&gt;
&lt;br /&gt;
--مثال اخر&lt;br /&gt;
&lt;br /&gt;
function onPlayerJoin ( )&lt;br /&gt;
	setPlayerNametagShowing ( source, false ) --افخاء اسمه (false&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerJoin&amp;quot;, root, onPlayerJoin ) --حدث عندما الاعب يدخل&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{AR/Player functions}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[en:setPlayerNametagShowing]]&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/setPlayerNametagShowing&amp;diff=46981</id>
		<title>AR/setPlayerNametagShowing</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/setPlayerNametagShowing&amp;diff=46981"/>
		<updated>2016-03-24T14:11:49Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
{{New feature|3|1.0|هذه الوظيفة تستخدم لحذف واظهار اسم الاعب الذي يكون عليه}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd --&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool setPlayerNametagShowing ( player thePlayer, bool showing )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===شرح الارقمنتات=== &lt;br /&gt;
*'''thePlayer:''' الاعب الذي تريد اظهار\اخفاء اسمه&lt;br /&gt;
*'''showing:''' استخدم true\false حتى تخفي\تظهر الاسم&lt;br /&gt;
&lt;br /&gt;
''true'' = اظهار الاسم , ''false'' = اظفار الاسم .&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
هذه الامثلة تخفي اسم الاعب&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onResourceStart ( )&lt;br /&gt;
    local players = getElementsByType ( &amp;quot;player&amp;quot; ) &lt;br /&gt;
    for key, player in ipairs ( players ) do       -- لوب لكل الاعبين&lt;br /&gt;
        setPlayerNametagShowing ( player, false )  -- اخفاء اسمائهم (false)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onResourceStart&amp;quot;, resourceRoot, onResourceStart )&lt;br /&gt;
&lt;br /&gt;
--مثال اخر&lt;br /&gt;
&lt;br /&gt;
function onPlayerJoin ( )&lt;br /&gt;
	setPlayerNametagShowing ( source, false ) --افخاء اسمه (false&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerJoin&amp;quot;, root, onPlayerJoin ) --حدث عندما الاعب يدخل&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{AR/Player functions}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[en:createMarker]]&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/setPlayerNametagShowing&amp;diff=46980</id>
		<title>AR/setPlayerNametagShowing</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/setPlayerNametagShowing&amp;diff=46980"/>
		<updated>2016-03-24T14:06:35Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
{{New feature|3|1.0|هذه الوظيفة تستخدم لحذف واظهار اسم الاعب الذي يكون عليه}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd --&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool setPlayerNametagShowing ( player thePlayer, bool showing )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===شرح الارقمنتات=== &lt;br /&gt;
*'''thePlayer:''' الاعب الذي تريد اظهار\اخفاء اسمه&lt;br /&gt;
*'''showing:''' استخدم true\false حتى تخفي\تظهر الاسم&lt;br /&gt;
&lt;br /&gt;
''true'' = اظهار الاسم , ''false'' = اظفار الاسم .&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
هذه الامثلة تخفي اسم الاعب&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onResourceStart ( )&lt;br /&gt;
    local players = getElementsByType ( &amp;quot;player&amp;quot; ) &lt;br /&gt;
    for key, player in ipairs ( players ) do       -- لوب لكل الاعبين&lt;br /&gt;
        setPlayerNametagShowing ( player, false )  -- اخفاء اسمائهم (false)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onResourceStart&amp;quot;, resourceRoot, onResourceStart )&lt;br /&gt;
&lt;br /&gt;
--مثال اخر&lt;br /&gt;
&lt;br /&gt;
function onPlayerJoin ( )&lt;br /&gt;
	setPlayerNametagShowing ( source, false ) --افخاء اسمه (false&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerJoin&amp;quot;, root, onPlayerJoin ) --حدث عندما الاعب يدخل&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{AR/Player functions}}&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/setPlayerNametagShowing&amp;diff=46979</id>
		<title>AR/setPlayerNametagShowing</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/setPlayerNametagShowing&amp;diff=46979"/>
		<updated>2016-03-24T14:05:46Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
{{New feature|3|1.0|هذه الوظيفة تستخدم لحذف واظهار اسم الاعب الذي يكون عليه}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd --&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool setPlayerNametagShowing ( player thePlayer, bool showing )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===شرح الارقمنتات=== &lt;br /&gt;
*'''thePlayer:''' الاعب الذي تريد اظهار\اخفاء اسمه&lt;br /&gt;
*'''showing:''' استخدم true\false حتى تخفي\تظهر الاسم&lt;br /&gt;
&lt;br /&gt;
''true'' = اظهار الاسم , ''false'' = اظفار الاسم .&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This script will turn off player tags for everyone&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onResourceStart ( )&lt;br /&gt;
    local players = getElementsByType ( &amp;quot;player&amp;quot; ) &lt;br /&gt;
    for key, player in ipairs ( players ) do       -- لوب لكل الاعبين&lt;br /&gt;
        setPlayerNametagShowing ( player, false )  -- اخفاء اسمائهم (false)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onResourceStart&amp;quot;, resourceRoot, onResourceStart )&lt;br /&gt;
&lt;br /&gt;
--مثال اخر&lt;br /&gt;
&lt;br /&gt;
function onPlayerJoin ( )&lt;br /&gt;
	setPlayerNametagShowing ( source, false ) --افخاء اسمه (false&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerJoin&amp;quot;, root, onPlayerJoin ) --حدث عندما الاعب يدخل&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{AR/Player functions}}&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/setPlayerNametagShowing&amp;diff=46978</id>
		<title>AR/setPlayerNametagShowing</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/setPlayerNametagShowing&amp;diff=46978"/>
		<updated>2016-03-24T13:53:19Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
{{New feature|3|1.0|هذه الوظيفة تستخدم لحذف واظهار اسم الاعب الذي يكون عليه}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd --&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool setPlayerNametagShowing ( player thePlayer, bool showing )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if successful, ''false'' otherwise&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This script will turn off player tags for everyone&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onResourceStart ( )&lt;br /&gt;
    local players = getElementsByType ( &amp;quot;player&amp;quot; ) -- Store all the players in the server into a table&lt;br /&gt;
    for key, player in ipairs ( players ) do       -- for all the players in the table&lt;br /&gt;
        setPlayerNametagShowing ( player, false )  -- turn off their nametag&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onResourceStart&amp;quot;, resourceRoot, onResourceStart )&lt;br /&gt;
&lt;br /&gt;
function onPlayerJoin ( )&lt;br /&gt;
      -- Whoever joins the server should also have their nametags deactivated&lt;br /&gt;
	setPlayerNametagShowing ( source, false )&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerJoin&amp;quot;, root, onPlayerJoin )&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Player functions}}&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/setPlayerNametagShowing&amp;diff=46977</id>
		<title>AR/setPlayerNametagShowing</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/setPlayerNametagShowing&amp;diff=46977"/>
		<updated>2016-03-24T13:53:04Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
{{New feature|3|1.0|هذه الوظيفة تستخدم لحذف واظهار اسم الاعب الذي يكون عليه}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd --&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool setPlayerNametagShowing ( player thePlayer, bool showing )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[player]]:setNametagShowing|nametagShowing|isPlayerNametagShowing}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if successful, ''false'' otherwise&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This script will turn off player tags for everyone&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onResourceStart ( )&lt;br /&gt;
    local players = getElementsByType ( &amp;quot;player&amp;quot; ) -- Store all the players in the server into a table&lt;br /&gt;
    for key, player in ipairs ( players ) do       -- for all the players in the table&lt;br /&gt;
        setPlayerNametagShowing ( player, false )  -- turn off their nametag&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onResourceStart&amp;quot;, resourceRoot, onResourceStart )&lt;br /&gt;
&lt;br /&gt;
function onPlayerJoin ( )&lt;br /&gt;
      -- Whoever joins the server should also have their nametags deactivated&lt;br /&gt;
	setPlayerNametagShowing ( source, false )&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerJoin&amp;quot;, root, onPlayerJoin )&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Player functions}}&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/setPlayerNametagShowing&amp;diff=46976</id>
		<title>AR/setPlayerNametagShowing</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/setPlayerNametagShowing&amp;diff=46976"/>
		<updated>2016-03-24T13:52:44Z</updated>

		<summary type="html">&lt;p&gt;Jaber: Created page with &amp;quot;__NOTOC__ {{Server client function}} {{New feature|3|1.0|هذه الوظيفة تستخدم لحذف واظهار اسم الاعب الذي يكون عليه}}   ==Syntax==  ...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
{{New feature|3|1.0|هذه الوظيفة تستخدم لحذف واظهار اسم الاعب الذي يكون عليه}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd --&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool setPlayerNametagShowing ( player thePlayer, bool showing )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[player]]:setNametagShowing|nametagShowing|isPlayerNametagShowing}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''thePlayer:''' Define the player whos tag visiblity status you want to change&lt;br /&gt;
*'''showing:''' Use true or false to show/hide the tag&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if successful, ''false'' otherwise&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This script will turn off player tags for everyone&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onResourceStart ( )&lt;br /&gt;
    local players = getElementsByType ( &amp;quot;player&amp;quot; ) -- Store all the players in the server into a table&lt;br /&gt;
    for key, player in ipairs ( players ) do       -- for all the players in the table&lt;br /&gt;
        setPlayerNametagShowing ( player, false )  -- turn off their nametag&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onResourceStart&amp;quot;, resourceRoot, onResourceStart )&lt;br /&gt;
&lt;br /&gt;
function onPlayerJoin ( )&lt;br /&gt;
      -- Whoever joins the server should also have their nametags deactivated&lt;br /&gt;
	setPlayerNametagShowing ( source, false )&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerJoin&amp;quot;, root, onPlayerJoin )&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Player functions}}&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/createMarker&amp;diff=46703</id>
		<title>AR/createMarker</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/createMarker&amp;diff=46703"/>
		<updated>2016-02-19T16:42:48Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
هذه الوظيفة تستخدم لصنع ماركر .&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
marker createMarker ( float x, float y, float z [, string theType = &amp;quot;checkpoint&amp;quot;, float size = 4.0, int r = 0, int g = 0, int b = 255, int a = 255, visibleTo = getRootElement( ) ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||Marker}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''x''': احداثيات الماركر x.&lt;br /&gt;
* '''y''': احداثيات الماركر y.&lt;br /&gt;
* '''z''': احداثيات ارتفاع الماركر z.&lt;br /&gt;
&lt;br /&gt;
===Optional arguments===&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
* '''theType''': نوع الماركر,شكل الماركر:&lt;br /&gt;
* '''size''': حجم الماركر الذي تريد صنعه.&lt;br /&gt;
* '''r''': (0 - 255)نسبة اللون الاحمر بالماركر بين.&lt;br /&gt;
* '''g''': (0 - 255)نسبة اللون الاخضر بالماركر بين.&lt;br /&gt;
* '''b''': (0 - 255)نسبة اللون الازرق بالماركر بين.&lt;br /&gt;
* '''a''': (0 - 255)نسبة ظهور الماركر 0 = مخفي ,وبعدها يبدأ يظهر&lt;br /&gt;
* '''visibleTo''': الالمنت الذي يستطيع رؤية الماركر [[visibility]].&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
marker createMarker ( float x, float y, float z [, string theType = &amp;quot;checkpoint&amp;quot;, float size = 4.0, int r = 0, int g = 0, int b = 255, int a = 255 ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||Marker}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''x''': احداثيات الماركر x.&lt;br /&gt;
* '''y''': احداثيات الماركر y.&lt;br /&gt;
* '''z''': احداثيات ارتفاع الماركر z.&lt;br /&gt;
&lt;br /&gt;
===Optional arguments===&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
* '''theType''': نوع الماركر,شكل الماركر&lt;br /&gt;
* '''size''': حجم الماركر الذي تريد صنعه.&lt;br /&gt;
* '''r''': (0 - 255)نسبة اللون الاحمر بالماركر بين.&lt;br /&gt;
* '''g''': (0 - 255)نسبة اللون الاخضر بالماركر بين.&lt;br /&gt;
* '''b''': (0 - 255)نسبة اللون الازرق بالماركر بين.&lt;br /&gt;
* '''a''': (0 - 255)نسبة ظهور الماركر 0 = مخفي ,وبعدها يبدأ يظهر .&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 1&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
هذا المثال يصنع ماركر بجانب الاعب:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function consoleCreateMarker ( thePlayer, commandName )&lt;br /&gt;
   if ( thePlayer ) then&lt;br /&gt;
      local x, y, z = getElementPosition ( thePlayer ) --يجيب احداثيات الاعب&lt;br /&gt;
      -- صنع ماركر بجانب الاعب:&lt;br /&gt;
      local theMarker = createMarker ( x + 2, y + 2, z, &amp;quot;cylinder&amp;quot;, 1.5, 255, 255, 0, 170 )&lt;br /&gt;
      if ( theMarker ) then &lt;br /&gt;
         outputConsole ( &amp;quot;تم صنع الماركر بنجاح&amp;quot;, thePlayer )&lt;br /&gt;
      else&lt;br /&gt;
         outputConsole ( &amp;quot;خطأ في صنع الماركر&amp;quot;, thePlayer )&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;createmarker&amp;quot;, consoleCreateMarker )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Marker functions}}&lt;br /&gt;
[[ru:createMarker]]&lt;br /&gt;
[[en:createMarker]]&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=RU/createMarker&amp;diff=46702</id>
		<title>RU/createMarker</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=RU/createMarker&amp;diff=46702"/>
		<updated>2016-02-19T16:42:27Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{RU/Server client function}}&lt;br /&gt;
Эта функция создает маркер. Маркер - это 3D-модель в игровом мире, которая может обозначить какую-либо точку или область, и часто используется, чтобы давать игрокам указания, где именно можно выполнять определенные действия, например, заходить в здание.&lt;br /&gt;
&lt;br /&gt;
Есть ограничения на максимальное число одновременно видимых маркеров, а именно:&lt;br /&gt;
* Короны: 32&lt;br /&gt;
* Чекпоинты, кольца, цилиндры и стрелки все в сумме: 32&lt;br /&gt;
&lt;br /&gt;
Создавать можно практически неограниченное число маркеров (при условии, что хватает памяти и ограничения по числу элементов), однако игрок сможет увидеть только ближайшие из них, и не более указанных ограничений.&lt;br /&gt;
&lt;br /&gt;
==Синтаксис==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
marker createMarker ( float x, float y, float z, [string theType, float size, int r, int g, int b, int a, visibleTo = getRootElement()] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Обязательные аргументы===&lt;br /&gt;
* '''x''': Вещественное число - координата X на карте.&lt;br /&gt;
* '''y''': Вещественное число - координата Y на карте.&lt;br /&gt;
* '''z''': Вещественное число - координата Z на карте.&lt;br /&gt;
&lt;br /&gt;
===Дополнительные аргументы===&lt;br /&gt;
{{RU/OptionalArg}}&lt;br /&gt;
* '''theType''': Внешний вид маркера. Доступны следующие типы:&lt;br /&gt;
{{RU/Marker_types}}&lt;br /&gt;
* '''size''': Диаметр маркера в метрах.&lt;br /&gt;
* '''r''': Целое число - количество красного компонента в цвете маркера (0 - 255).&lt;br /&gt;
* '''g''': Целое число - количество красного компонента в цвете маркера (0 - 255).&lt;br /&gt;
* '''b''': Целое число - количество красного компонента в цвете маркера (0 - 255).&lt;br /&gt;
* '''a''': Целое число - прозрачность маркера (0 - 255 где 0 - полностью прозрачный, а 255 - полностью непрозрачный).&lt;br /&gt;
* '''visibleTo''': Только этот элемент и его потомки смогут увидеть маркер. См.[[visibility]].&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
marker createMarker ( float x, float y, float z, [string theType, float size, int r, int g, int b, int a] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Обязательные аргументы===&lt;br /&gt;
* '''x''': Вещественное число - координата X на карте.&lt;br /&gt;
* '''y''': Вещественное число - координата Y на карте.&lt;br /&gt;
* '''z''': Вещественное число - координата Z на карте.&lt;br /&gt;
&lt;br /&gt;
===Дополнительные аргументы===&lt;br /&gt;
{{RU/OptionalArg}}&lt;br /&gt;
* '''theType''': Внешний вид маркера. Доступны следующие типы:&lt;br /&gt;
{{RU/Marker_types}}&lt;br /&gt;
* '''size''': Диаметр маркера в метрах.&lt;br /&gt;
* '''r''': Целое число - количество красного компонента в цвете маркера (0 - 255).&lt;br /&gt;
* '''g''': Целое число - количество красного компонента в цвете маркера (0 - 255).&lt;br /&gt;
* '''b''': Целое число - количество красного компонента в цвете маркера (0 - 255).&lt;br /&gt;
* '''a''': Целое число - прозрачность маркера (0 - 255 где 0 - полностью прозрачный, а 255 - полностью непрозрачный).&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Вывод===&lt;br /&gt;
Возвращает созданный [[marker|маркер]] , или ''false'' если были переданы некорректные аргументы.&lt;br /&gt;
&lt;br /&gt;
==Пример==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Пример 1&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
Создает рядом с игроком маркер, когда он вводит команду 'createmarker':&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- эта функция вызывается при вводе 'createmarker':&lt;br /&gt;
function consoleCreateMarker ( thePlayer, commandName )&lt;br /&gt;
   if ( thePlayer ) then&lt;br /&gt;
      local x, y, z = getElementPosition ( thePlayer ) -- get the player's position&lt;br /&gt;
      -- создаем цилиндрический маркер рядом с игроком&lt;br /&gt;
      local theMarker = createMarker ( x + 2, y + 2, z, &amp;quot;cylinder&amp;quot;, 1.5, 255, 255, 0, 170 )&lt;br /&gt;
      if ( theMarker ) then -- проверяем, что успешно создали маркер&lt;br /&gt;
         outputConsole ( &amp;quot;Marker created successfully&amp;quot;, thePlayer )&lt;br /&gt;
      else&lt;br /&gt;
         outputConsole ( &amp;quot;Failed to create marker&amp;quot;, thePlayer )&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;createmarker&amp;quot;, consoleCreateMarker )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Пример 2&amp;quot; class=&amp;quot;both&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
Создает маркер в точке 0, 0, 20:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
createMarker ( 0, 0, 20 )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Смотрите также==&lt;br /&gt;
{{RU/Marker functions}}&lt;br /&gt;
[[en:createMarker]]&lt;br /&gt;
[[ar:createMarker]]&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=CreateMarker&amp;diff=46701</id>
		<title>CreateMarker</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=CreateMarker&amp;diff=46701"/>
		<updated>2016-02-19T16:39:18Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function creates a marker. A marker is a 3D model in the world that can highlight a particular point or area, often used to instruct players where to go to perform actions such as entering buildings.&lt;br /&gt;
&lt;br /&gt;
There are various limits that govern the maximum number of each type that can be visible at once. These are:&lt;br /&gt;
* Coronas: 32&lt;br /&gt;
* Checkpoints, Rings, Cylinders and Arrows combined: 32&lt;br /&gt;
&lt;br /&gt;
You are able to create as many markers as you wish (memory and element limit permitting), but the player will only be able to see the nearest ones up to the limit.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
marker createMarker ( float x, float y, float z [, string theType = &amp;quot;checkpoint&amp;quot;, float size = 4.0, int r = 0, int g = 0, int b = 255, int a = 255, visibleTo = getRootElement( ) ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||Marker}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''x''': A floating point number representing the X coordinate on the map.&lt;br /&gt;
* '''y''': A floating point number representing the Y coordinate on the map.&lt;br /&gt;
* '''z''': A floating point number representing the Z coordinate on the map.&lt;br /&gt;
&lt;br /&gt;
===Optional arguments===&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
* '''theType''': The visual type of the marker to be created. Possible values:&lt;br /&gt;
{{Marker_types}}&lt;br /&gt;
* '''size''': The diameter of the marker to be created, in meters.&lt;br /&gt;
* '''r''': An integer number representing the amount of red to use in the colouring of the marker (0 - 255).&lt;br /&gt;
* '''g''': An integer number representing the amount of green to use in the colouring of the marker (0 - 255).&lt;br /&gt;
* '''b''': An integer number representing the amount of blue to use in the colouring of the marker (0 - 255).&lt;br /&gt;
* '''a''': An integer number representing the amount of alpha to use in the colouring of the marker (0 - 255 where 0 is transparent and 255 is opaque).&lt;br /&gt;
* '''visibleTo''': This defines which elements can see the marker. Defaults to visible to everyone. See [[visibility]].&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
marker createMarker ( float x, float y, float z [, string theType = &amp;quot;checkpoint&amp;quot;, float size = 4.0, int r = 0, int g = 0, int b = 255, int a = 255 ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||Marker}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''x''': A floating point number representing the X coordinate on the map.&lt;br /&gt;
* '''y''': A floating point number representing the Y coordinate on the map.&lt;br /&gt;
* '''z''': A floating point number representing the Z coordinate on the map.&lt;br /&gt;
&lt;br /&gt;
===Optional arguments===&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
* '''theType''': The visual type of the marker to be created. Possible values:&lt;br /&gt;
{{Marker_types}}&lt;br /&gt;
* '''size''': The diameter of the marker to be created, in meters.&lt;br /&gt;
* '''r''': An integer number representing the amount of red to use in the colouring of the marker (0 - 255).&lt;br /&gt;
* '''g''': An integer number representing the amount of green to use in the colouring of the marker (0 - 255).&lt;br /&gt;
* '''b''': An integer number representing the amount of blue to use in the colouring of the marker (0 - 255).&lt;br /&gt;
* '''a''': An integer number representing the amount of alpha to use in the colouring of the marker (0 - 255 where 0 is transparent and 255 is opaque).&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the [[marker]] element that was created, or ''false'' if the arguments are incorrect.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 1&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example creates a marker next to the player when they type 'createmarker':&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- this function is called whenever someone types 'createmarker' in the console:&lt;br /&gt;
function consoleCreateMarker ( thePlayer, commandName )&lt;br /&gt;
   if ( thePlayer ) then&lt;br /&gt;
      local x, y, z = getElementPosition ( thePlayer ) -- get the player's position&lt;br /&gt;
      -- create a cylindrical marker next to the player:&lt;br /&gt;
      local theMarker = createMarker ( x + 2, y + 2, z, &amp;quot;cylinder&amp;quot;, 1.5, 255, 255, 0, 170 )&lt;br /&gt;
      if ( theMarker ) then -- check if the marker was created successfully&lt;br /&gt;
         outputConsole ( &amp;quot;Marker created successfully&amp;quot;, thePlayer )&lt;br /&gt;
      else&lt;br /&gt;
         outputConsole ( &amp;quot;Failed to create marker&amp;quot;, thePlayer )&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;createmarker&amp;quot;, consoleCreateMarker )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Marker functions}}&lt;br /&gt;
[[ru:createMarker]]&lt;br /&gt;
[[ar:createMarker]]&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/createMarker&amp;diff=46700</id>
		<title>AR/createMarker</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/createMarker&amp;diff=46700"/>
		<updated>2016-02-19T16:38:25Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
هذه الوظيفة تستخدم لصنع ماركر .&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
marker createMarker ( float x, float y, float z [, string theType = &amp;quot;checkpoint&amp;quot;, float size = 4.0, int r = 0, int g = 0, int b = 255, int a = 255, visibleTo = getRootElement( ) ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||Marker}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''x''': احداثيات الماركر x.&lt;br /&gt;
* '''y''': احداثيات الماركر y.&lt;br /&gt;
* '''z''': احداثيات ارتفاع الماركر z.&lt;br /&gt;
&lt;br /&gt;
===Optional arguments===&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
* '''theType''': نوع الماركر,شكل الماركر:&lt;br /&gt;
* '''size''': حجم الماركر الذي تريد صنعه.&lt;br /&gt;
* '''r''': (0 - 255)نسبة اللون الاحمر بالماركر بين.&lt;br /&gt;
* '''g''': (0 - 255)نسبة اللون الاخضر بالماركر بين.&lt;br /&gt;
* '''b''': (0 - 255)نسبة اللون الازرق بالماركر بين.&lt;br /&gt;
* '''a''': (0 - 255)نسبة ظهور الماركر 0 = مخفي ,وبعدها يبدأ يظهر&lt;br /&gt;
* '''visibleTo''': الالمنت الذي يستطيع رؤية الماركر [[visibility]].&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
marker createMarker ( float x, float y, float z [, string theType = &amp;quot;checkpoint&amp;quot;, float size = 4.0, int r = 0, int g = 0, int b = 255, int a = 255 ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||Marker}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''x''': احداثيات الماركر x.&lt;br /&gt;
* '''y''': احداثيات الماركر y.&lt;br /&gt;
* '''z''': احداثيات ارتفاع الماركر z.&lt;br /&gt;
&lt;br /&gt;
===Optional arguments===&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
* '''theType''': نوع الماركر,شكل الماركر&lt;br /&gt;
* '''size''': حجم الماركر الذي تريد صنعه.&lt;br /&gt;
* '''r''': (0 - 255)نسبة اللون الاحمر بالماركر بين.&lt;br /&gt;
* '''g''': (0 - 255)نسبة اللون الاخضر بالماركر بين.&lt;br /&gt;
* '''b''': (0 - 255)نسبة اللون الازرق بالماركر بين.&lt;br /&gt;
* '''a''': (0 - 255)نسبة ظهور الماركر 0 = مخفي ,وبعدها يبدأ يظهر .&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 1&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
هذا المثال يصنع ماركر بجانب الاعب:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function consoleCreateMarker ( thePlayer, commandName )&lt;br /&gt;
   if ( thePlayer ) then&lt;br /&gt;
      local x, y, z = getElementPosition ( thePlayer ) --يجيب احداثيات الاعب&lt;br /&gt;
      -- صنع ماركر بجانب الاعب:&lt;br /&gt;
      local theMarker = createMarker ( x + 2, y + 2, z, &amp;quot;cylinder&amp;quot;, 1.5, 255, 255, 0, 170 )&lt;br /&gt;
      if ( theMarker ) then &lt;br /&gt;
         outputConsole ( &amp;quot;تم صنع الماركر بنجاح&amp;quot;, thePlayer )&lt;br /&gt;
      else&lt;br /&gt;
         outputConsole ( &amp;quot;خطأ في صنع الماركر&amp;quot;, thePlayer )&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;createmarker&amp;quot;, consoleCreateMarker )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Marker functions}}&lt;br /&gt;
[[ru:createMarker]]&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/setMarkerTarget&amp;diff=46691</id>
		<title>AR/setMarkerTarget</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/setMarkerTarget&amp;diff=46691"/>
		<updated>2016-02-16T18:47:41Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
__NOTOC__ &lt;br /&gt;
هذه الوظيفة تقوم بوضع الماركر باحداثيات محددة.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool setMarkerTarget ( marker theMarker, float x, float y, float z )    &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[Marker]]:setTarget|getMarkerTarget}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theMarker:''' الماركر الذي تريد وضع احداثيات له&lt;br /&gt;
*'''x:'''  احداثيات الماركر x .&lt;br /&gt;
*'''y:'''  احداثيات الماركر z .&lt;br /&gt;
*'''z:'''  احداثيات ارتفاع الماركر z .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
Creates a marker in the center of the map and points it north.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local marker = createMarker(0,0,0,&amp;quot;ring&amp;quot;,7,255,0,0,255) --نصنع ماركر&lt;br /&gt;
setMarkerTarget(marker,3000,0,0) --نضع الماركر باحداثيات&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Marker functions}}&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/Client_Scripting_Functions&amp;diff=46606</id>
		<title>AR/Client Scripting Functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/Client_Scripting_Functions&amp;diff=46606"/>
		<updated>2016-02-10T13:10:53Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;client&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
{{Adding_Pages_to_Categories_and_Templates}}&lt;br /&gt;
This page lists all the '''client-side''' scripting functions that have been implemented and are available as native functions from the Deathmatch mod. To request a function or event, use [[Requested Functions and Events]]&lt;br /&gt;
&lt;br /&gt;
For more functions, check the [[Useful_Functions|useful functions page]].&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==وظائف الصوت==&lt;br /&gt;
{{AR/Audio_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف علامات الخريطة==&lt;br /&gt;
{{AR/Blip_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الكاميرا==&lt;br /&gt;
{{AR/Camera_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الملابس==&lt;br /&gt;
{{AR/Client_Clothes and body functions}}&lt;br /&gt;
&lt;br /&gt;
==Collision shape functions==&lt;br /&gt;
{{AR/Collision_shape_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الأسهم==&lt;br /&gt;
{{AR/Client_cursor_functions}}&lt;br /&gt;
&lt;br /&gt;
== وظائف الرسم==&lt;br /&gt;
{{AR/Drawing_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف التأثيرات==&lt;br /&gt;
{{AR/Client_Effects_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف العناصر==&lt;br /&gt;
{{AR/Client_Element_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف المحرك==&lt;br /&gt;
{{AR/Engine_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الحدث==&lt;br /&gt;
{{AR/Client_event_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الانفجارات==&lt;br /&gt;
{{AR/Client_explosion_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الملف==&lt;br /&gt;
{{AR/Client file functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الحريق==&lt;br /&gt;
{{AR/Client fire functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف واجهة المستخدم الرسومية==&lt;br /&gt;
{{AR/GUI_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف مدخلات==&lt;br /&gt;
{{AR/Client_input_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظيفة العلامات==&lt;br /&gt;
{{AR/Client_marker_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف لهدف معين==&lt;br /&gt;
{{AR/Client_object_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الإخراج==&lt;br /&gt;
{{AR/Client_output_functions}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==وظائف الدعم==&lt;br /&gt;
{{AR/Client_pickup_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الاعب==&lt;br /&gt;
{{AR/Client_player_functions}}&lt;br /&gt;
&lt;br /&gt;
==Projectile functions==&lt;br /&gt;
{{AR/Client_projectile_functions}}&lt;br /&gt;
&lt;br /&gt;
==Radar-area functions==&lt;br /&gt;
{{AR/Client_radar-area_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الموارد==&lt;br /&gt;
{{AR/Client_resource_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف فريق==&lt;br /&gt;
{{AR/Client_team_functions}}&lt;br /&gt;
&lt;br /&gt;
==Utility functions==&lt;br /&gt;
{{AR/Client_utility_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف السيارة==&lt;br /&gt;
{{AR/Client_vehicle_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف المياه==&lt;br /&gt;
{{AR/Client_water_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف سلاح==&lt;br /&gt;
{{AR/Client_weapon_functions}}&lt;br /&gt;
&lt;br /&gt;
==Weapon Creation functions==&lt;br /&gt;
Documentation can be found [http://code.google.com/p/mtasa-blue/source/detail?r=4555 here] and [http://code.google.com/p/mtasa-blue/source/detail?r=4557 here]&lt;br /&gt;
{{AR/Client_weapon_creation_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف العالم==&lt;br /&gt;
{{AR/Client_world_functions}}&lt;br /&gt;
&lt;br /&gt;
==XML functions==&lt;br /&gt;
{{AR/Client XML functions}}&lt;br /&gt;
&lt;br /&gt;
[[ar:Client Scripting Functions]]&lt;br /&gt;
[[en:Client Scripting Functions]]&lt;br /&gt;
[[pl:Funkcje po stronie klienta]]&lt;br /&gt;
[[it:Funzioni Client-side]]&lt;br /&gt;
[[ru:Client Scripting Functions]]&lt;br /&gt;
[[de:Clientseitige_Funktionen]]&lt;br /&gt;
[[tr:Client Taraflı Fonksiyonlar]]&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/Client_Scripting_Functions&amp;diff=46605</id>
		<title>AR/Client Scripting Functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/Client_Scripting_Functions&amp;diff=46605"/>
		<updated>2016-02-10T13:10:38Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;client&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
{{Adding_Pages_to_Categories_and_Templates}}&lt;br /&gt;
This page lists all the '''client-side''' scripting functions that have been implemented and are available as native functions from the Deathmatch mod. To request a function or event, use [[Requested Functions and Events]]&lt;br /&gt;
&lt;br /&gt;
For more functions, check the [[Useful_Functions|useful functions page]].&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==وظائف الصوت==&lt;br /&gt;
{{AR/Audio_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف علامات الخريطة==&lt;br /&gt;
{{AR/Blip_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الكاميرا==&lt;br /&gt;
{{AR/Camera_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الملابس==&lt;br /&gt;
{{AR/Client_Clothes and body functions}}&lt;br /&gt;
&lt;br /&gt;
==Collision shape functions==&lt;br /&gt;
{{AR/Collision_shape_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الأسهم==&lt;br /&gt;
{{AR/Client_cursor_functions}}&lt;br /&gt;
&lt;br /&gt;
== وظائف الرسم==&lt;br /&gt;
{{AR/Drawing_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف التأثيرات==&lt;br /&gt;
{{AR/Client_Effects_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف العناصر==&lt;br /&gt;
{{AR/Client_Element_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف المحرك==&lt;br /&gt;
{{AR/Engine_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الحدث==&lt;br /&gt;
{{AR/Client_event_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الانفجارات==&lt;br /&gt;
{{AR/Client_explosion_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الملف==&lt;br /&gt;
{{AR/Client file functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الحريق==&lt;br /&gt;
{{AR/Client fire functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف واجهة المستخدم الرسومية==&lt;br /&gt;
{{AR/GUI_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف مدخلات==&lt;br /&gt;
{{AR/Client_input_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظيفة العلامات==&lt;br /&gt;
{{AR/Client_marker_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف لهدف معين==&lt;br /&gt;
{{AR/Client_object_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الإخراج==&lt;br /&gt;
{{AR/Client_output_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الجسم==&lt;br /&gt;
{{AR/Client_ped_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الدعم==&lt;br /&gt;
{{AR/Client_pickup_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الاعب==&lt;br /&gt;
{{AR/Client_player_functions}}&lt;br /&gt;
&lt;br /&gt;
==Projectile functions==&lt;br /&gt;
{{AR/Client_projectile_functions}}&lt;br /&gt;
&lt;br /&gt;
==Radar-area functions==&lt;br /&gt;
{{AR/Client_radar-area_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الموارد==&lt;br /&gt;
{{AR/Client_resource_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف فريق==&lt;br /&gt;
{{AR/Client_team_functions}}&lt;br /&gt;
&lt;br /&gt;
==Utility functions==&lt;br /&gt;
{{AR/Client_utility_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف السيارة==&lt;br /&gt;
{{AR/Client_vehicle_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف المياه==&lt;br /&gt;
{{AR/Client_water_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف سلاح==&lt;br /&gt;
{{AR/Client_weapon_functions}}&lt;br /&gt;
&lt;br /&gt;
==Weapon Creation functions==&lt;br /&gt;
Documentation can be found [http://code.google.com/p/mtasa-blue/source/detail?r=4555 here] and [http://code.google.com/p/mtasa-blue/source/detail?r=4557 here]&lt;br /&gt;
{{AR/Client_weapon_creation_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف العالم==&lt;br /&gt;
{{AR/Client_world_functions}}&lt;br /&gt;
&lt;br /&gt;
==XML functions==&lt;br /&gt;
{{AR/Client XML functions}}&lt;br /&gt;
&lt;br /&gt;
[[ar:Client Scripting Functions]]&lt;br /&gt;
[[en:Client Scripting Functions]]&lt;br /&gt;
[[pl:Funkcje po stronie klienta]]&lt;br /&gt;
[[it:Funzioni Client-side]]&lt;br /&gt;
[[ru:Client Scripting Functions]]&lt;br /&gt;
[[de:Clientseitige_Funktionen]]&lt;br /&gt;
[[tr:Client Taraflı Fonksiyonlar]]&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/Client_Scripting_Functions&amp;diff=46604</id>
		<title>AR/Client Scripting Functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/Client_Scripting_Functions&amp;diff=46604"/>
		<updated>2016-02-10T13:09:58Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;client&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
{{Adding_Pages_to_Categories_and_Templates}}&lt;br /&gt;
This page lists all the '''client-side''' scripting functions that have been implemented and are available as native functions from the Deathmatch mod. To request a function or event, use [[Requested Functions and Events]]&lt;br /&gt;
&lt;br /&gt;
For more functions, check the [[Useful_Functions|useful functions page]].&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==وظائف الصوت==&lt;br /&gt;
{{AR/Audio_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف علامات الخريطة==&lt;br /&gt;
{{AR/Blip_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الكاميرا==&lt;br /&gt;
{{AR/Camera_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الملابس==&lt;br /&gt;
{{AR/Client_Clothes and body functions}}&lt;br /&gt;
&lt;br /&gt;
==Collision shape functions==&lt;br /&gt;
{{AR/Collision_shape_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الأسهم==&lt;br /&gt;
{{AR/Client_cursor_functions}}&lt;br /&gt;
&lt;br /&gt;
== وظائف الرسم==&lt;br /&gt;
{{AR/Drawing_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف التأثيرات==&lt;br /&gt;
{{AR/Client_Effects_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف العناصر==&lt;br /&gt;
{{AR/Client_Element_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف المحرك==&lt;br /&gt;
{{AR/Engine_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الحدث==&lt;br /&gt;
{{AR/Client_event_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الانفجارات==&lt;br /&gt;
{{AR/Client_explosion_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الملف==&lt;br /&gt;
{{AR/Client file functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الحريق==&lt;br /&gt;
{{AR/Client fire functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف واجهة المستخدم الرسومية==&lt;br /&gt;
{{AR/GUI_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف مدخلات==&lt;br /&gt;
{{AR/Client_input_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظيفة العلامات==&lt;br /&gt;
{{AR/Client_marker_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف لهدف معين==&lt;br /&gt;
{{AR/Client_object_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الإخراج==&lt;br /&gt;
{{AR/Client_output_functions}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==وظائف الدعم==&lt;br /&gt;
{{AR/Client_pickup_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الاعب==&lt;br /&gt;
{{AR/Client_player_functions}}&lt;br /&gt;
&lt;br /&gt;
==Projectile functions==&lt;br /&gt;
{{AR/Client_projectile_functions}}&lt;br /&gt;
&lt;br /&gt;
==Radar-area functions==&lt;br /&gt;
{{AR/Client_radar-area_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الموارد==&lt;br /&gt;
{{AR/Client_resource_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف فريق==&lt;br /&gt;
{{AR/Client_team_functions}}&lt;br /&gt;
&lt;br /&gt;
==Utility functions==&lt;br /&gt;
{{AR/Client_utility_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف السيارة==&lt;br /&gt;
{{AR/Client_vehicle_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف المياه==&lt;br /&gt;
{{AR/Client_water_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف سلاح==&lt;br /&gt;
{{AR/Client_weapon_functions}}&lt;br /&gt;
&lt;br /&gt;
==Weapon Creation functions==&lt;br /&gt;
Documentation can be found [http://code.google.com/p/mtasa-blue/source/detail?r=4555 here] and [http://code.google.com/p/mtasa-blue/source/detail?r=4557 here]&lt;br /&gt;
{{AR/Client_weapon_creation_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف العالم==&lt;br /&gt;
{{AR/Client_world_functions}}&lt;br /&gt;
&lt;br /&gt;
==XML functions==&lt;br /&gt;
{{AR/Client XML functions}}&lt;br /&gt;
&lt;br /&gt;
[[ar:Client Scripting Functions]]&lt;br /&gt;
[[en:Client Scripting Functions]]&lt;br /&gt;
[[pl:Funkcje po stronie klienta]]&lt;br /&gt;
[[it:Funzioni Client-side]]&lt;br /&gt;
[[ru:Client Scripting Functions]]&lt;br /&gt;
[[de:Clientseitige_Funktionen]]&lt;br /&gt;
[[tr:Client Taraflı Fonksiyonlar]]&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/Client_Scripting_Functions&amp;diff=46603</id>
		<title>AR/Client Scripting Functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/Client_Scripting_Functions&amp;diff=46603"/>
		<updated>2016-02-10T13:09:15Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;client&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
{{Adding_Pages_to_Categories_and_Templates}}&lt;br /&gt;
This page lists all the '''client-side''' scripting functions that have been implemented and are available as native functions from the Deathmatch mod. To request a function or event, use [[Requested Functions and Events]]&lt;br /&gt;
&lt;br /&gt;
For more functions, check the [[Useful_Functions|useful functions page]].&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==وظائف الصوت==&lt;br /&gt;
{{AR/Audio_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف علامات الخريطة==&lt;br /&gt;
{{AR/Blip_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الكاميرا==&lt;br /&gt;
{{AR/Camera_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الملابس==&lt;br /&gt;
{{AR/Client_Clothes and body functions}}&lt;br /&gt;
&lt;br /&gt;
==Collision shape functions==&lt;br /&gt;
{{AR/Collision_shape_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الأسهم==&lt;br /&gt;
{{AR/Client_cursor_functions}}&lt;br /&gt;
&lt;br /&gt;
== وظائف الرسم==&lt;br /&gt;
{{AR/Drawing_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف التأثيرات==&lt;br /&gt;
{{AR/Client_Effects_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف العناصر==&lt;br /&gt;
{{AR/Client_Element_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف المحرك==&lt;br /&gt;
{{AR/Engine_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الحدث==&lt;br /&gt;
{{AR/Client_event_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الانفجارات==&lt;br /&gt;
{{AR/Client_explosion_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الملف==&lt;br /&gt;
{{AR/Client file functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الحريق==&lt;br /&gt;
{{AR/Client fire functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف واجهة المستخدم الرسومية==&lt;br /&gt;
{{AR/GUI_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف مدخلات==&lt;br /&gt;
{{AR/Client_input_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظيفة العلامات==&lt;br /&gt;
{{AR/Client_marker_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف لهدف معين==&lt;br /&gt;
{{AR/Client_object_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الإخراج==&lt;br /&gt;
{{AR/Client_output_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الجسم==&lt;br /&gt;
&lt;br /&gt;
{{AR/Client_ped_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الدعم==&lt;br /&gt;
{{AR/Client_pickup_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الاعب==&lt;br /&gt;
{{AR/Client_player_functions}}&lt;br /&gt;
&lt;br /&gt;
==Projectile functions==&lt;br /&gt;
{{AR/Client_projectile_functions}}&lt;br /&gt;
&lt;br /&gt;
==Radar-area functions==&lt;br /&gt;
{{AR/Client_radar-area_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الموارد==&lt;br /&gt;
{{AR/Client_resource_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف فريق==&lt;br /&gt;
{{AR/Client_team_functions}}&lt;br /&gt;
&lt;br /&gt;
==Utility functions==&lt;br /&gt;
{{AR/Client_utility_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف السيارة==&lt;br /&gt;
{{AR/Client_vehicle_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف المياه==&lt;br /&gt;
{{AR/Client_water_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف سلاح==&lt;br /&gt;
{{AR/Client_weapon_functions}}&lt;br /&gt;
&lt;br /&gt;
==Weapon Creation functions==&lt;br /&gt;
Documentation can be found [http://code.google.com/p/mtasa-blue/source/detail?r=4555 here] and [http://code.google.com/p/mtasa-blue/source/detail?r=4557 here]&lt;br /&gt;
{{AR/Client_weapon_creation_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف العالم==&lt;br /&gt;
{{AR/Client_world_functions}}&lt;br /&gt;
&lt;br /&gt;
==XML functions==&lt;br /&gt;
{{AR/Client XML functions}}&lt;br /&gt;
&lt;br /&gt;
[[ar:Client Scripting Functions]]&lt;br /&gt;
[[en:Client Scripting Functions]]&lt;br /&gt;
[[pl:Funkcje po stronie klienta]]&lt;br /&gt;
[[it:Funzioni Client-side]]&lt;br /&gt;
[[ru:Client Scripting Functions]]&lt;br /&gt;
[[de:Clientseitige_Funktionen]]&lt;br /&gt;
[[tr:Client Taraflı Fonksiyonlar]]&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:AR/Client_ped_functions&amp;diff=46602</id>
		<title>Template:AR/Client ped functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Template:AR/Client_ped_functions&amp;diff=46602"/>
		<updated>2016-02-10T13:08:31Z</updated>

		<summary type="html">&lt;p&gt;Jaber: Blanked the page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:AR/Client_ped_functions&amp;diff=46601</id>
		<title>Template:AR/Client ped functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Template:AR/Client_ped_functions&amp;diff=46601"/>
		<updated>2016-02-10T13:08:23Z</updated>

		<summary type="html">&lt;p&gt;Jaber: /* Syntax */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}}&lt;br /&gt;
Creates a Ped in the GTA world.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example creates an ped when the resource starts:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function pedLoad ( name )&lt;br /&gt;
   createPed ( 120, 5540.6654, 1020.55122, 1240.545 )&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onResourceStart&amp;quot;, getResourceRootElement(), pedLoad )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example creates a ped, and makes it damage proof:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
thePed = createPed(120, 5540.6654, 1020.55122, 1240.545) -- Creates a ped&lt;br /&gt;
function cancelPedDamage()&lt;br /&gt;
	cancelEvent() -- Cancels the onClientPedDamage event&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientPedDamage&amp;quot;, thePed, cancelPedDamage) -- When thePed is damaged, cancelPedDamage is called&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Issues==&lt;br /&gt;
{{Issues|&lt;br /&gt;
{{Issue|7970|Peds with weapons malfunction due to weird totalAmmo and ammoInClip values}}&lt;br /&gt;
{{Issue|7371|Network troubled players can ruin ped sync}}&lt;br /&gt;
{{Issue|6048|Ped weapon isn't synced on join}}&lt;br /&gt;
{{Issue|5113|setPedControlState doesn't work on the control &amp;quot;enter_exit&amp;quot;}}&lt;br /&gt;
{{Issue|6287|Sync distance of unoccupied vehicles and peds should match stream distance}}&lt;br /&gt;
{{Issue|8790|Using setElementHealth on a dead ped makes it invincible}}&lt;br /&gt;
{{Issue|5725|Ped fireing Projectiles doesn't work}}&lt;br /&gt;
{{Issue|4921|Improve ped synchronization}}&lt;br /&gt;
{{Issue|5840|ped position not synced to server after falling through the ground}}&lt;br /&gt;
{{Issue|6682|Server doesnt update ped position after warping it to vehicle}}&lt;br /&gt;
{{Issue|6506|Ped animation is only visible if it was set while player was in stream distance from source ped}}&lt;br /&gt;
{{Issue|4596|Serverside peds have their animations not applied for joining players}}&lt;br /&gt;
{{Issue|4504|Peds shooting incorrectly}}&lt;br /&gt;
{{Issue|4008|Can't use giveWeapon() directly after createPed()}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Ped functions}}&lt;br /&gt;
[[ru:createPed]]&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:AR/Client_ped_functions&amp;diff=46600</id>
		<title>Template:AR/Client ped functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Template:AR/Client_ped_functions&amp;diff=46600"/>
		<updated>2016-02-10T13:07:42Z</updated>

		<summary type="html">&lt;p&gt;Jaber: createPed&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}}&lt;br /&gt;
Creates a Ped in the GTA world.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;ped createPed ( int modelid, float x, float y, float z [, float rot = 0.0, bool synced = true ] )&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''modelid:''' A whole integer specifying the [[Character_Skins|GTASA skin ID]].&lt;br /&gt;
*'''x:''' A floating point number representing the X coordinate on the map.&lt;br /&gt;
*'''y:''' A floating point number representing the Y coordinate on the map.&lt;br /&gt;
*'''z:''' A floating point number representing the Z coordinate on the map.&lt;br /&gt;
&lt;br /&gt;
==Optional Arguments==&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
*'''rot:''' A floating point number representing the rotation in degrees. &lt;br /&gt;
*'''synced:''' A boolean value representing whether or not the ped will be synced. Disabling the sync might be useful for frozen or static peds to increase the server performance.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;ped createPed ( int modelid, float x, float y, float z [, float rot = 0.0 ] )&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''modelid:''' A whole integer specifying the [[Character_Skins|GTASA skin ID]].&lt;br /&gt;
*'''x:''' A floating point number representing the X coordinate on the map.&lt;br /&gt;
*'''y:''' A floating point number representing the Y coordinate on the map.&lt;br /&gt;
*'''z:''' A floating point number representing the Z coordinate on the map.&lt;br /&gt;
&lt;br /&gt;
==Optional Arguments==&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
*'''rot:''' A floating point number representing the rotation in degrees. &lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a ped element if it was successfully created.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example creates an ped when the resource starts:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function pedLoad ( name )&lt;br /&gt;
   createPed ( 120, 5540.6654, 1020.55122, 1240.545 )&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onResourceStart&amp;quot;, getResourceRootElement(), pedLoad )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example creates a ped, and makes it damage proof:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
thePed = createPed(120, 5540.6654, 1020.55122, 1240.545) -- Creates a ped&lt;br /&gt;
function cancelPedDamage()&lt;br /&gt;
	cancelEvent() -- Cancels the onClientPedDamage event&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientPedDamage&amp;quot;, thePed, cancelPedDamage) -- When thePed is damaged, cancelPedDamage is called&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Issues==&lt;br /&gt;
{{Issues|&lt;br /&gt;
{{Issue|7970|Peds with weapons malfunction due to weird totalAmmo and ammoInClip values}}&lt;br /&gt;
{{Issue|7371|Network troubled players can ruin ped sync}}&lt;br /&gt;
{{Issue|6048|Ped weapon isn't synced on join}}&lt;br /&gt;
{{Issue|5113|setPedControlState doesn't work on the control &amp;quot;enter_exit&amp;quot;}}&lt;br /&gt;
{{Issue|6287|Sync distance of unoccupied vehicles and peds should match stream distance}}&lt;br /&gt;
{{Issue|8790|Using setElementHealth on a dead ped makes it invincible}}&lt;br /&gt;
{{Issue|5725|Ped fireing Projectiles doesn't work}}&lt;br /&gt;
{{Issue|4921|Improve ped synchronization}}&lt;br /&gt;
{{Issue|5840|ped position not synced to server after falling through the ground}}&lt;br /&gt;
{{Issue|6682|Server doesnt update ped position after warping it to vehicle}}&lt;br /&gt;
{{Issue|6506|Ped animation is only visible if it was set while player was in stream distance from source ped}}&lt;br /&gt;
{{Issue|4596|Serverside peds have their animations not applied for joining players}}&lt;br /&gt;
{{Issue|4504|Peds shooting incorrectly}}&lt;br /&gt;
{{Issue|4008|Can't use giveWeapon() directly after createPed()}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Ped functions}}&lt;br /&gt;
[[ru:createPed]]&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AR/Client_Scripting_Functions&amp;diff=46599</id>
		<title>AR/Client Scripting Functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AR/Client_Scripting_Functions&amp;diff=46599"/>
		<updated>2016-02-10T13:03:23Z</updated>

		<summary type="html">&lt;p&gt;Jaber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pageclass class=&amp;quot;client&amp;quot;&amp;gt;&amp;lt;/pageclass&amp;gt;&lt;br /&gt;
{{Adding_Pages_to_Categories_and_Templates}}&lt;br /&gt;
This page lists all the '''client-side''' scripting functions that have been implemented and are available as native functions from the Deathmatch mod. To request a function or event, use [[Requested Functions and Events]]&lt;br /&gt;
&lt;br /&gt;
For more functions, check the [[Useful_Functions|useful functions page]].&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==وظائف الصوت==&lt;br /&gt;
{{AR/Audio_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف علامات الخريطة==&lt;br /&gt;
{{AR/Blip_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الكاميرا==&lt;br /&gt;
{{AR/Camera_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الملابس==&lt;br /&gt;
{{AR/Client_Clothes and body functions}}&lt;br /&gt;
&lt;br /&gt;
==Collision shape functions==&lt;br /&gt;
{{AR/Collision_shape_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الأسهم==&lt;br /&gt;
{{AR/Client_cursor_functions}}&lt;br /&gt;
&lt;br /&gt;
== وظائف الرسم==&lt;br /&gt;
{{AR/Drawing_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف التأثيرات==&lt;br /&gt;
{{AR/Client_Effects_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف العناصر==&lt;br /&gt;
{{AR/Client_Element_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف المحرك==&lt;br /&gt;
{{AR/Engine_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الحدث==&lt;br /&gt;
{{AR/Client_event_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الانفجارات==&lt;br /&gt;
{{AR/Client_explosion_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الملف==&lt;br /&gt;
{{AR/Client file functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الحريق==&lt;br /&gt;
{{AR/Client fire functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف واجهة المستخدم الرسومية==&lt;br /&gt;
{{AR/GUI_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف مدخلات==&lt;br /&gt;
{{AR/Client_input_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظيفة العلامات==&lt;br /&gt;
{{AR/Client_marker_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف لهدف معين==&lt;br /&gt;
{{AR/Client_object_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الإخراج==&lt;br /&gt;
{{AR/Client_output_functions}}&lt;br /&gt;
&lt;br /&gt;
==Ped functions==&lt;br /&gt;
{{AR/Client_ped_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الجسم==&lt;br /&gt;
{{AR/Client_ped_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الدعم==&lt;br /&gt;
{{AR/Client_pickup_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الاعب==&lt;br /&gt;
{{AR/Client_player_functions}}&lt;br /&gt;
&lt;br /&gt;
==Projectile functions==&lt;br /&gt;
{{AR/Client_projectile_functions}}&lt;br /&gt;
&lt;br /&gt;
==Radar-area functions==&lt;br /&gt;
{{AR/Client_radar-area_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف الموارد==&lt;br /&gt;
{{AR/Client_resource_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف فريق==&lt;br /&gt;
{{AR/Client_team_functions}}&lt;br /&gt;
&lt;br /&gt;
==Utility functions==&lt;br /&gt;
{{AR/Client_utility_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف السيارة==&lt;br /&gt;
{{AR/Client_vehicle_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف المياه==&lt;br /&gt;
{{AR/Client_water_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف سلاح==&lt;br /&gt;
{{AR/Client_weapon_functions}}&lt;br /&gt;
&lt;br /&gt;
==Weapon Creation functions==&lt;br /&gt;
Documentation can be found [http://code.google.com/p/mtasa-blue/source/detail?r=4555 here] and [http://code.google.com/p/mtasa-blue/source/detail?r=4557 here]&lt;br /&gt;
{{AR/Client_weapon_creation_functions}}&lt;br /&gt;
&lt;br /&gt;
==وظائف العالم==&lt;br /&gt;
{{AR/Client_world_functions}}&lt;br /&gt;
&lt;br /&gt;
==XML functions==&lt;br /&gt;
{{AR/Client XML functions}}&lt;br /&gt;
&lt;br /&gt;
[[ar:Client Scripting Functions]]&lt;br /&gt;
[[en:Client Scripting Functions]]&lt;br /&gt;
[[pl:Funkcje po stronie klienta]]&lt;br /&gt;
[[it:Funzioni Client-side]]&lt;br /&gt;
[[ru:Client Scripting Functions]]&lt;br /&gt;
[[de:Clientseitige_Funktionen]]&lt;br /&gt;
[[tr:Client Taraflı Fonksiyonlar]]&lt;/div&gt;</summary>
		<author><name>Jaber</name></author>
	</entry>
</feed>