xboxxxxd Posted August 23, 2018 Share Posted August 23, 2018 (edited) Hi there person, I need some help figuring out how to progress and finish up a script (idea to reality), but i can't find a way to do it on my own, So can sombady help me out, Here's the code. CLIENT: addEventHandler("onClientVehicleEnter", getRootElement(), function (thePlayer, seat) if thePlayer == getLocalPlayer() then triggerServerEvent ("Freeze", resourceRoot) end end ) addEventHandler("onClientVehicleExit", getRootElement(), function (thePlayer, seat) if thePlayer == getLocalPlayer() then triggerServerEvent ("Freeze", resourceRoot) end end ) SERVER: function FreezeHandler() end addEvent("Freeze", true) addEventHandler("Freeze", resourceRoot, FreezeHandler) So my intention is first of all to freeze every vehicle when it respawns/spawns, and for example if 1 does respawn/spawn then only that 1 get's frozen. And whenever the Event "onClientVehicleEnter" get's triggered, then the vehicle the player is going to unfreeze's, and for "onClientVehicleExit" it's inverted, so it has to freeze the vehicle again until another player interaction would occur. is anyone willing to help me out on this one, because i can't find it.. Gr.xboxxxxd. Edited August 23, 2018 by xboxxxxd Link to comment
qaisjp Posted August 24, 2018 Share Posted August 24, 2018 One way to do this is to set the vehicle as the source of the event give a boolean value to triggerServerEvent, like this: triggerServerEvent ("Freeze", source, true) -- true will be passed to setElementFrozen Then in your freeze handler, you can add an argument and use it to freeze the vehicle: function handler(frozen) setElementFrozen(source, frozen) end Server side, you will need to make the Frozen event bind to root, rather than resourceRoot. Link to comment
xboxxxxd Posted August 24, 2018 Author Share Posted August 24, 2018 Hey qaisjp, thanks for your answer, also you know a way to freeze a vehicle on spawn (xml format, mapping). Gr.xboxxxxd Link to comment
xboxxxxd Posted August 24, 2018 Author Share Posted August 24, 2018 Ow nvm i forgot about root doing it to all.. lol Thanks once again!. Gr.xboxxxxd Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now