Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 23/08/18 in all areas

  1. Team1 = createTeam("Ballas", 155, 0, 155) Team2 = createTeam("Grove", 0, 155, 0) addCommandHandler('join', function(player) setElementData(resourceRoot,"any",math.random(0,1)) local Data = getElementData(resourceRoot,"any") if (Data == 1) then setPlayerTeam(player,Team1) outputChatBox('Ballas Team',player,255,0,0,true) elseif (Data == 0) then setPlayerTeam(player,Team2) outputChatBox('Grove Team',player,0,255,0,true) end end ) دي طريقة مش مجربها لاني علي جوال
    1 point
  2. جرب ذا function gimmeATeam(source) local newTeam = createTeam( "TestTeam", 255, 0, 0 ) -- create a new team with the specified name if newTeam then -- if it was successfully created setPlayerTeam(source, newTeam) -- add the player to the new team end end addCommandHandler("join", gimmeATeam)
    1 point
  3. عفوا في خدمتك : )
    1 point
  4. function onEventStart ( res ) outputChatBox ( "#FB00FF• Team Deathmatch #ffffffevent started. Type ''#FB00FF/join#ffffff'' #ffffffto join this event", getRootElement(), 255, 255, 255, true) end addEventHandler ( "onResourceStart", getRootElement(), onEventStart ) function changedimension ( source ) if getElementDimension ( source ) == 1 then return outputChatBox ( "#FB00FF• You are already in the event", getRootElement(), 255, 255, 255, true);end setElementDimension ( source, 1 ) -- set his dimension to 1 setElementPosition ( source, 260.8466796875, 1851.8400878906, 8.7578125 ) outputChatBox ( "#FB00FF• You have been joined the event", getRootElement(), 255, 255, 255, true) return end addCommandHandler ( "join", changedimension ) function changedimension ( source ) setElementDimension ( source, 0 ) -- set his dimension to 1 setElementPosition ( source, 354.04452514648, 2532.6301269531, 16.720027923584 ) outputChatBox ( "#FB00FF• You have been left the event", getRootElement(), 255, 255, 255, true) end addCommandHandler ( "leave", changedimension )
    1 point
  5. -- [ تم اضافة استراحة ثري دي + ماب ديرة وخيمة ثري دي ] -- [ F5AMAH TEAM _ من قبل : [ فريق فخامة -- [ المجلس في الاستراحة ] -- -- [ استراحة المنزل ] -- -- [ الكراج ] -- -- [ ثانيا ماب الديرة والخيمة الجديدة ] -- كان معكمـ * MrKAREEM اخوكم *
    1 point
  6. Uma maneira de funcionar da maneira que você falou (ativar/desativar os scripts de um resource apenas para o jogador que acionou o comando) é 1. Ler o arquivo meta.xml do resource especificado; 2. Identificar os scripts (.lua) e arquivos (dff/txd/col) percorrendo o xml; 3. Carregar os scripts com loadstring() no lado cliente (necessário ler no lado server e depois transferir); 4. Ler no lado server e transferir para o lado cliente os arquivos (dff/txd/col) e então salva-los; 5. Identificar os modelos substituídos para então retorna-lo ao estado original quando desejado (sobrescrevendo funções do tipo: engineReplaceModel() para conseguir armazenar o ID substituído). Para funcionar o exemplo acima, é necessário que os resources não sejam ativados (apenas deve manter ON o script responsável pela leitura dos resources)! O mais inviável seria o passo (4), talvez adaptar os resources, mudando no meta.xml as tags <script> por <file> dos arquivos .lua e então ativar os resources normalmente, para então baixar os mods (mas não trabalhar os scripts) seria uma boa... Falei o mais simplificado possível, e é necessário um conhecimento intermediário / avançado para construir algo do tipo! Vá por mim, procure outros métodos, e tente utilizar em apenas um resources, unindo todos seus mods de veículos/texturas e etc. Será bem mais fácil fazer o que você quer (desativar/ativar mods)
    1 point
  7. Recunosc ca nu l-am facut eu singur ci cu ajutor de la un prieten. Doar ce m-am apucat sa invat lucrurile de baza de pe wiki.
    1 point
  8. local screenW, screenH = guiGetScreenSize() function hudrcn () -------------------------------------------------- local health = getElementHealth(localPlayer) local armour = getPedArmor(localPlayer) local currentammo = getPedAmmoInClip(localPlayer) local maxammo = getPedTotalAmmo(localPlayer)-(currentammo) local oxygen = getPedOxygenLevel(localPlayer) local money = getPlayerMoney(localPlayer) -------------------------------------------------- setPlayerHudComponentVisible("clock",false) setPlayerHudComponentVisible("armour",false) setPlayerHudComponentVisible("breath",false) setPlayerHudComponentVisible("health",false) setPlayerHudComponentVisible("money",false) setPlayerHudComponentVisible("wanted",false) setPlayerHudComponentVisible("weapon",false) setPlayerHudComponentVisible("ammo",false) ---------------------------------------------------- dxDrawLine((screenW * 0.8625) - 1, (screenH * 0.0511) - 1, (screenW * 0.8625) - 1, screenH * 0.0889, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.9769, (screenH * 0.0511) - 1, (screenW * 0.8625) - 1, (screenH * 0.0511) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawLine((screenW * 0.8625) - 1, screenH * 0.0889, screenW * 0.9769, screenH * 0.0889, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.9769, screenH * 0.0889, screenW * 0.9769, (screenH * 0.0511) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawRectangle(screenW * 0.8625, screenH * 0.0511, screenW * 0.1144, screenH * 0.0378, tocolor(31, 30, 31, 170), false) dxDrawLine((screenW * 0.8625) - 1, (screenH * 0.0511) - 1, (screenW * 0.8625) - 1, screenH * 0.0889, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.9769, (screenH * 0.0511) - 1, (screenW * 0.8625) - 1, (screenH * 0.0511) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawLine((screenW * 0.8625) - 1, screenH * 0.0889, screenW * 0.9769, screenH * 0.0889, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.9769, screenH * 0.0889, screenW * 0.9769, (screenH * 0.0511) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawRectangle(screenW * 0.8625, screenH * 0.0511, screenW * 0.1144, screenH * 0.0378, tocolor(201, 0, 0, 255), false) dxDrawText("Health 0%",..math.floor(health).."%", (screenW * 0.9000) - 1, (screenH * 0.0622) - 1, (screenW * 1.1019) - 1, (screenH * 0.1522) - 1, tocolor(0, 0, 0, 255), 0.55, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Health 0%",..math.floor(health).."%", (screenW * 0.9000) + 1, (screenH * 0.0622) - 1, (screenW * 1.1019) + 1, (screenH * 0.1522) - 1, tocolor(0, 0, 0, 255), 0.55, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Health 0%",..math.floor(health).."%", (screenW * 0.9000) - 1, (screenH * 0.0622) + 1, (screenW * 1.1019) - 1, (screenH * 0.1522) + 1, tocolor(0, 0, 0, 255), 0.55, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Health 0%",..math.floor(health).."%", (screenW * 0.9000) + 1, (screenH * 0.0622) + 1, (screenW * 1.1019) + 1, (screenH * 0.1522) + 1, tocolor(0, 0, 0, 255), 0.55, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Health 0%",..math.floor(health).."%", screenW * 0.9000, screenH * 0.0622, screenW * 1.1019, screenH * 0.1522, tocolor(255, 254, 254, 255), 0.55, "bankgothic", "left", "top", false, false, false, false, false) dxDrawRectangle(screenW * 0.8625, screenH * 0.1078, screenW * 0.1144, screenH * 0.0389, tocolor(38, 39, 38, 212), false) dxDrawLine((screenW * 0.8625) - 1, (screenH * 0.1089) - 1, (screenW * 0.8625) - 1, screenH * 0.1467, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.9769, (screenH * 0.1089) - 1, (screenW * 0.8625) - 1, (screenH * 0.1089) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawLine((screenW * 0.8625) - 1, screenH * 0.1467, screenW * 0.9769, screenH * 0.1467, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.9769, screenH * 0.1467, screenW * 0.9769, (screenH * 0.1089) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawRectangle(screenW * 0.8625, screenH * 0.1089, screenW * 0.1144, screenH * 0.0378, tocolor(255, 255, 255, 187), false) dxDrawText("Armour 0%",..math.floor(armour).."%", (screenW * 0.9000) - 1, (screenH * 0.1200) - 1, (screenW * 1.0263) - 1, (screenH * 0.1844) - 1, tocolor(0, 0, 0, 255), 0.55, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Armour 0%",..math.floor(armour).."%", (screenW * 0.9000) + 1, (screenH * 0.1200) - 1, (screenW * 1.0263) + 1, (screenH * 0.1844) - 1, tocolor(0, 0, 0, 255), 0.55, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Armour 0%",..math.floor(armour).."%", (screenW * 0.9000) - 1, (screenH * 0.1200) + 1, (screenW * 1.0263) - 1, (screenH * 0.1844) + 1, tocolor(0, 0, 0, 255), 0.55, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Armour 0%",..math.floor(armour).."%", (screenW * 0.9000) + 1, (screenH * 0.1200) + 1, (screenW * 1.0263) + 1, (screenH * 0.1844) + 1, tocolor(0, 0, 0, 255), 0.55, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Armour 0%",..math.floor(armour).."%", screenW * 0.9000, screenH * 0.1200, screenW * 1.0263, screenH * 0.1844, tocolor(255, 255, 255, 255), 0.55, "bankgothic", "left", "top", false, false, false, false, false) dxDrawLine((screenW * 0.8625) - 1, (screenH * 0.1633) - 1, (screenW * 0.8625) - 1, screenH * 0.2011, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.9769, (screenH * 0.1633) - 1, (screenW * 0.8625) - 1, (screenH * 0.1633) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawLine((screenW * 0.8625) - 1, screenH * 0.2011, screenW * 0.9769, screenH * 0.2011, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.9769, screenH * 0.2011, screenW * 0.9769, (screenH * 0.1633) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawRectangle(screenW * 0.8625, screenH * 0.1633, screenW * 0.1144, screenH * 0.0378, tocolor(66, 66, 66, 224), false) dxDrawLine((screenW * 0.8625) - 1, (screenH * 0.1633) - 1, (screenW * 0.8625) - 1, screenH * 0.2011, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.9769, (screenH * 0.1633) - 1, (screenW * 0.8625) - 1, (screenH * 0.1633) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawLine((screenW * 0.8625) - 1, screenH * 0.2011, screenW * 0.9769, screenH * 0.2011, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.9769, screenH * 0.2011, screenW * 0.9769, (screenH * 0.1633) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawRectangle(screenW * 0.8625, screenH * 0.1633, screenW * 0.1144, screenH * 0.0378, tocolor(22, 234, 226, 246), false) if isElementinWater(localPlayer) then ------------ Oxygen -------------------------------------------------- dxDrawText("Oxygen: "..math.floor(oxygen).."%", 1440 - 1, 156 - 1, 1651 - 1, 196 - 1, tocolor(0, 0, 0, 255), 0.55, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Oxygen: "..math.floor(oxygen).."%", 1440 + 1, 156 - 1, 1651 + 1, 196 - 1, tocolor(0, 0, 0, 255), 0.55, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Oxygen: "..math.floor(oxygen).."%", 1440 - 1, 156 + 1, 1651 - 1, 196 + 1, tocolor(0, 0, 0, 255), 0.55, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Oxygen: "..math.floor(oxygen).."%", 1440 + 1, 156 + 1, 1651 + 1, 196 + 1, tocolor(0, 0, 0, 255), 0.55, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Oxygen: "..math.floor(oxygen).."%", 1440, 156, 1651, 196, tocolor(255, 255, 255, 255), 0.55, "bankgothic", "left", "top", false, false, false, false, false) end --------------------------------- dxDrawText("$"..money, (screenW * 0.9000) - 1, (screenH * 0.1733) - 1, (screenW * 1.0319) - 1, (screenH * 0.2178) - 1, tocolor(0, 0, 0, 255), 0.55, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("$"..money, (screenW * 0.9000) + 1, (screenH * 0.1733) - 1, (screenW * 1.0319) + 1, (screenH * 0.2178) - 1, tocolor(0, 0, 0, 255), 0.55, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("$"..money, (screenW * 0.9000) - 1, (screenH * 0.1733) + 1, (screenW * 1.0319) - 1, (screenH * 0.2178) + 1, tocolor(0, 0, 0, 255), 0.55, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("$"..money, (screenW * 0.9000) + 1, (screenH * 0.1733) + 1, (screenW * 1.0319) + 1, (screenH * 0.2178) + 1, tocolor(0, 0, 0, 255), 0.55, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("$"..money, screenW * 0.9000, screenH * 0.1733, screenW * 1.0319, screenH * 0.2178, tocolor(255, 255, 255, 255), 0.55, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("$"..money, (screenW * 0.8469) - 1, (screenH * 0.2178) - 1, (screenW * 1.0000) - 1, (screenH * 0.2578) - 1, tocolor(171, 0, 0, 252), 1.00, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("$"..money, (screenW * 0.8469) + 1, (screenH * 0.2178) - 1, (screenW * 1.0000) + 1, (screenH * 0.2578) - 1, tocolor(171, 0, 0, 252), 1.00, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("$"..money, (screenW * 0.8469) - 1, (screenH * 0.2178) + 1, (screenW * 1.0000) - 1, (screenH * 0.2578) + 1, tocolor(171, 0, 0, 252), 1.00, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("$"..money, (screenW * 0.8469) + 1, (screenH * 0.2178) + 1, (screenW * 1.0000) + 1, (screenH * 0.2578) + 1, tocolor(171, 0, 0, 252), 1.00, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("$"..money, screenW * 0.8469, screenH * 0.2178, screenW * 1.0000, screenH * 0.2578, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false) ---------------------------------- dxDrawText("Romania Chill Nation", (screenW * 0.8375) - 1, (screenH * 0.2378) - 1, (screenW * 1.0106) - 1, (screenH * 0.2644) - 1, tocolor(221, 0, 0, 252), 0.55, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Romania Chill Nation", (screenW * 0.8375) + 1, (screenH * 0.2378) - 1, (screenW * 1.0106) + 1, (screenH * 0.2644) - 1, tocolor(221, 0, 0, 252), 0.55, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Romania Chill Nation", (screenW * 0.8375) - 1, (screenH * 0.2378) + 1, (screenW * 1.0106) - 1, (screenH * 0.2644) + 1, tocolor(221, 0, 0, 252), 0.55, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Romania Chill Nation", (screenW * 0.8375) + 1, (screenH * 0.2378) + 1, (screenW * 1.0106) + 1, (screenH * 0.2644) + 1, tocolor(221, 0, 0, 252), 0.55, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Romania Chill Nation", screenW * 0.8375, screenH * 0.2378, screenW * 1.0106, screenH * 0.2644, tocolor(255, 255, 255, 255), 0.55, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText(currentammo.." | "..maxammo, (screenW * 0.8756) - 1, (screenH * 0.2689) - 1, (screenW * 0.9769) - 1, (screenH * 0.2933) - 1, tocolor(221, 0, 0, 252), 0.77, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText(currentammo.." | "..maxammo, (screenW * 0.8756) + 1, (screenH * 0.2689) - 1, (screenW * 0.9769) + 1, (screenH * 0.2933) - 1, tocolor(221, 0, 0, 252), 0.77, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText(currentammo.." | "..maxammo, (screenW * 0.8756) - 1, (screenH * 0.2689) + 1, (screenW * 0.9769) - 1, (screenH * 0.2933) + 1, tocolor(221, 0, 0, 252), 0.77, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText(currentammo.." | "..maxammo, (screenW * 0.8756) + 1, (screenH * 0.2689) + 1, (screenW * 0.9769) + 1, (screenH * 0.2933) + 1, tocolor(221, 0, 0, 252), 0.77, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText(currentammo.." | "..maxammo, screenW * 0.8756, screenH * 0.2689, screenW * 0.9769, screenH * 0.2933, tocolor(254, 254, 254, 252), 0.77, "bankgothic", "left", "top", false, false, false, false, false) end ) addEventHandler( "onClientRender" ,root, hudrcn) function closehud() setPlayerHudComponentVisible("clock",true) setPlayerHudComponentVisible("armour",true) setPlayerHudComponentVisible("breath",true) setPlayerHudComponentVisible("health",true) setPlayerHudComponentVisible("money",true) setPlayerHudComponentVisible("wanted",true) setPlayerHudComponentVisible("weapon",true) setPlayerHudComponentVisible("ammo",true) end addEventHandler("onResourceStop", resourceRoot, closehud) Eu nu as zice ca lai facut tu dar na.
    1 point
  9. اعطيه لوحة قوانين الدي إكس تبعتك
    1 point
  10. بإذن الله ندخله اليوم , يأخي السي بق مخرب ع النوبات , سوي سلاح شبيه بسرعة السلاح الأصلي لما يستخدم سي بق , يعني واحد جديد يخش , كل ٥ ثواني ينجلد ١٠ مرات .
    1 point
  11. Dai nesse caso é mais trabalhoso de fazer, pois como vc já deve saber, precisa informar todos os IDs de todas as ruas que terão a textura substituída. Mas basicamente funciona da mesma forma. A única coisa que não vai ter é a parte do DFF, já que não há substituição de modelo, apenas de texturas.
    1 point
  12. sweet. That helps me with other scripts too. Thanks you
    1 point
  13. 1 point
  14. السلام عليكم ورحمة الله وبركاته تعلن إدارة الاتحاد العربي عن طرح اصدارها القادم [Gta-Au V2.0] بعدة إضافات وتعديلات ضخمة في الطريق FPS من ضمن الـ إضافات هي توفير أفضل بيئة لعب لـ كل لاعب عربي من ناحية الـ التعديلات , والإضافات الضخمة رح نعرضها لكم مع الأفتتاح اليوم إن شاء الله :] سوف يتم طرح الاصدار يوم 12 من شهر ذو القعدة , بالتحديد يوم الخميس , الساعة 9:00 مساء بتوقيت السعودية .بإنتظاركم جميعاً
    1 point
  15. @Micro الله يعطيك العافية صراحة , ياليت لو تحط لنا سيرفر ندخله عشان نشوف البنق من الخادم الاردني وهل فيه خوادم اردنية للبيع بأسعار الخوادم الفرنسية وغيرها ؟
    1 point
  16. use tables .. insert the used id to the table and check that the id isn't in the table when a player try to take a quest ex .. local myTable = {} addCommandHandler("q", function(p,_,n) local n = tonumber(n) if not myTable[n] then outputChatBox("number inserted to table .. ", p) myTable[n] = true else outputChatBox("this number is already inserted to the table", p) end end )
    1 point
  17. outputChatBox("Admins : " .. QA[msg], source, 0, 255, 0, true) يبي البوت يرد كذا , Admins : ولكم مو قصدي الكود كامل , عدلت على كود روكز وقلت له يجرب #
    1 point
  18. Используйте utf* функции вместо страндартных.
    1 point
  19. As I said, do not interfere with things that are not relevant to you Maybe I'm not active in the forum, but my coding is stronger than you In the meantime, I wrote this code in no hurry and did not test at all!
    1 point
  20. لو لاعب واحد فقط سويها في الكلنت لو تبي الكل سوي تريقر للسيرفر
    1 point
  21. APPENDIX DATA SYNCHRONIZATION. What is it? MTA's synchronization methods. Optimization tips. DATA SYNCHRONIZATION 1. What is it? Since unmemorable times humanity have faced problems caused mainly due to the storage of different ideas in almost each human. But thank God, machines storage methods are different and they have the possibility of having stored the same values in more than 100 machines. Well this is great, but those values must be set by someone, and here's where the server-side and client-side can be used as example of data synchronization. The server-side store's all the values given by each client-side and give's back those values to the all the client-sides ending up into something like this ( Figure 1 ). This is a way to get the same data in all the client-side, but there's also other methods well known like P2P. Figure 1. 2. MTA's synchronization methods. Since data sync it's a base element of every multiplayer game or mod, MTA is not an exception. That's why MTA scripting interface gives us two core ways to sync the server data with the client data or client data with server data. Well this two methods are the following one's. Element Data, it consists of assigning values to an element that are being stored under a key ( the key usually being a string like "health" ). This way is being used by a great amount of scripters in MTA because it's easy to use. But there are also negative points if this way is not being used properly like saving small amount of data in just one key and syncing it with the server or client's. An example of it would be: [[--CLIENT.LUA--]] local value = 0 local function handleStart() value = getTickCount() -- WE GET THE TIME THE SERVER HAS BEEN WORKING WHEN THE RESOURCE START setElementData( localPlayer, "start_tick", value, true ) -- WE SAVE THE 'value' VARIABLE INTO THE 'localPlayer' ELEMENT WITHIN THE KEY 'start_tick' AND WE SYNC IT TO GET THIS DATA TO THE SERVER. end addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), handleStart ) [[--SERVER.LUA--]] local function handleCMD( thePlayer ) local mineTick = getElementData( thePlayer, "start_tick" ) -- WE RETRIEVE THE DATA, THAT HAS BEEN SAVED INTO 'thePlayer' DATA. local resultTick = getTickCount() - mineTick -- GET HOW MUCH TIME HAS PASSED SINCE THE RESOURCE STARTED FOR THE PLAYER outputChatBox( resultTick, thePlayer ) -- PRINT INTO THE CHAT THE RESULT end addCommandHandler( "mytime", handleCMD ) -- IN CASE YOU WANT TO TRY IT SAVE THE CODE WITH THE NAME MARKED ABOVE THEM. [[--META.XML--]] <meta> <script src="server.lua" type="server"/> <script src="client.lua" type="client"/> </meta> Events, this method is the one that elementData's one bases on, which means this is a 'rawer' method which can also be faster than elementData if it's being used efficiently. An event is just a message that's being send to one or various systems, if these systems handle the message then when the message is sent to the system there's a trigger which calls the functions that are defined like a reaction to that message that has been sent. It's pretty easy to understand, just think of this. You say hello to someone, the message in this case is 'Hello' and the system where is pointed to mainly is the person, the person gets the message and handles it by calling some cognitive functions, these functions at their time trigger another message as result which in the most common case would be 'Hello' or just a strange face motion because he or she doesn't know you. Maybe you will ask yourself about what does a hello to someone have to do with Events in MTA. Well let's convert the situation above into script. We've got to define first the message by using addEvent( "Hello" ), good we have defined our message, but if we stop here then we have made some useless stuff that's not going to be used ever, that's why we have to use this message somewhere and here is when we simulate the action of saying something the message by using triggerEvent( "Hello" ) but... wait who's supposed to say the message? Let's make it look like the localPlayer was saying the message so it would be like triggerEvent( "Hello", localPlayer ), okay we have said the message but do we talk alone? Maybe but it's not pretty normal, so we must find a receptor which in this case will be a ped so we add the a ped to the game by using createPed( 0, 105, 20, 5.5 ) supposing we are located in the position 104, 20, 5.5. Okay we have the receptor now but it won't answer to our message so let's obligate him to answer us by adding a handler for the message to the ped like this addEventHandler( "Hello", thePed ), okay but this way it will do the same as we wouldn't have used addEventHandler that's why we need to pass also a function to call like an argument which in this case is going to be called 'answerToHello' and we would finish up with addEventHandler( "Hello", thePed, answerToHello ). All this and little bit more of code below for simulating an answer to hello from a person in a non-realistic way. [[--CLIENT--]] -- EVENTS addEvent( "Hello", false ) -- LET'S MAKE IT LIKE JUST THE CLIENT CAN TRIGGER IT SO WE MAKE SURE JUST WE ARE GOING TO TALK TO THE PED -- VARIABLES local thePed = createPed( 0, 105, 20, 5.5 ) -- WE ADD THE PED SO WE DON'T FEEL LONELY -- FUNCTIONS -- SAY HELLO local function sayHello() -- THIS FUNCTION WILL BE USED TO SEND UP THE MESSAGE TO THE PED triggerEvent( "Hello", thePed ) -- WE SAY HELLO TO THE PED end -- ANSWER local function answerToHello() -- WE DEFINE THE MESSAGE HANDLER SO WE MAKE SURE THE PED ANSWERS TO US outputChatBox( "Hello to you too!" ) -- THE PED GET'S THE MESSAGE AND GIVES US BACK A MESSAGE THAT WE CAN CHECK INTO THE CHAT. end -- COMMANDS addCommandHandler( "sayit", sayHello ) -- WE'VE GOT TO SAY SOMEHOW HELLO TO THE PED SO LET'S USE A COMMAND -- EVENT HANDLERS addEventHandler( "Hello", thePed, answerToHello ) 3. Optimization tips. Well both methods can be used in large development but there are some tips you can follow to make sure your script will run in an efficient way. Pack reasonable amount of data into one's element data key, don't save values like ( health, armor, money ) into different keys, compress them into an only one by using tables, by using this method we pass 3 values packed in one sync meanwhile separating each value with one key creates upon 3 different syncs which would end up in a greater amount of packets sent between the server and the client. This tip can be used for both methods [ elementData, Events ]. local basic_data = { health = 100, armor = 100, money = 100 } -- COMPRESSED PLAYER INFO setElementData( thePlayer, "main", basic_data, true ) -- WE GIVE 3 DIFFERENT VALUES TO 'main' KEY BY USING JUST A VARIABLE THAT'S A TABLE 'basic_data' triggerClientEvent( thePlayer, "onSync", thePlayer, basic_data ) -- WE SEND A MESSAGE TO THE CLIENT IN ORDER TO MAKE IT SYNC THE DATA OF THE PLAYER TO THE ONE THAT IS BEING STORED IN THE SERVER Lua is a garbage collection language so the reduce the amount of global variables as much as possible in order to make it run faster. Hope you enjoyed the tutorial, if you have any question just feel free to ask it in this post or by PM, Skype ( killer.68x ) or Email ( [email protected] ) or Discord ( Simple01#1106 ).
    1 point
  22. جميل جدا بس مانيب شايف ولا فكرة جديدة حاول تجيب افكار جديدة تجذب الزوار بالتوفيق لكك ^
    1 point
  23. Tem sim. txd = engineLoadTXD ('premier.txd') engineImportTXD (txd, 426) dff = engineLoadDFF ('premier.dff', 426) engineReplaceModel (dff, 426) function remodVehicle (cmd) -- Função que ativa/desativa a modificação do veículo Premier. Ex: /offPremier if cmd == "onPremier" then engineImportTXD (txd, 426) engineReplaceModel (dff, 426) outputChatBox ("Modificação do veículo #FFFFFF'Premier'#00FF00 ativada.", 231, 217, 176, true) elseif cmd == "offPremier" then engineRestoreModel (426) outputChatBox ("Modificação do veículo #FFFFFF'Premier'#FF0000 desativada.", 231, 217, 176, true) end end addCommandHandler ("onPremier", remodVehicle) addCommandHandler ("offPremier", remodVehicle) -------------------------------------------------------- Eu ficaria agradecido se você desse um Thanks nas minhas respostas. Assim como mostra a minha assinatura.
    1 point
  24. اتوقع تقصد createPickup
    1 point
  25. like this? paste it in after the @ using ctrl+shift+v to remove formatting: @Mσнαмα∂ Hєℓιѕн
    1 point
  26. سيرفر مميز , ولو بتبقون على التصاميم حقتكم هذي , إتمنى تحطو تأثيرات يوم يجي الماوس على الازرار خصوصاً الفري روم , راح يجي شكله حلو وبالتوفيق لكم .
    1 point
  27. الأخ الي فوقك دخل معاك اختبارات جراند العرب و قبلوك و رفضوني ( ايام ما كنت جديد علي البرمجه ) ههههه لسا فاكرك و فاكر وش طلبو منك , كانت وظيفه و كان اسمك كركر او شي قريب من هيك ههه
    1 point
  28. after a 1 hour ( with sponge bob sound ) ... lol hhhhhhhh -- for topic's owner addCommandHandler("vgun", function(player) if not isGuestAccount(getPlayerAccount(player)) then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("VIP")) then giveWeapon(player, 31, 1000) outputChatBox("you've got a vip weapon", player, 255, 0, 0, true) else outputChatBox("this command is only for VIP group", player, 255, 0, 0, true) end end end )
    1 point
  29. بالتوفيق , لا تخاذ الي هقولو ذا علي انه تحطيم , ذا اقتراح لا غير اقترح عليك تغير نظام اللوحات , احنا في 2018 الحين و صراحه لي كثير شايف النظام , و شي كمان المفروض تعطي للزائر سبب ( مود جديد بفكره حصريه ما سواها احد قبل تكون فله) عشان يقعد في السيرفر وألا ممكن اول اسبوع يكون السيرفر به 20 ولا 30 لاكن بعدها هيقل عدده لان ما في شي جديد و يطفشو و يروحو سيرفر اخر من الي فيه عدد كبير
    1 point
  30. Amazing! Everything is cool! Good job!
    1 point
  31. Nice. It's simple but the effort is the important. Good luck!
    1 point
  32. local QA = { ['hello'] = 'hi', --['Question'] = 'Answer' } addEventHandler('onPlayerChat', root, function(msg) if QA[msg] then outputChatBox(QA[msg], source, 0, 255, 0, true) end end)
    1 point
  33. no problem dude if you have any problem i will help you thanx for your care about me
    1 point
  34. you have a missing ) at line 8
    1 point
  35. بدات بصنع لوحات و اعرف الفنكشنات و اكيد شفتوا فيديو مستر قراند حق صنع اللوحة و زر ... بعدها عرفت صنع اللوحات عرفت الاخ @*RayaN-Alharbi. فهمني اساسيات البرمجة و كل مرة اسوي مود كنت اساله ... ما بنكر اوقات كان يتعصب مني من كثرة الاسالة الغبية لكن الصراحة وقف معي و ما وقف تعليمي و اكيد الاخ @#DesTroeyR تعرفت عليه عن طريق ريان علمني الدي اكس كان يعلمني من اليوتيوب بشاشة سينما فاتحها بالسيرفر كل يوم حصة بعدها مسلسل اللالالاند
    1 point
  36. @MR.TOUNSI , تعرف شخص بس نأسيه إنت "مصطفى" , نسيته ؟
    1 point
  37. عندي اقتراح كويس بيخلي الارباح حقك تضاعف اضعافاً .. الفكرة ببساطة: خل الي بيجرب الماب يشتري الاضافات, بحيث ان المصمم يسوي الماب ويحط اي اضافة بباله بس ماراح يدفع شيء .. بس الي يبي يلعب الماب يكون فيه خيار للشراء اضافات محجوب على اسمها عشان مايصير حرق ويصير المصمم يحط اهميتها بالـ % عشان يضيف طابع اكثر للرعب والاثارة.. ( اذا اشترى الاضافة في ماب وماب ثاني حط الاضافة نفسها راح تختفي من الاضافات المراد شرائها في الماب .. )
    1 point
  38. وعليكم السلام ورحمة الله وبركاتة وأنت بخير وصحه وسلامه
    1 point
  39. ? الله يعيده ويدومه علينا كلنا بالصحة والسلامة والخير ان شاء الله
    1 point
  40. يسعدني بانك من اول الردود لى موضوعي شكرا على تعليق الرائع من انسان اروع @Master_MTA @!#NssoR_) @#[K]iLLeR<3 @TAPL @KillerX @MR.Mosa @ععيونككء اخخر امممأليء ^ @#SnpêŘ @Tete omar @*AnGeL @iMr.WiFi..! @Abu-Solo @MR_Mahmoud @N3xT @Trefeor @Rakan# @Dr.Marco
    1 point
  41. تسلم علي الاهداء بالنسبة لي كل الي بالمنتدي يعتبر مبرمج حتي لو ما يعرف و له حافز يتعلم و يحب يتعلم بشكر الي علموني البرمجة و ساعدوني @*RayaN-Alharbi. @#DesTroeyR @Rakan#
    1 point
  42. Proper Way of Asking Questions: Many people here ask for help without giving us much details about their problem. So, we have to ask the author of the topic to give us some more details. If you want us to help you and you don't explain what your problem is about, it doesn't help us to help you. WRONG way of asking for help: What information does this sentence give to us? We know that script doesn't work but we don't know why and in what way it doesn't work. We'll never know that unless you give us some more information about your problem. CORRECT way of asking for help: It helps us straight away. We know your script doesn't start when you try to run it and we have some of the code that we can tell you what you did wrong, and optionally we got some error/debug warnings to help us narrow down the problem/bug in your code accurately. What information should my question contain? - What is the reason you make new topic? Whether it's problem with your script or need help with something else, like what the best approach is to a certain goal you're trying to achieve with code. - Explain what is wrong? Tell us what happens when you test your script and what is that you want it to do. - Give us some of your code so that we can help you correct it. - Tell us if you get any error or warning messages and what they are. We can determine what causes the script not to work quicker. - If your topic is about asking more experienced scripters to help you out on knownledge and skill-related subjects, be clear what you want to achieve (like the most efficient and performance-optimal way to code a certain feature, help with which functions to use or where to start while trying to develop a certain type of script, or explain on which aspect of a function you want to learn more). This thread was made to combine and reduce announcements. Thanks to blokker, driver2 and 50p for this info. Updated on 29th April 2017 to reflect the newer Section guidelines correctly and integrate well with it. (refer to https://forum.multitheftauto.com/topic/94790-guidelines-and-formatting-for-this-section-read-before-posting/)
    1 point
  43. 0 points
×
×
  • Create New...