Cronoss Posted February 27, 2022 Share Posted February 27, 2022 Well, I'm trying to optimize my server as much as I can, so I wonder if this -> destroyElement() would help. In this case, I'm deleting the player's car every time he quit the game, but I don't know if this is a good method or maybe this would cause problems in the future, I just need to know if this system it's fine for the purpose I want or it's wrong, I would appreciate an answer The code (server-side): function hideVehicle() local owner = getPlayerName(source) local askVeh = exports.mysql:_Query("SELECT plate FROM vehicles WHERE owner=? LIMIT 3", owner) if (#askVeh>0) then for _,row in ipairs(askVeh) do for k,v in pairs(row) do plateAsked = tostring(v) break end for k,v in ipairs(getElementsByType("Vehicle")) do if (getVehiclePlateText(v)==plateAsked) then setTimer( function () destroyElement(v) end, 5000, 1) end end end end end addEventHandler("onPlayerQuit", getRootElement(), hideVehicle) 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