that a nice little update :), am happy to see people improving the code
Is there a way to make it so it spawns in front of you instead of a set heading and position?
Make it get the players heading and set the object to that position, simple
Mind showing a screenshot?
Replace the current with this and it should work, havent tested though:
function SetSpikesOnGround()
x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
local heading = GetEntityHeading(GetPlayerPed(-1))
spike = GetHashKey("P_ld_stinger_s")
RequestModel(spike)
while not HasModelLoaded(spike) do
Citizen.Wait(1)
end
local object = CreateObject(spike, x+1, y, z-2, true, true, false) -- x+1
PlaceObjectOnGroundProperly(object)
SetEntityHeading(object, heading)
end
Works great, although with the latest edit posted yesterday by @sadboilogan, the spike spawns on the side of the player. An improvement over the original, which spawned it behind the player.
Only issue I’m having is it sometimes is not visible… Maybe it’s spawning it under the ground when the ground is uneven?
Also, Is there any way to also have this work on AI vehicles and not just player vehicles?
Sometimes the PlaceObjectOnGroundProperly(object)
native is sometimes weird and doesnt set on the ground properly i believe, you could possible try make it dynamic and spawn a bit higher so it falls into place
Have you tried using SetEntityCoords
instead?
Is it synchronised between players ? Do other players can have their tires exploding ?
No need when you can just edit the CreateObject
part up a bit and changing the last false to true (just to make it fall)
Regarding what Denziel said, how would you make it spawn directly infront of you?
Change the coords of where it spawns
It is all synced between the players
Hi, here it’s my version of spike strip from my french rp server n3mtv - Have a good time
If you use a menu for cop, put it in a same files where you have your menu.
Thanks!
How do we use it mate? Is the first lot of code server and the other client?
This is what I like to see people helping each other and improving the code, and Couga thats a nice update i like how you shorted the code
Thanks it’s a pleasure
as in the F5 cop menu where you go on duty?
why the barrier the harrow always appear in the same direction?