savour

Members
  • Content Count

    29
  • Joined

  • Last visited

Community Reputation

5 Neutral

About savour

  • Rank
    Advanced Member

Recent Profile Visitors

169 profile views
  1. savour

    Simplify function

    well, from what i see here you don't really need the round method math.floor(12345/1000) = 12 math.floor(19999/1000) = 19 math.floor(999/1000) = 0 also for more optimization, avoid using the OOP on render events, since it uses double the resources (from my experience) also you can make some value setters outside the render events (that changes the value after something is happened) and use the final results only on rendering
  2. savour

    Simplify function

    are you talking about the amount of code or the process itself?
  3. savour

    [HELP] echo text

    You don't need render events when dealing with cegui, also if you want the user to input anything, you must use an Editbox(you can set its alpha to zero), else you gonna have to learn some DX functions
  4. try this: https://wiki.multitheftauto.com/wiki/SetElementDoubleSided
  5. if you want the vehicle to be immune against fist-punches, try this: addEventHandler("onClientVehicleDamage", root, function(attacker, weapon) if weapon == 0 then cancelEvent() end end )
  6. You may find this useful https://wiki.multitheftauto.com/wiki/ToHex
  7. savour

    checkbox

    Radio buttons will save you a lot of code, cuz in case of checkboxes you will need to check every checkbox ( in case if the player choose more than once ), However, if you want to continue with checkboxes; you gonna use guiCheckBoxGetSelected( checkbox ) and it will return true/false.
  8. https://wiki.multitheftauto.com/wiki/OnClientKey
  9. Hello there, I've been searching for the FileSystem module that is shown here: https://wiki.multitheftauto.com/wiki/Modules/FileSystem Unfortunately, I couldn't find anywhere, also the download links are outdated for both windows and linux, when I deeply traced the links I found the source code for the whole MTA:Eir project, but again, I don't have the right tools and the enough knowledge to extract the tool and recompile it. so if anyone has this piece of module it would be great to re-upload it. Thanks in advance!
  10. about variables/arrays, you can check the string with patterns before performing the loadstring() on it, check http://lua-users.org/wiki/PatternsTutorial for more information about it. for functions and events regulating, there is the wrapping way, which you can find in Bonsai's MGM, and the other way which i prefer to use, by adding debug hooks. it's extremely effective and gives you some extra abilities, check https://wiki.multitheftauto.com/wiki/addDebugHook
  11. if you're talking about the math, then i would suggest you to take a look at AMT (Arezu's Mapping Toolbox), it has some good math as a begin. also, you will find this event helpful: OnClientCursorMove
  12. so do we, also the picture isn't here
  13. savour

    xml vs json

    actually if you don't know both of them, i'd say go with XML for now. and here is an example
  14. صحيح كلامك لكن: النقط والفواصل عادي تكون بدون مسافات، لكن كل واحد على حسب الشكل اللي يحبه ، في ناس لو طول السطر معاها بتنزله لسطر تاني لكن المهم المسافة ماتئثر اذا قفلت الشيء اللي قبلها مثال hello = "Hello " .."MTA " .."Community" print(hello) --> Hello MTA Community + عند الارقام، لازم تكون في مسافة، قوس او انتر بعد الرقم عشان لايحسبها فاصلة عددية (نسيتها كمان بس حبيت اوضح) المتغيرات كتبتها كدا عشان تتفهم اسرع + احب اذا استخدمت متغير داخل اللوب احطه داخل اللوب عشان اقلل نسبة التداخل (عادة)، يعني اللوب كل مرة تشتغل بتشتغل على متغيرات نظيفة بالنسبة ل string.gmatch صحيح بترجعلك فنكشن وانا هنا نسيتها تماما، لكن الفنكشن اللي بترجعها بتكون شبيهة بفنكشكن اللوب pairs، والصراحة اول مرة اعرف ان الام تي ايه في فنكشن split فدايما كنت بابحث عن الباترن واستخدم gmatch ، شكرا على الاضافة، دا الكود السليم: function addZero (str) local newStr = "" local t = {} for digit in string.gmatch(str, "([^:]+)") do local tmpStr = "" if string.len(digit) == 1 then tempStr = "0"..digit else tempStr = tostring(digit) end table.insert(t, tempStr) end newStr = table.concat(t, ":") return newStr end وصاحب الموضوع اعتقد قالها عشان التوقيت يعني 5:6:20 مثلا تصبح 05:06:20، الفنكشن عندك اكثر شمولية لكن الصراحة ماشفت توقيت بينكتب بالفاصلة، شكرا ع التنبيه
  15. about the Boolean check, I think it would be good to store it as it is "true/false" but in a string value, then when you acquire it again transform in through this simple check dbResult = dbResult == "true" and true or false --that's a shortcut for dbResult = someRetrievedValue if dbResult == "true" then dbResult = true else dbResult = false end