[Release] Police Spike strip non-scripthook version

Any screenshots? (20)

I know that this is from a while ago, but for some reason I canā€™t get this code to work properly for me. Iā€™ve made some changes to the server.lua to merge the chat handlers together.

Server.lua

AddEventHandler('chatMessage', function(source, n, msg)
  msg = string.lower(msg)
  if (msg == "/spike" or msg == "/s" or msg == "/spikes") then
    CancelEvent()
    TriggerClientEvent('c_setSpike', source)
  elseif (msg == "/deletespikes" or msg == "/dspikes" or msg == "/delspikes" or msg == "/ds") then
    CancelEvent()
    TriggerClientEvent('c_deleteSpike', source)
  end
end)

Client.lua

function DeleteSpike()
  local ped = GetPlayerPed(-1)
  local pedCoord = GetEntityCoords(ped)
  if DoesObjectOfTypeExistAtCoords(pedCoord["x"], pedCoord["y"], pedCoord["z"], 0.9, GetHashKey("P_ld_stinger_s"), true) then
    spike = GetClosestObjectOfType(pedCoord["x"], pedCoord["y"], pedCoord["z"], 0.9, GetHashKey("P_ld_stinger_s"), false, false, false)
    SetEntityAsMissionEntity(spike, true, true)
    DeleteObject(spike)
  end
end

try using

local PosX, PosY, PosZ = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
if DoesObjectOfTypeExistAtCoords(PosX, PosY, PosZ, 1.0, GetHashKey("prop_mp_cone_01"), true) then
   DeletePoliceObject(GetHashKey("prop_mp_cone_01"), PosX, PosY, PosZ)
end
function DeletePoliceObject(objectHash, PosX, PosY, PosZ)
  local deleteHash = GetClosestObjectOfType(PosX, PosY, PosZ, 1.0, objectHash, false, false, false)
  DeleteEntity(deleteHash)
  DeleteObject(deleteHash)
end

Nevermind, I managed to fix that anyway. Another issue Iā€™m having now is that the spikes are spawning, but in the air and I have to touch, or shoot, them to make them fall. Iā€™ve fixed it kinda by making the Z axis -0.5 which works, but then it gets embedded in the ground, or floats in the air, in uneven terrain

Is there a way to remove the spikestrips?For example ā€˜/delspikesā€™??

yea MrJeeves posted it

Just asking im kinda late to the party. If i use the script, is it gonna be working? Thank you so much for making the script :slight_smile:

i have been trying for a while now making lots of edit to the code but it i cannot seem to get it to work for ES has anyone?

so there two suggestions one can you make it so police cars doesnt get spiked and a blip showing where the spike strip so police can see.

sorry i dont know nothing but could anyone send me a download for the files instead all this code bc i dont know what to do with it :stuck_out_tongue:

there is a download link within the chat messages. read and you will find a link above