[B]EDITED[/B]
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.
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://http://wiki.garrysmod.com/page/physenv]Category:physenv[/url]
[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
end
end
else physenv.SetGravity( Vector( 0, 0, -600 ) ) return end
else return end
else physenv.SetGravity( Vector( 0, 0, -600 ) ) return end
end
hook.Add( "Think", "GravityCars", GravityCars )
end
[/code]
Also the `GravityCars` funtion is local to the "if ( SERVER ) then" block, move your `hook.Add` into it.
-remove me-
Bumpy?
Bumpster mcGee.
Sorry, you need to Log In to post a reply to this thread.