Jump to content

[HELP] Spike Strip


killeryoyo

Recommended Posts

Hello Guys,

I was trying to make a spike strip system and i failed in the end Things.

It was working well then when i added another Command Handler, It gave me errors about the end things and mixed up everything.

So i need help in it.

addCommandHandler("sting", 
    function(player) 
        if (player) then 
        local x, y, z = getElementPosition(player) 
        local spike = createObject(2892,x+2,y+2,z-0.9) 
        local x2, y2, z2 = getElementPosition(spike) 
        local blow = createColSphere(x2, y2, z2, 3) 
        local AnimationDuration = 1000   -- Measure your animation's duration in miliseconds 
        setPedAnimation( player, "PED", "IDLE_CHAT", 1, false, true, true, true, false ) 
        setTimer(setPedAnimation,AnimationDuration,1,source) 
        addEventHandler("onColShapeHit",blow,function (player) 
        if player and getElementType(player) == "player" then 
        if isPedInVehicle(player) then 
                local pveh = getPedOccupiedVehicle(player)      
                setVehicleWheelStates(pveh,1,1,1,1) 
        addEventHandler("onColShapeHit") 
        destroyElement ( spike ) 
    destroyElement ( source ) 
            end 
        end 
 end 
     end) 
         
addCommandHandler("tale", 
  function(takeoff) 
        if (player) then 
destroyElement ( spike ) 
destroyElement ( source ) 
end 
end) 

Any Help will be Appreciated thank you ;).

Link to comment
addCommandHandler("sting", 
function(player) 
    if (player) then 
        local x, y, z = getElementPosition(player) 
        local spike = createObject(2892,x+2,y+2,z-0.9) 
        local x2, y2, z2 = getElementPosition(spike) 
        local blow = createColSphere(x2, y2, z2, 3) 
        local AnimationDuration = 1000   -- Measure your animation's duration in miliseconds 
        setPedAnimation( player, "PED", "IDLE_CHAT", 1, false, true, true, true, false ) 
        setTimer(setPedAnimation,AnimationDuration,1,source) 
        addEventHandler("onColShapeHit",blow, 
        function (player) 
            if player and getElementType(player) == "player" then 
                if isPedInVehicle(player) then 
                    local pveh = getPedOccupiedVehicle(player)      
                    setVehicleWheelStates(pveh,1,1,1,1) 
                    addEventHandler("onColShapeHit") 
                    destroyElement ( spike ) 
                    destroyElement ( source ) 
                end 
            end 
        end) 
    end 
end 
) 
  
addCommandHandler("tale", 
function(takeoff) 
    if (player) then 
    destroyElement ( spike ) 
    destroyElement ( source ) 
    end 
end 
) 

Link to comment
addCommandHandler("sting", 
function(player) 
    if (player) then 
        local x, y, z = getElementPosition(player) 
        local spike = createObject(2892,x+2,y+2,z-0.9) 
        setElementData(player,"spike",spike) 
        local x2, y2, z2 = getElementPosition(spike) 
        local blow = createColSphere(x2, y2, z2, 3) 
        local AnimationDuration = 1000   -- Measure your animation's duration in miliseconds 
        setPedAnimation( player, "PED", "IDLE_CHAT", 1, false, true, true, true, false ) 
        setTimer(setPedAnimation,AnimationDuration,1,source) 
        addEventHandler("onColShapeHit",blow, 
        function (player) 
            if player and getElementType(player) == "player" then 
                if isPedInVehicle(player) then 
                    local pveh = getPedOccupiedVehicle(player)      
                    setVehicleWheelStates(pveh,1,1,1,1) 
                    addEventHandler("onColShapeHit") 
                    destroyElement ( getElementData(player,"spike") ) 
                    destroyElement ( source ) 
                end 
            end 
        end) 
    end 
end 
) 
  
addCommandHandler("tale", 
function(takeoff) 
    if (player) then 
    destroyElement ( spike ) 
    destroyElement ( source ) 
    end 
end 
) 

Link to comment
addCommandHandler("sting", 
function(player) 
    if (player) then 
        local x, y, z = getElementPosition(player) 
        local spike = createObject(2892,x+2,y+2,z-0.9) 
        setElementData(player,"spike",spike) 
        local x2, y2, z2 = getElementPosition(spike) 
        local blow = createColSphere(x2, y2, z2, 3) 
        local AnimationDuration = 1000   -- Measure your animation's duration in miliseconds 
        setPedAnimation( player, "PED", "IDLE_CHAT", 1, false, true, true, true, false ) 
        setTimer(setPedAnimation,AnimationDuration,1,source) 
        addEventHandler("onColShapeHit",blow, 
        function (player) 
            if player and getElementType(player) == "player" then 
                if isPedInVehicle(player) then 
                    local pveh = getPedOccupiedVehicle(player)      
                    setVehicleWheelStates(pveh,1,1,1,1) 
                    addEventHandler("onColShapeHit") 
                    destroyElement ( getElementData(player,"spike") ) 
                    destroyElement ( source ) 
                end 
            end 
        end) 
    end 
end 
) 
  
addCommandHandler("tale", 
function(takeoff) 
    if (player) then 
    destroyElement ( spike ) 
    destroyElement ( source ) 
    end 
end 
) 

The script came back working, but the command from removing the Spike isnt working.

I tried to replace destroyElement ( spike )

with destroyElement ( local spike )

but didnt work and i tried. to add

addCommandHandler("tale", spike

but it gave me a alot of end errors.

Link to comment

Oh I haven't seen the delete command

Here you go

addCommandHandler("sting", 
function(player) 
    if (player) then 
        local x, y, z = getElementPosition(player) 
        local spike = createObject(2892,x+2,y+2,z-0.9) 
        setElementData(player,"spike",spike) 
        local x2, y2, z2 = getElementPosition(spike) 
        local blow = createColSphere(x2, y2, z2, 3) 
        setElementParent(blow,spike) 
        local AnimationDuration = 1000   -- Measure your animation's duration in miliseconds 
        setPedAnimation( player, "PED", "IDLE_CHAT", 1, false, true, true, true, false ) 
        setTimer(setPedAnimation,AnimationDuration,1,source) 
        addEventHandler("onColShapeHit",blow, 
        function (player) 
            if player and getElementType(player) == "player" then 
                if isPedInVehicle(player) then 
                    local pveh = getPedOccupiedVehicle(player)      
                    setVehicleWheelStates(pveh,1,1,1,1) 
                    addEventHandler("onColShapeHit") 
                    destroyElement ( getElementData(player,"spike") ) 
                    destroyElement ( source ) 
                end 
            end 
        end) 
    end 
end 
) 
  
addCommandHandler("tale", 
function(player) 
    local spike = getElementData(player,"spike") 
    if (spike) then 
    destroyElement ( getElementParent(spike) ) 
    destroyElement ( spike ) 
    end 
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...