Jump to content

(HELP) Ghostmode Vehicle


PiojitoS

Recommended Posts

Hi, I need help with this function is for a Trucker job. I want the player to enter the truck to have ghostmode activated with other players, the problem is that only the local player recognizes me and I don't know how to make everyone see the ghostmode. I wrote this:
**The problem is that the Ghost Mode is only activated for the local player who is in the truck, it is not activated for the server players.

-----------------------------------CLIENT
-----------------------------------
----GHOSTMODE
function ghostmodeTRUCKER(Trailertruck)                       --Trailertruck is a TRAILER in Server.lua
	local playerVehicle = getPedOccupiedVehicle(localPlayer)  -- Get the players vehicle
	if playerVehicle then -- Check the return value.
		for i,v in pairs(getElementsByType("vehicle")) do     --LOOP through all vehicles
			setElementCollidableWith(v, playerVehicle, false) -- Set the collison off with the other vehicles.
            setElementCollidableWith(v, Trailertruck, false)
			--A la inversa 
			setElementCollidableWith(playerVehicle, v, false)
            setElementCollidableWith(Trailertruck, v, false)
		end
	end
end
addEvent( "ghostModeTRUCK", true )
addEventHandler("ghostModeTRUCK", getRootElement(), ghostmodeTRUCKER)

 

Edited by PiojitoS
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...