Racing script troubles

Search through the FiveM native reference to see what could possibly solve your problem. In this case I already searched, only linking you one native though. There might be better options :stuck_out_tongue:

The FiveM native reference is your best tool to solving such problems. As you are in need of a native for vehicles check out the vehicle category :slight_smile:

EDIT: On further note you might wanna consider the entity category too. However it might be best to “ghost” the vehicle entirely if you are going for fair time trials. I don’t know how that works at all though so you are on your own there.

#1
Well, I tried something, first look at this: :) - YouTube
As you can see I used SetLocalPlayerAsGhost(PlayerPedId(), true) also I tried SetNetworkVehicleAsGhost(GetVehiclePedIsIn(PlayerPedId()), true) and both work but… I can’t find a native to disable it. False or 0 don’t work for me sadly. I wonder if there is even a way to disable it…
FreezeEntityPosition also works for me but ghost mode is preferable ofc as I want to avoid players bump each other during time trials not only during the countdown.

#2
I use this awesome script (SimplePassive: Passive Mode in your FiveM server, just like in GTA:O) for passive mode whenever a player wants it on. The main problem of this script is the auto-adjustment of the camera when you go through another player in passive mode. It’s like the camera has collision with other entities. DisableCamCollisionForObject(or ForEntity as there are 2 natives) doesn’t work :frowning:

Sorce code -
Lines that have been edited by me: 171, 222, 250, 265

1 Like

can you post the no collision code in the video? I have one but it also bugs de camera collision, in the video your code looks perfect

well, let’s check whether the native works as intended or not. For this write a small code that you can use to verify what works and what doesn’t:

The easiest way is:
Create a new, small resource. Put in a code, that upon start of the resource ghosts your vehicle for 10 seconds, then unghosts it. Like this:

CreateThread(function()
  local ped = PlayerPedId()
  local veh = GetVehiclePedIsIn(ped, false)

  SetNetworkVehicleAsGhost(veh, true)

  Wait(10000)

  SetNetworkVehicleAsGhost(veh, false)
end)

Have fun testing for a bit. When you figured out a native that works with the above code, you can try and start working on your code. For now: The lines you have mentioned are in a few while-loops. The native you use only needs to be called once. I suspect that your issue lies here.

EDIT: Also please fix your codeshare. The indenting of the code looks horrible in there, can barely read the code :smiley:

My bad! Won’t use codeshare anymore :sweat_smile:
It worked, btw! The problem was indeed with the place where I decided to put this native (I hate my carelessness too).
Unfortunately, DisableCamCollisionForObject//ForEntity doesn’t work. I think I’ll remove that script and just put this ghost function in server menu as an option.

I’ll surely release it on public as soon as it will be done. (And if the owner of this script will allow me to do this)

Hello, I am here cuz I have the same issues and I wonder if u can give me the nessecery scripts to get that reach that objective that u made.
Btw u did a good job, very understandable questions and reponses.

how to fix camera collision? Anyone has idea for that?

2 Likes