Jump to content

[HELP] delete player vehicle but the player is not sitting in


Recommended Posts

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)

spacer.pngspacer.png

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...