Been trying to work out how to remove cars from a player if they change jobs.
So far I have TEAM_POLICE, TEAM_SWAT, TEAM_CHIEF and TEAM_MEDIC with some TDM/SGM cars each to buy in F4 menu, that works fine but if you change job the vehicles stay there. As these are cop/ambulance vehicles I want to have them removed.
I tried this in a .lua loaded in darkrp’s addon modules but didn’t do anything
hook.Add("OnPlayerChangedTeam", "asdf", function(ply) for k,v in pairs(ents.FindByClass("07sgmcrownviccvpi", "07sgmcrownvicuc", "c5500ambulance")) do if v.allowed and type(v.allowed) == "table" and table.HasValue(v.allowed, t) then continue end if v.SID == ply.SID then v:Remove() end end end)