Jump to content

srslyyyy

Scripting Moderators
  • Posts

    617
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by srslyyyy

  1. If you mean command then you could use optional argument for addCommandHandler. bool addCommandHandler ( string commandName, function handlerFunction [, bool restricted = false, bool caseSensitive = true ] )
  2. As long as it have collision it should be retrievable with https://wiki.multitheftauto.com/wiki/OnClientVehicleCollision With either hitElement or model parameter. However i think that's not a case for stinger - which you are trying to do i guess? Have a look at this resource which might help you: https://community.multitheftauto.com/index.php?p=resources&s=details&id=125
  3. Hi Your topic has been moved to Portuguese scripting section for better results.
  4. From what i can see the or operator is missing here. if teamName == "~STAFF" isObjectInACLGroup("user."..account, aclGetGroup("Admin")) then It should looks like this: if teamName == "~STAFF" or isObjectInACLGroup("user."..account, aclGetGroup("Admin")) then Also you need one more end which will close function scope.
  5. Not really. I am using this method on 1360x768.
  6. You would need to use cancelEvent() (to cancel default behaviour) in onClientVehicleDamage and write your own damage system via this event.
  7. srslyyyy

    Dead Body

    We aren't able to help without code.
  8. If you wanna keep script in this state, i will explain what could be done better. Start off by: Saving an function call in: local dimension = getElementDimension(localPlayer) Currently, you are returning it every frame, while you could save it in main scope and avoid calling it. By using onClientElementDimensionChange to store localPlayer's current dimension. local dimension = 0 function onClientElementDimensionChange(_, newDimension) dimension = newDimension end addEventHandler("onClientElementDimensionChange", localPlayer, onClientElementDimensionChange) Saving an another function call: local px, py, pz = getElementPosition(getElementByID("ped1")) I'm assuming that custom element is created on script init, otherwise you would need to update it at the time it creates. -- Main scope local myPed = getElementByID("ped1") -- Render scope local px, py, pz = getElementPosition(myPed) For next step, you could use custom implementation of getDistanceBetweenPoints3D which is faster from MTA (thanks @Sarrum) local function getDistance3D(pFirstX, pFirstY, pFirstZ, pSecondX, pSecondY, pSecondZ) pFirstX, pFirstY, pFirstZ = pFirstX - pSecondX, pFirstY - pSecondY, pFirstZ - pSecondZ return (pFirstX * pFirstX + pFirstY * pFirstY + pFirstZ * pFirstZ) ^ 0.5 end Another thing which most of scripters forget about is using tocolor in render, even if color doesn't change... tocolor(3, 169, 252, 255) -- notice () - a function call which returns same color every frame The solution will be to save it in local variable in main scope and later use it. -- Main scope local textColor = tocolor(3, 169, 252, 255) -- Render scope dxDrawText("Unknown", sx, sy, sx, sy, textColor, 2.02, "default-bold", "center", "center", false, false, false, false, false) If color isn't static you could use, for example events or timers which will be ideal way to update it. Other than that, you might use onClientElementStreamIn/onClientElementStreamOut to add/remove handler when ped appears or disappears from stream zone, as mentioned above by Dutchman101.
  9. There's a guide for this - See How to add "remember me" functionality. You shouldn't store password on client-side, even encoded.
  10. We are here to help, not to do job for you. https://wiki.multitheftauto.com/wiki/OnClientKey See examples to understand how this event works.
  11. Hi As first you need table with your vehicles which is returned by getElementsWithinColShape function. Then you would need to use loop and getVehicleType function in order to verify whether is a helicopter or a simple vehicle. This will allow you to count certain vehicles type, and process logic based on result. getVehicleType function: https://wiki.multitheftauto.com/wiki/GetVehicleType Understanding loops: https://forum.mtasa.com/topic/121619-lua-for-absolute-beginners/
  12. Have you tried using onClientKey event instead?
  13. Are you sure that db returns valid database connection? Tip in custom events: Use client variable instead of passing player to server - see https://wiki.multitheftauto.com/wiki/Script_security
  14. You haven't told us how those commands works. Not everyone is familiar with RP.
  15. Probably it's your code issue. So please post it there, so we could help you if possible.
  16. On server-side in any resource. If you don't have one, just create it. You'd need a folder (which would be your resource name), inside this folder, there should be meta.xml and server.lua (which will contain your code). Your meta would look like this. <meta> <script src="server.lua" type="server"/> </meta>
  17. What do you mean by shaders? Perhaps multiple textures applied by replacement shader?
  18. We require a effort from you, waiting till someone will do your job it's not a right way, and by doing so you won't learn anything.
  19. Welcome back So Citizen, myself and probably many others used your resource bone_attach resource which was great for lots of various servers.
  20. @Krzychuu skontaktuj się z administracją. Nie zajmujemy się poszczególnymi serwerami.
  21. Important note if you are using exports. Since exports use context switch you won't be able to add function as data handler in resource which doesn't contain data handler itself. I really forgot that being a thing, since i barely use exports at all. Perhaps using triggerEvent might serve as a workaround, and if so, i might try to write some extra code. Ideally this data system should be used without exports or should be connected to a resource which uses it mosts.
  22. Try processing damage through attacker side, and not victim.
  23. https://wiki.multitheftauto.com/wiki/SetFPSLimit Read Issues when increasing FPS
×
×
  • Create New...