Gravity Jeep not working.


I have been trying to make it so that the vehicle “player.GetByID(1)” is sitting in sticks to every surface under it by making the gravity always downwards from the vehicle, but at the moment all props in the entire world goes to that direction, is it possible to fix this?
Here is the code.


local V = {
			Name = "Jeep", 
			Class = "prop_vehicle_jeep",
			Category = "GravityCars",
			Author = "Leafdroid",
			Information = "Woow",
			Model = "models/buggy.mdl",
			KeyValues = {
							vehiclescript	=	"scripts/vehicles/gravjeep.txt"
list.Set("Vehicles", "gravityjeep", V)

if ( SERVER ) then
CreateConVar( "sv_gravitycars", "1", { FCVAR_REPLICATED, FCVAR_ARCHIVE } )
local function GravityCars()
	if GetConVar("sv_gravitycars"):GetInt() == 1 then 
	if IsValid(player.GetByID(1)) then
	if player.GetByID(1):InVehicle() then
	local meme = player.GetByID(1):GetVehicle()
	local angle = meme:GetUp() * - 600
	if meme:IsValid() then
	if !meme.LastAngle || meme.LastAngle != angle then

		physenv.SetGravity( angle ) ---------- Changes the entire worlds gravitational point to the angle that is down from the vehicle.
		meme.LastAngle = angle
else physenv.SetGravity( Vector( 0, 0, -600 ) ) return end 
else return end 
else physenv.SetGravity( Vector( 0, 0, -600 ) ) return end
hook.Add( "Think", "GravityCars", GravityCars )

ents.FindByClass returns a table of entities, not just one.

Also the GravityCars funtion is local to the “if ( SERVER ) then” block, move your hook.Add into it.

-remove me-


Bumpster mcGee.