Jump to content

Problem with removing vehicle.


NextGenRP

Recommended Posts

Ok first thing first, What do you think is better for RP;

The vehicle disappears when the player logged out or the vehicle stays there after logout?

also when trying to remove the vehicle i had a problem but no errors in the debug

function onLogout(source) 
local vehs = getElementsByType("vehicle") 
for k,i in ipairs(vehs) do 
local owner = getElementData(i,"Owner") 
if owner == getAccountName(getPlayerAccount(source)) then 
destroyElement(i) 
end 
end 
end 
addEventHandler("onPlayerLogout", getRootElement(), onLogout) 

A player can have more than one vehicle btw.

Any help is appreciated thanks.

Edit: Updated the owner to account name.

Edited by Guest
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...