I want to make if player in the vehicle then vehicle have no collision so the players can’t block each other’s for 5 seconds after the vehicle spawned.
I’ve tried NetworkFadeOutEntity - NetworkFadeInEntity it’s working but I can’t see the car until the NetworkFadeInEntity is getting activated, it’s possible to keep the car visible or flashing while the NetworkFadeOutEntity is running?
RegisterCommand('protect', function(protect)
local ped = GetPlayerPed(-1)
local veh = GetVehiclePedIsUsing(ped)
if veh then
NetworkFadeOutEntity(veh, true, false)
Citizen.Wait(5000)
NetworkFadeInEntity(veh, 0)
end
end, false)
Ummm how can I use the SetNetworkVehicleAsGhost ? Is this a server-sided function or client-sided?
if I try it in client-side it’s says:
“attempt to call a nil value global 'SetNetworkVehicleAsGhost”
in server-side returns nothing but doesn’t works - see below.
Client side:
RegisterCommand('protect', function(veh)
local ped = GetPlayerPed(-1)
local veh = GetVehiclePedIsUsing(ped)
if veh then
TriggerServerEvent("car:protect", veh)
end
end, false)
it should be client-side
if you are still using __resource.lua, check if you have set the manifest version resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' <- that
i think you need to use VehToNet(spawned_car) insted of the normal vehicle handle, not completely sure about that tho, give it a try SetNetworkVehicleAsGhost(VehToNet(spawned_car), true)
Thank you, but still the same. Just spawn a car and the car have collision so the vehicles block each others.
The only thing is working is the NetworkFadeOutEntity (this removes the vehicle collision while the vehicle is invisible) but that’s set the vehicle to invisible until the NetworkFadeInEntity is not executed. Can I do somehow the car still get flashing or visible (like ghost or smth) after the NetworkFadeOutEntity ?