BLonwei Posted January 13, 2016 Posted January 13, 2016 Hey everyone, I am trying to figure out a what to create a command that will delete all player vehicles in my server. However, I do NOT want to delete any faction vehicles. Only the vehicles that are owned by players. Would anyone have any ideals. If it helps, my server using SQL.
Mr_Moose Posted January 13, 2016 Posted January 13, 2016 You could either store them in a table or assign a element data value upon spawn in order to identify them when looping through all vehicles to remove the player owned vehicles. If you create them using a map file you can identify them by which resource that owns them. -- Spawn part local veh = createVehicle(...) -- Table veh_table = { } veh_table[veh] = true -- Element Data setElementData(veh, "isPlayerOwnedVehicle", true) -- To remove for k,v in pairs(getElementsByType("vehicle")) do if getElementData(v, "isPlayerOwnedVehicle") or veh_table[v] then destroyElement(v) end end
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