BenceDev Posted June 1, 2022 Share Posted June 1, 2022 Hi, i have a problem, i want to delete player vehicle with command but the player is not sitting in the vehicle. i got it for player is sitting in and he can destroy only he('s) vehicle. My code: function commitSuicide(player) -- Öngyilkosság element data törléshez if(player) then local isInVehC = isPedInVehicle(player) -- ellenőrizze le hogy benne van-e a járműben a játékos local vehicle = getPedOccupiedVehicle(player) local stringValue = tostring(jobVehicleSpawn) if(isInVehC == true) then -- ha benne van if(vehicle == getElementData(player, "jobVehicle")) then -- elementData lekérése destroyElement(vehicle) -- járművet töröljük setElementData(player, "jobVehicle", false) -- element data-t újra íruk így üres érték lesz az element data-ban outputChatBox("Benne van", player) end elseif(string.find(stringValue, "userdata: ", 1)) then string.gsub(stringValue, "userdata: ", "") setElementData(player, "jobVehicle", false) outputChatBox("Table :"..stringValue.." jármű", player) destroyElement(stringValue) end end end addCommandHandler("kill", commitSuicide) Link to comment
Bara Posted June 1, 2022 Share Posted June 1, 2022 u want to delete the vehicle without sitting in it? you have to get that vehicle somehow like: GetNearestVehicle. And also you have to make an else statement after your elseif. 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