Tokio Posted May 12, 2018 Share Posted May 12, 2018 this is my code: function onQuit(thePlayer) for i,v in pairs(getElementsByType("vehicle",resourceRoot)) do if getElementData(v,"oveie") == getPlayerName(thePlayer) then destroyElement(v) end end end addEventHandler ( "onPlayerQuit", root, onQuit ) but this does not working.. why? how to fix it? Link to comment
AHMED MOSTAFA Posted May 12, 2018 Share Posted May 12, 2018 -- setElementData ( vehicle, "onQuit", player ) -- do not forget it ( add it to the vehicle which belongs to the player ) function onQuit () for _, v in ipairs ( getElementsByType ( "vehicle" ) ) do if getElementData ( v, "onQuit" ) == source then destroyElement ( v ) end end end addEventHandler ( "onPlayerQuit", root, onQuit ) 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