Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/10/17 in all areas

  1. addEventHandler + group elements I noticed that some people like to add 10000000000000000 addEventHandlers for each element, while you probably only need 1 addEventHandler. Using ONE addEventHandler on a group of elements? Answer: local group = createElement("groupMyCutePeds") -- Create a custom element and save it in to the variable <group>. -- Create 3 peds. local ped1 = createPed(120, 5540.6654, 1020.55122, 1240.545) local ped2 = createPed(120, 5541.6654, 1021.55122, 1240.545) local ped3 = createPed(120, 5542.6654, 1022.55122, 1240.545) -- Set the parent of the 3 peds. setElementParent(ped1, group) setElementParent(ped2, group) setElementParent(ped3, group) -- Add an addEventHandler and use the <group> as <attachedTo> element. addEventHandler("onPedWasted", group, -- "onPedWasted" = serverside. "onClientPedWasted" = clientside. function () outputChatBox("One of my cute peds just died. ;'( No exceptions!") end) Code is untested, but the method is tested. Syntax for functions in example createElement syntax element createElement ( string elementType, [ string elementID = nil ] ) setElementParent syntax bool setElementParent ( element theElement, element parent ) addEventHandler syntax bool addEventHandler ( string eventName, element attachedTo, function handlerFunction, [ bool getPropagated = true, string priority = "normal" ] ) DO NOT disable getPropagated getPropagated: A boolean representing whether the handler will be triggered if the event was propagated down or up the element tree (starting from the source), and not triggered directly on attachedTo (that is, handlers attached with this argument set to false will only be triggered if source == this). If you disable this, children of the <group> element are not included. Make use of the element tree Element tree For applying addEventHandlers to elements created by the resource: Use: resourceRoot / getResourceRootElement For applying addEventHandlers to elements created by scripts of the resource: Use: getResourceDynamicElementRoot For applying addEventHandlers to elements created by maps of the resource: Use: getResourceMapRootElement I hope your code will be without... print(10^10^10^10) -- Print here: https://www.lua.org/cgi-bin/demo ...addEventHandlers in the future.
    3 points
  2. It's not about the custom maps, MTA's playerbase is the problem. MTA is nowadays played mostly by children which don't care for quality or orginality. I believe the server was great, from all the screenshots I have seen, too bad that I didn't visit it. If you want players, make the server children friendly.
    3 points
  3. بالنسبة للانمي الاول انمي بسيط اغلبه كوميدي لو تحب ذي النوعيات شوفه الانمي الثاني ما ريميك انمي جديد والانمي جميل وحماسي والقصة جميلة مشكلته الوحيدة اول حلقة او حلقتين ما بتعجبك اسم الانمي : No game No life بالعربية : لا لعب لا حياة عدد الحلقات : 12 حلقة و6 اوفا للانمي موسم واحد فقط وفلم التصنيف : خارق للطبيعة , الغاز , كوميديا , مغامرات تاريخ الانتاج : 2014 الانتاج : استوديو ماد هاوس القصة
    2 points
  4. Using one addEventHandler on a group of elements? Answer: local group = createElement("groupMyCutePeds") -- Create a custom element and save it in to the variable <group>. -- Create 3 peds. local ped1 = createPed(120, 5540.6654, 1020.55122, 1240.545) local ped2 = createPed(120, 5541.6654, 1021.55122, 1240.545) local ped3 = createPed(120, 5542.6654, 1022.55122, 1240.545) -- Set the parent of the 3 peds. setElementParent(ped1, group) setElementParent(ped2, group) setElementParent(ped3, group) -- Add an addEventHandler and use the <group> as <attachedTo> element. addEventHandler("onPedWasted", group, -- "onPedWasted" = serverside. "onClientPedWasted" = clientside. function () outputChatBox("One of my cute peds just died. ;'( No exceptions!") end) (untested muhahaha :D)
    2 points
  5. As dori sami fac o factiune deoarece as dori sa mentin roleplayeul pe picioare si progres mare serverului pormit ca in fiecare zi o sa incerc sa aduc playeri pe server in speranta ca o sami faceti o factiune si factiunea sa se numeasca Mafia Loz Aztecaz dar daca mafia exista atunci Mafia Rusa si daca e ocupat atunci Mafia Mexicana sau Mafia Albaneza
    1 point
  6. https://forum.multitheftauto.com/topic/56537-string-format/
    1 point
  7. addEventHandler("onClientGUIClick",root, function() if source == b1 then local fp = guiGetText(edit1) local fp = tonumber(fp) if fp and type(fp) == "number" then outputChatBox("تم التحقق",0,255,0,true) else outputChatBox("Error",255,0,0,true) end end end)
    1 point
  8. 1 point
  9. 1 point
  10. I don't know How can I remove this bug? it's 3 months ago on my server, and I didn't find the solution. please I ask the staffs too to help me
    1 point
  11. زي التايمر بس بفكرة ثانية -1 اذا حطيته يعني راح يعطيك النتيجة يوم تجهز 1 يعطيك النتيجة مباشرة
    1 point
  12. يب ذا مثال local dbConnection = dbConnect( 'sqlite', 'SaveMoney.db') --SaveMoney.db ينشأ قاعدة بيانات بأسم -- لو كانت موجودة راح يتصل فيها لو ماكانت موجودة بالاساس راح يسوي وحدة dbExec( dbConnection, ' CREATE TABLE IF NOT EXISTS `myTable` ( playerMoney , playerSerial ) ' ) -- myTable ينشأ جدول بأسم
    1 point
  13. getPedOccupiedVehicle or getVehicleController
    1 point
  14. There was something strange about the <load> function. Afaik it didn't work for me because of some sort of security(MTA) problem. But that was a while ago, so it might be changed over time. Well, try first figure out where you crash starts. Probably line: 16 or 22 (Your default code) Run this. Write /doit and after that /testNext until your MTA starts to crash. local filePath = ":theScript/temporalCache/mapTest/water.lua" function hold (reason) iprint("Code pauses, reason:", reason) coroutine.yield() end local coroutineOfscriptReadaa function scriptReadaa() hold("Called function scriptReadaa") local file = fileOpen(filePath) if not file then error("Error opening File.") return end hold("File file is open") local data data = fileRead(file, fileGetSize(file)) hold("I did read the file") fileClose(file) hold("I did close the file") loadScript(data) hold("Everything seems to be OK") end addCommandHandler("doit", function () if not coroutineOfscriptReadaa then hold("Lets get started. I am your slave. Write: /testNext To go to the next step(s).") coroutineOfscriptReadaa = coroutine.create(scriptReadaa) coroutine.resume(coroutineOfscriptReadaa) end end) addCommandHandler("testNext", function () if coroutineOfscriptReadaa then local state, error = coroutine.resume(coroutineOfscriptReadaa) if not state then iprint("coroutine ended. You can use /doit again.") coroutineOfscriptReadaa = nil end end end) function loadScript(scriptData) hold("Called the loadScript function") local simpleContador = 0 local Xfunction = load(function() simpleContador = simpleContador + 1 return scriptData end) hold("Called the load function.") if Xfunction then hold("Xfunction does exist.") pCallPrev = Xfunction pcall(pCallPrev) hold("Called the pcall function") else outputDebugString("Couldn't load the script") return end triggerEvent("onClientResourceStart", resourceRoot, getResourceFromName("SHIscriptloader")) hold("triggerEvent onClientResourceStart has been called.") end --##water.lua containts the following function function startclient() setWaterColor(0, 0, 255) end addEventHandler("onClientResourceStart", resourceRoot, startclient) This example gives also answer on your question here:
    1 point
  15. العكس لازم يحول الصيغة UTF-8 كأفضل خيار .. بس الأفضل تنسخ كل شيء بالملف ثم تحول الصيغة وتلصقه عشان ماتضيعه + القسم غلط القسم الصحيح هو : https://forum.multitheftauto.com/forum/134-البرمجة/
    1 point
  16. بسس عشششان م تنسب لك شي حصري ي صقيقي ^
    1 point
  17. يمكنك إختصار كل ذلك بسطر واحد ويتم وضعه بجهة الكلنت addEventHandler("onClientPedDamage",createPed ( 120, x,y,z ),cancelEvent)
    1 point
  18. يبي يقلد مود طلال 07 الي موجود ف وناسة قال جته فكرة حصرية ???? موشششككلةة والله ^^
    1 point
  19. Looks nice. Right now we are trying to reproduce the so-called 'tool belt' as it is in your sketch
    1 point
  20. If it is related to a dimension, try first to figure out which dimension it is. (Visible in Admin panel)
    0 points
  21. Maybe it is related to a specific dimension?
    0 points
  22. النظام 24 ساعه يعني 7 مثل نصور صباح 19 مسائي وعلى كذا
    0 points
  23. function onPreFunction( sourceResource, functionName, isAllowedByACL, luaFilename, luaLineNumber, ... ) local args = { ... }; if ( args[2] == 38 ) then setElementModel ( args[1], 104 ) if ( getElementType ( args[1] ) == "player" ) then kickPlayer ( args[1], "No Minigun" ) end return "skip" end end addDebugHook( "preFunction", onPreFunction, { "giveWeapon" }) الكود فقط بيعطي كيك + وتغيير شخصية لأي شخص حاول ياخذ ميني قن طلبك مستحيل تقريبا الا لو تعدل من كافة اللوحات الي تعطي سلاح .. اما هذا فقط كود بسيط يخلي الشخص ماياخذ ميني قن جرب ورد لو زبط معك الكود
    0 points
×
×
  • Create New...