Jump to content

destroyElement


TorNix~|nR

Recommended Posts

Hello guys, I made this script, but when a player wasted or quit, it doesn't destroy :/ ?

help please?

    mark = createMarker( -2066.05, 1430.57, 6.10, "cylinder", 2, 120, 62, 62, 150 ) 
		    local vehicles99ui = {}	
	
	function fun(hitPlayer)
        local x, y, z = getElementPosition(source)
    if hitPlayer and getElementType(hitPlayer) == "player" and not isPedInVehicle (hitPlayer) then
        if ( getPlayerTeam ( hitPlayer ) == getTeamFromName ( "L.K.S" ) ) then
			        if isElement(vehicles99ui) then destroyElement(vehicles99ui) end
		        vehicles99ui = createVehicle(461, -2088.01, 1369.97, 6.10)
		setVehicleColor (vehicles99ui, 120, 62, 62, 120, 62, 62)
        warpPedIntoVehicle(hitPlayer, vehicles99ui)
        else
            outputChatBox ("",hitPlayer, 120, 62, 62, true)
        end
    end
end
addEventHandler("onMarkerHit",mark,fun)
     
    addEventHandler("onPlayerQuit", root,
    function()
         if isElement(vehicles99ui) then
              destroyElement(vehicles99ui)
              vehicles99ui = nil
         end
    end)

    addEventHandler("onPlayerWasted", root,
    function()
         if isElement(vehicles99ui) then
              destroyElement(vehicles99ui)
              vehicles99ui = nil
         end
    end)

 

Edited by TorNix~|nR
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...