savour

Members
  • Content Count

    34
  • Joined

  • Last visited

Community Reputation

8 Neutral

About savour

  • Rank
    Rat

Recent Profile Visitors

222 profile views
  1. In the first case, the first argument is the player who typed the command, and it's up to you to call it whatever you want. in the second case the source gotta be defined in the parent event/function, also it refers for "which element (player) am i going to trigger this event for?" also, the source is most likely to be hidden, you will find what it refers to when you search about the parent event in the wiki (would be like "The source of this event is ...")
  2. The thing is, marker hits are triggered for a lot of elements (including other markers as well), not just players, so you have to specify that. local respawnMarker = createMarker(2, 0, 2.22, "cylinder", 1.0, 255, 100, 100, 100) function toSpawnIt(player) if source == respawnMarker and getElementType(player) == "player" then spawnPlayer(player, 10, 0, 5) end end addEventHandler("onMarkerHit", resourceRoot, toSpawnIt)
  3. Simple if would do it if getTrainTrack and type(getTrainTrack) == "function" then --... end You can also check if it does exist in the _G table (which contains all global functions provided by mta/Lua)
  4. savour

    "Zoom" camera

    I think Matrix:getForward() with processLineOfSight should do the purpose
  5. Try txd:import(id) --Or EngineTXD.import(txd, id) You need to read a bit about the 'self' argument, maybe you will find it a little confusing; but it make things a lot easier when you get it
  6. 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
  7. savour

    Simplify function

    are you talking about the amount of code or the process itself?
  8. 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
  9. try this: https://wiki.multitheftauto.com/wiki/SetElementDoubleSided
  10. 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 )
  11. You may find this useful https://wiki.multitheftauto.com/wiki/ToHex
  12. 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.
  13. https://wiki.multitheftauto.com/wiki/OnClientKey
  14. 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!
  15. 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