Jump to content

Recommended Posts

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.. :S why? how to fix it? :S 

Link to comment

 

-- 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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...