Jump to content

tank


Recommended Posts

Help me

--Event 
local Area = createColRectangle ( 95, 1700, 325, 450 )
	outputChatBox( "Enabled Event", getRootElement(), 255, 255, 0)
	if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Lead Administrator" ) ) then
	end
addCommandHandler ( "setEventArea", setArea )


function create_vehicle ( player )
	if isElementWithinColShape ( player, Area ) then
		if isElement( getElementData ( player, "tank" ) ) then
			destroyElement ( getElementData ( player, "tank" ) )
		end
		local x, y, z = getElementPosition ( player )
		local tank = createVehicle ( 432, x, y, z + 10 )
		warpPedIntoVehicle ( player, tank )
		setElementData ( player, "tank", tank )
	end
end
addCommandHandler ( "tank", create_vehicle )

addEventHandler("onVehicleExit", root, 
function()  

    local destroyTimer = setTimer( 
        function( tank ) 
            if isElement( tank ) then 
                destroyElement( tank ) 
            end 
        end, 
    5000, 1, source) 
    setElementData(source, "destroyTimer", destroyTimer)  
end) 


--hydras--

function create_vehicle ( player )

	if isElementWithinColShape ( player, Area ) then
		if isElement( getElementData ( player, "hydras" ) ) then
		destroyElement ( getElementData ( player, "hydras" ) )
		end
		local x, y, z = getElementPosition ( player )
		local hydras = createVehicle ( 520, x, y, z + 10 )
		warpPedIntoVehicle ( player, hydras )
		setElementData ( player, "hydras", hydras )
	end
end
addCommandHandler ( "hydras", create_vehicle )

addEventHandler("onVehicleExit", root, 
function() 

    local destroyTimer = setTimer( 
        function( hydras ) 
            if isElement( hydras ) then 
                destroyElement( hydras ) 
            end 
        end, 
    5000, 1, source) -- vehicle is not defined here, so i wrote source instead of 'vehicle' 
    setElementData(source, "destroyTimer", destroyTimer) -- same 
end) 

 

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...