killeryoyo Posted November 27, 2015 Posted November 27, 2015 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 .
Captain Cody Posted November 27, 2015 Posted November 27, 2015 What line was the debug script giving you as messed up?
ALw7sH Posted November 27, 2015 Posted November 27, 2015 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 )
killeryoyo Posted November 27, 2015 Author Posted November 27, 2015 I fixed the End Mix, but there is another Problem. when i type the command. The Spike doesnt remove. Can anyone help?
Captain Cody Posted November 27, 2015 Posted November 27, 2015 You have spike set to local, try removing "Local" and try.
ALw7sH Posted November 27, 2015 Posted November 27, 2015 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 )
killeryoyo Posted November 28, 2015 Author Posted November 28, 2015 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.
ALw7sH Posted November 28, 2015 Posted November 28, 2015 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 )
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