Making a sent boat move like a boat

well my problem is that the gravity is fucked on it and if you move the mouse up in the air the ship flys also if you aim down the ship will go under that water here is my code

[lua]
ddCSLuaFile( “cl_init.lua” )
AddCSLuaFile( “shared.lua” )
include(‘shared.lua’)

local DESTROYABLE=true – set to false to prevent damage
local HEALTH=100 – change to set spawn health of shuttles

local soundx=Sound(“ambient/atmosphere/undercity_loop1.wav”)

function ENT:SpawnFunction( ply, tr)
local SpawnPos = tr.HitPos + tr.HitNormal * 100
local ent = ents.Create( “boat” )
ent:SetPos( SpawnPos )
ent:Spawn()
ent:Activate()
return ent
end

function ENT:Initialize()
self.Entity:SetNetworkedInt(“health”,HEALTH)

if (!self.Sound) then
	self.Sound = CreateSound( self.Entity, soundx )
end

self.Entity:SetUseType( SIMPLE_USE )

self.Firee=nil
self.Inflight=false
self.Pilot=nil
self.Entity:SetModel("models/props_canal/boat002b.mdl")	
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )
	local phys = self.Entity:GetPhysicsObject()
	if (phys:IsValid()) then
		phys:Wake()
		phys:SetMass( 1 )
	end
self.Entity:StartMotionController()
self.Accel=0
self.NextShot = CurTime()

end

function ENT:DoKill()
–util.BlastDamage( self.Entity, self.Entity, self.Entity:GetPos(), 300, 100 ) ARRRR

local effectdata = EffectData() 
	effectdata:SetOrigin( self.Entity:GetPos() ) 
util.Effect( "Explosion", effectdata, true, true ) 

self.Sound:Stop()
if self.Pilot:IsValid() then
self.Pilot:UnSpectate()
self.Pilot:DrawViewModel(true)
self.Pilot:DrawWorldModel(true)
self.Pilot:Spawn()
self.Pilot:SetPos(self.Entity:GetPos()+Vector(0,0,100))
end
self.Entity:Remove()

end

function ENT:OnTakeDamage(dmg)
if self.Inflight and DESTROYABLE and not self.Done then
local health=self.Entity:GetNetworkedInt(“health”)
self.Entity:SetNetworkedInt(“health”,health-dmg:GetDamage())
local health=self.Entity:GetNetworkedInt(“health”)
if health<1 then
local killer = dmg:GetInflictor():GetOwner()
if killer:UniqueID() != self.Pilot:UniqueID() then
killer:SetNWInt(“score”, killer:GetNWInt(“score”) + 1)
killer:SetMoney(killer:GetNWInt(“money”) + 50)
end
self.Pilot:SetNWInt(“death”, self.Pilot:GetNWInt(“death”) + 1)
self.Entity:DoKill()
self.Done=true
end
end
end

function ENT:OnRemove()
if (self.Sound) then
self.Sound:Stop()
end
end

function ENT:Think()
if self.Inflight and self.Pilot and self.Pilot:IsValid() then
if self.Sound then
self.Sound:ChangePitch(math.Clamp(self.Entity:GetVelocity():Length()/5,1,150),0.001)
end
self.Entity:NextThink(CurTime())
else
self.Entity:NextThink(CurTime()+1)
end

return true
end

function ENT:Use(ply,caller)
if self.Inflight then

else
	self.Sound:Play()

	self.Entity:GetPhysicsObject():Wake()
	self.Entity:GetPhysicsObject():EnableMotion(true)
	self.Inflight=true
	self.Pilot=ply

	ply:Spectate( OBS_MODE_CHASE  )
	ply:SpectateEntity( self.Entity )
	ply:DrawViewModel(false)
	ply:DrawWorldModel(false)
	ply:StripWeapons()
end

end

function ENT:PhysicsSimulate( phys, deltatime )
if !self.Pilot:IsValid() then return end
if self.Inflight then
local num=0
if self.Pilot:KeyDown(IN_FORWARD) then
num=2000
else

	end
	phys:Wake()
		self.Accel=math.Approach(self.Accel,num,10)
		if self.Accel&gt;-200 and self.Accel &lt; 200 then return end
	local info={}
		info.secondstoarrive	= 1
		info.pos				= self.Entity:GetPos()+self.Entity:GetForward()*self.Accel
		info.maxangular		= 5000
		info.maxangulardamp	= 10000
		info.maxspeed			= 100
		info.maxspeeddamp		= 100
		info.dampfactor		= 0.8
		info.teleportdistance	= 5000
		info.angle		= self.Pilot:GetAimVector():Angle()
		if self.Pilot:KeyDown(IN_SPEED) then
			pr.angle=self.Entity:GetAngles()
		end
		pr.deltatime		= deltatime
	phys:ComputeShadowControl(pr)
	phys:EnableGravity( true )
	end

end
[/lua]

any ideas are welcome please

Hi, I am Andres Kramack from http://www.cathybarryadultstore.com/.

It’s a ‘pleasure’ serving the public if you know what I mean.

Here at Cathy Barry Adult Store, we offer a wide variety of dildos that come in all sizes from goblin-sized dicks to black-man draconic dicks. I know at Facepunch everyone loves good old dicks which is why I personally offer anyone with an association with Facepunch Forums a 50% discount code “DIL4FACEPUNCH”. Don’t forget, this offer lasts until the next Garry’s Mod update which we so much love.

Here are pictures of our products just for you!

https://pbs.twimg.com/media/BKX0mMJCAAAnUji.jpg

Our wonderful sponsors:

Rubat approved: