Potato_Tomato420 Posted August 8, 2019 Share Posted August 8, 2019 Hello, I have created a resource when entering a marker you can choose a free vehicle to travel with. But now I have a problem and I have no idea how to resolve it... If the players enters the marker for a second time, I want the previous vehicle to be destroyed. That part of the scripts works but it also destroyed the free vehicle of a other player. Can somebody tell me how I could fix this so it only removes the vehicle from 1 players? Client-side: Spoiler if isElement (examplePed) then destroyElement (examplePed) end if isElement (exampleVeh) then destroyElement (exampleVeh) end if isTimer (rotTimer) then killTimer (rotTimer) end guiGridListSetSelectedItem (freeCarList, 0, 0) guiSetVisible (carSpawnWdn, false) showCursor (false) showChat (true) setPlayerHudComponentVisible("all", true) setElementFrozen (localPlayer, false) setCameraTarget (localPlayer) triggerServerEvent ("spawnFreeVehicle", resourceRoot, "faggioVehicle") Server-side: Spoiler elseif (vehicleType == "sanchezVehicle") then destroyFreeVeh = getElementParent (client) if isElement (freeVehicle) then destroyElement (freeVehicle) end local x, y, z = getElementPosition (client) local freeVehicle = createVehicle(468, x, y, z, 0, 0, 0) setElementParent (client, freeVehicle) setVehicleColor(freeVehicle, 255, 255, 255) warpPedIntoVehicle (client, freeVehicle) end Already solved! I used: Spoiler local vehicleTable = {} local freeVehicle = vehicleTable[client] if freeVehicle then if isElement(freeVehicle) then destroyElement(freeVehicle) end vehicleTable[client] = nil end 1 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