God_Stick Erroring Out

Hey guys,

I am personally not a huge fan of the PERP gamemode, but I am trying to at least get the god_stick working for sandbox,

I am having issues with it, I think due to the fact it still may be coded for the old GMOD.

Here’s a link to a zip with the folder for the weapon, if you guys could have a look at it and help me out with code, would be greatly appreciated.

Can’t you just post the code here? Unless there’s a huge amount of files of cause.

[LUA]//Dont Tuch anything or you destroy it!

if( SERVER ) then

    AddCSLuaFile( "shared.lua" )

end

if( CLIENT ) then

    SWEP.PrintName = "GOD STICK"
    SWEP.Slot = 0
    SWEP.SlotPos = 5
    SWEP.DrawAmmo = false
    SWEP.DrawCrosshair = true

end

//Variables that are used on both client and server

SWEP.Author = “?”
SWEP.Instructions = “Left click to fire, right click to change”
SWEP.Contact = “”
SWEP.Purpose = “”

SWEP.ViewModelFOV = 62
SWEP.ViewModelFlip = false
SWEP.AnimPrefix = “stunstick”

SWEP.Spawnable = false
SWEP.AdminSpawnable = true

SWEP.NextStrike = 0

SWEP.ViewModel = Model( “models/weapons/v_stunstick.mdl” )
SWEP.WorldModel = Model( “models/weapons/w_physics.mdl” )

SWEP.Sound = Sound( “weapons/physcannon/physcannon_dryfire.wav” )
SWEP.Sound1 = Sound( “npc/metropolice/vo/moveit.wav” )
SWEP.Sound2 = Sound( “npc/metropolice/vo/movealong.wav” )

SWEP.Primary.ClipSize = -1 //Size of a clip
SWEP.Primary.DefaultClip = 0 //Default number of bullets in a clip
SWEP.Primary.Automatic = false //Automatic/Semi Auto
SWEP.Primary.Ammo = “”

SWEP.Secondary.ClipSize = -1 //Size of a clip
SWEP.Secondary.DefaultClip = 0 //Default number of bullets in a clip
SWEP.Secondary.Automatic = false //Automatic/Semi Auto
SWEP.Secondary.Ammo = “”

/---------------------------------------------------------
Name: SWEP:Initialize()
Desc: Called when the weapon is first loaded
---------------------------------------------------------
/
function SWEP:Initialize()
if SERVER then
self.Gear = 1
end
self:SetWeaponHoldType( “physgun” )
end

local SLAP_SOUNDS = {
“physics/body/body_medium_impact_hard1.wav”,
“physics/body/body_medium_impact_hard2.wav”,
“physics/body/body_medium_impact_hard3.wav”,
“physics/body/body_medium_impact_hard5.wav”,
“physics/body/body_medium_impact_hard6.wav”,
“physics/body/body_medium_impact_soft5.wav”,
“physics/body/body_medium_impact_soft6.wav”,
“physics/body/body_medium_impact_soft7.wav”
}

/---------------------------------------------------------
Name: SWEP:Precache()
Desc: Use this function to precache stuff
---------------------------------------------------------
/
function SWEP:Precache()
end

function SWEP:DoFlash( ply )

    --umsg.Start( "StunStickFlash", ply ); umsg.End()

end

function SWEP:DrawHUD()
surface.SetDrawColor(Color(0, 255, 0, 200))
surface.DrawLine(ScrW() * 0.5 - 5, ScrH() * 0.5, ScrW() * 0.5 + 6, ScrH() * 0.5)
surface.DrawLine(ScrW() * 0.5, ScrH() * 0.5 - 5, ScrW() * 0.5, ScrH() * 0.5 + 6)
end

local Gears = {}

/---------------------------------------------------------
Name: SWEP:PrimaryAttack()
Desc: +attack1 has been pressed
---------------------------------------------------------
/
function SWEP:PrimaryAttack()

    if( CurTime() < self.NextStrike ) then return; end
	if !self.Owner:IsAdmin() then
		self.Owner:StripWeapon(self.Weapon:GetClass())
		return false
	end

    self.Owner:SetAnimation( PLAYER_ATTACK1 )
	
	local r, g, b, a = self.Owner:GetColor()
	
	if a != 0 then
		self.Weapon:EmitSound( self.Sound )
	end
	
    self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER )

    self.NextStrike = ( CurTime() + .3 )
    
    if( CLIENT ) then return; end

    local trace = self.Owner:GetEyeTrace()
    
    local Gear = self.Owner:GetTable().CurGear or 1
	
	if Gears[Gear][3] and !self.Owner:IsSuperAdmin() then
		self.Owner:Notify("This gear requires Super Admin status.")
		return false
	end
	
	Gears[Gear][4](self.Owner, trace)

end

local function AddGear ( Title, Desc, SA, Func )
table.insert(Gears, {Title, Desc, SA, Func})
end
AddGear(“Lern Player sum English!”, “Aim at a player to learn him some english.”, false,
function ( Player, Trace )
if IsValid(Trace.Entity) and Trace.Entity:IsPlayer() then
if Trace.Entity:IsPlayer() and (Trace.Entity:IsOwner() or (Trace.Entity:IsSuperAdmin() and not Player:IsOwner()) or (Trace.Entity:IsAdmin() and not Player:IsSuperAdmin())) then
Player:PrintMessage(HUD_PRINTTALK, “This player has the same or a better rank than you, you can’t do this.”)
return
end

		Trace.Entity:EmitSound("learnenglish.mp3")
		Player:PrintMessage(HUD_PRINTTALK, "Lernt playar to speek englisch.")
	end
end

)

AddGear(“Kill Player”, “Aim at a player to slay him.”, false,
function ( Player, Trace )
if IsValid(Trace.Entity) and Trace.Entity:IsPlayer() then
if Trace.Entity:IsPlayer() and (Trace.Entity:IsOwner() or (Trace.Entity:IsSuperAdmin() and not Player:IsOwner()) or (Trace.Entity:IsAdmin() and not Player:IsSuperAdmin())) then
Player:PrintMessage(HUD_PRINTTALK, “This player has the same or a better rank than you, you can’t do this.”)
return
end

		Trace.Entity:Kill()
		Player:PrintMessage(HUD_PRINTTALK, "Player killed.")
	end
end

)

AddGear(“Slap Player”, “Aim at an entity to slap him.”, false,
function ( Player, Trace )
if !Trace.Entity:IsPlayer() then
local RandomVelocity = Vector( math.random(5000) - 2500, math.random(5000) - 2500, math.random(5000) - (5000 / 4 ) )
local RandomSound = SLAP_SOUNDS[ math.random(#SLAP_SOUNDS) ]

				Trace.Entity:EmitSound( RandomSound )
				Trace.Entity:GetPhysicsObject():SetVelocity( RandomVelocity )
				Player:PrintMessage(HUD_PRINTTALK, "Entity slapped.")
			else
	if Trace.Entity:IsPlayer() and (Trace.Entity:IsOwner() or (Trace.Entity:IsSuperAdmin() and not Player:IsOwner()) or (Trace.Entity:IsAdmin() and not Player:IsSuperAdmin())) then
		Player:PrintMessage(HUD_PRINTTALK, "This player has the same or a better rank than you, you can't do this.")
		return
	end
				local RandomVelocity = Vector( math.random(500) - 250, math.random(500) - 250, math.random(500) - (500 / 4 ) )
				local RandomSound = SLAP_SOUNDS[ math.random(#SLAP_SOUNDS) ]
				
				Trace.Entity:EmitSound( RandomSound )
				Trace.Entity:SetVelocity( RandomVelocity )
				Player:PrintMessage(HUD_PRINTTALK, "Player slapped.")
			end
end

)

AddGear(“Super Slap Player”, “Aim at an entity to super slap him.”, false,
function ( Player, Trace )
if IsValid(Trace.Entity) then
if !Trace.Entity:IsPlayer() then
local RandomVelocity = Vector( math.random(50000) - 25000, math.random(50000) - 25000, math.random(50000) - (50000 / 4 ) )
local RandomSound = SLAP_SOUNDS[ math.random(#SLAP_SOUNDS) ]

				Trace.Entity:EmitSound( RandomSound )
				Trace.Entity:GetPhysicsObject():SetVelocity( RandomVelocity )
				Player:PrintMessage(HUD_PRINTTALK, "Entity super slapped.")
			else
	if Trace.Entity:IsPlayer() and (Trace.Entity:IsOwner() or (Trace.Entity:IsSuperAdmin() and not Player:IsOwner()) or (Trace.Entity:IsAdmin() and not Player:IsSuperAdmin())) then
		Player:PrintMessage(HUD_PRINTTALK, "This player has the same or a better rank than you, you can't do this.")
		return
	end
				local RandomVelocity = Vector( math.random(5000) - 2500, math.random(5000) - 2500, math.random(5000) - (5000 / 4 ) )
				local RandomSound = SLAP_SOUNDS[ math.random(#SLAP_SOUNDS) ]
				
				Trace.Entity:EmitSound( RandomSound )
				Trace.Entity:SetVelocity( RandomVelocity )
				Player:PrintMessage(HUD_PRINTTALK, "Player super slapped.")
			end
		end
end

)

AddGear(“Warn Player”, “Aim at a player to warn him.”, false,
function ( Player, Trace )
if IsValid(Trace.Entity) and Trace.Entity:IsPlayer() then
if Trace.Entity:IsPlayer() and (Trace.Entity:IsOwner() or (Trace.Entity:IsSuperAdmin() and not Player:IsOwner()) or (Trace.Entity:IsAdmin() and not Player:IsSuperAdmin())) then
Player:PrintMessage(HUD_PRINTTALK, “This player has the same or a better rank than you, you can’t do this.”)
return
end
Trace.Entity:Notify(“An admin thinks you’re doing something stupid. Stop.”)
Player:PrintMessage(HUD_PRINTTALK, “Player warned.”)
end
end
)

AddGear(“Demote Player”, “Aim at a player to demote him.”, false,
function ( Player, Trace )
if IsValid(Trace.Entity) and Trace.Entity:IsPlayer() then
if Trace.Entity:IsPlayer() and (Trace.Entity:IsOwner() or (Trace.Entity:IsSuperAdmin() and not Player:IsOwner()) or (Trace.Entity:IsAdmin() and not Player:IsSuperAdmin())) then
Player:PrintMessage(HUD_PRINTTALK, “This player has the same or a better rank than you, you can’t do this.”)
return
end
Player:ConCommand("perp_adm_demote " … Trace.Entity:UniqueID())
end
end
)

AddGear(“Kick Player”, “Aim at a player to kick him.”, false,
function ( Player, Trace )
if IsValid(Trace.Entity) and Trace.Entity:IsPlayer() then
if Trace.Entity:IsPlayer() and (Trace.Entity:IsOwner() or (Trace.Entity:IsSuperAdmin() and not Player:IsOwner()) or (Trace.Entity:IsAdmin() and not Player:IsSuperAdmin())) then
Player:PrintMessage(HUD_PRINTTALK, “This player has the same or a better rank than you, you can’t do this.”)
return
end
Trace.Entity:Kick(“Consider this a warning.”)
Player:PrintMessage(HUD_PRINTTALK, “Player kicked.”)
end
end
)

AddGear(“Invisible”, “Left click to go invisible.”, false,
function ( Player, Trace )
if(not Player.Invisible) then
Player.Invisible = true

			Player:SetColor(0, 0, 0, 0)
			Player:SetNoDraw(true)
			Player:DrawWorldModel(false)
			
			Player:PrintMessage(HUD_PRINTTALK, "Invisibility on.")
		else
			Player:SetColor(255, 255, 255, 255)
			Player:SetNoDraw(false)
			Player:DrawWorldModel(true)
			
			Player:PrintMessage(HUD_PRINTTALK, "Invisibility off.")
			
			Player.Invisible = false
		end
end

)

AddGear(“Respawn Player”, “Aim at a player to respawn him.”, false,
function ( Player, Trace )
if IsValid(Trace.Entity) and Trace.Entity:IsPlayer() then
Trace.Entity:Notify(“An administrator has respawned you.”)
Trace.Entity:Spawn()
GAMEMODE.DeadPlayers[Trace.Entity:SteamID()] = nil
Player:PrintMessage(HUD_PRINTTALK, “Player respawned.”)
end
end
)

AddGear(“Unlock Door”, “Aim at a door to unlock it.”, false,
function ( Player, Trace )
if IsValid(Trace.Entity) then
if Trace.Entity:IsPlayer() and (Trace.Entity:IsOwner() or (Trace.Entity:IsSuperAdmin() and not Player:IsOwner()) or (Trace.Entity:IsAdmin() and not Player:IsSuperAdmin())) then
Player:PrintMessage(HUD_PRINTTALK, “This player has the same or a better rank than you, you can’t do this.”)
return
end
Trace.Entity:Fire(‘unlock’, ‘’, 0)
Trace.Entity:Fire(‘open’, ‘’, .5)
Player:PrintMessage(HUD_PRINTTALK, “Door unlocked.”)
end
end
)

AddGear(“Lock Door”, “Aim at a door to lock it.”, false,
function ( Player, Trace )
if IsValid(Trace.Entity) then
if Trace.Entity:IsPlayer() and (Trace.Entity:IsOwner() or (Trace.Entity:IsSuperAdmin() and not Player:IsOwner()) or (Trace.Entity:IsAdmin() and not Player:IsSuperAdmin())) then
Player:PrintMessage(HUD_PRINTTALK, “This player has the same or a better rank than you, you can’t do this.”)
return
end
Trace.Entity:Fire(‘lock’, ‘’, .5)
Trace.Entity:Fire(‘close’, ‘’, 0)
Player:PrintMessage(HUD_PRINTTALK, “Door locked.”)
end
end
)

AddGear(“Teleport”, “Teleports you to a targeted location.”, false,
function ( Player, Trace )
local EndPos = Player:GetEyeTrace().HitPos
local CloserToUs = (Player:GetPos() - EndPos):Angle():Forward()

	Player:SetPos(EndPos + (CloserToUs * 20))
	//Player:PrintMessage(HUD_PRINTTALK, "Teleported.")
end

)

AddGear(“Revive Player”, “Aim at a corpse to revive the player.”, false,
function ( Player, Trace )
umsg.Start(‘god_try_revive’, Player)
umsg.End()
end
)

AddGear(“Get Owner - Safe”, “Aim at an entity to get the owner.”, false,
function ( Player, Trace )
if IsValid(Trace.Entity) and not Trace.Entity:IsPlayer() then
local objEnt, strSteam = Trace.Entity:ItemOwner()
Player:PrintMessage(HUD_PRINTTALK, "Owner of this entity: " … ((objEnt and objEnt:Nick()) or “Unknown”) … " | " … (strSteam or “NO STEAMID”))
end
end
)

AddGear(“Ignite”, “Spawns a fire wherever you’re aiming.”, true,
function ( Player, Trace )
if IsValid(Trace.Entity) then
if Trace.Entity:IsPlayer() and (Trace.Entity:IsOwner() or (Trace.Entity:IsSuperAdmin() and not Player:IsOwner()) or (Trace.Entity:IsAdmin() and not Player:IsSuperAdmin())) then
Player:PrintMessage(HUD_PRINTTALK, “This player has the same or a better rank than you, you can’t do this.”)
return
end
Trace.Entity:Ignite(60)
else
local Fire = ents.Create(‘ent_fire’)
Fire:SetPos(Trace.HitPos)
Fire:Spawn()

		Player:PrintMessage(HUD_PRINTTALK, "Fire started.")
	end
end

)

AddGear(“God Mode”, “Left click to alternate between god and mortal.”, true,
function ( Player, Trace )
if Player.IsGod then
Player.IsGod = false
Player:PrintMessage(HUD_PRINTTALK, “You are now vulnerable.”)
Player:GodDisable()
else
Player.IsGod = true
Player:PrintMessage(HUD_PRINTTALK, “You are now invulnerable.”)
Player:GodEnable()
end
end
)

AddGear(“Extinguish ( Local )”, “Extinguishes the fires near where you aim.”, false,
function ( Player, Trace )
for k, v in pairs(ents.FindInSphere(Trace.HitPos, 250)) do
if v:GetClass() == ‘ent_fire’ then
v:KillFire()
end
end

		Player:PrintMessage(HUD_PRINTTALK, "Fires extinguished nearby.")
end

)

AddGear(“Extinguish ( All )”, “Extinguishes all fires on the map.”, true,
function ( Player, Trace )
for k, v in pairs(ents.FindByClass(‘ent_fire’)) do
v:KillFire()
end

		for k, v in pairs(player.GetAll()) do
			v:Notify("All fires on the map have been extinguished to preserve gameplay.")
		end
		
		Player:PrintMessage(HUD_PRINTTALK, "Fires extinguished.")
end

)

AddGear(“Disable Car”, “Aim at a car to disable it.”, true,
function ( Player, Trace )
if IsValid(Trace.Entity) and Trace.Entity:IsVehicle() then
Trace.Entity:DisableVehicle(true)
Player:PrintMessage(HUD_PRINTTALK, “Vehicle disabled.”)
end
end
)

AddGear(“Fix Car”, “Aim at a disabled car to fix it.”, true,
function ( Player, Trace )
if IsValid(Trace.Entity) and Trace.Entity:IsVehicle() then
Trace.Entity:EnableVehicle()
Trace.Entity.CarDamage = 0
Trace.Entity:FixTires()
Player:PrintMessage(HUD_PRINTTALK, “Vehicle repaired.”)
end
end
)

AddGear(“Remover”, “Aim at any object to remove it.”, true,
function ( Player, Trace )
if IsValid(Trace.Entity) then
if Trace.Entity:IsPlayer() and (Trace.Entity:IsOwner() or (Trace.Entity:IsSuperAdmin() and not Player:IsOwner()) or (Trace.Entity:IsAdmin() and not Player:IsSuperAdmin())) then
Player:PrintMessage(HUD_PRINTTALK, “This player has the same or a better rank than you, you can’t do this.”)
return
end
if Trace.Entity:IsVehicle() and IsValid(Trace.Entity:GetDriver()) then
Trace.Entity:GetDriver():ExitVehicle()
end

			if Trace.Entity:IsPlayer() then
				Trace.Entity:Kill()
			else
				Trace.Entity:Remove()
			end
		end
end

)

AddGear(“Explode ( No Damage )”, “Aim at any object to explode it.”, true,
function ( Player, Trace )
if IsValid(Trace.Entity) then
if Trace.Entity:IsPlayer() and (Trace.Entity:IsOwner() or (Trace.Entity:IsSuperAdmin() and not Player:IsOwner()) or (Trace.Entity:IsAdmin() and not Player:IsSuperAdmin())) then
Player:PrintMessage(HUD_PRINTTALK, “This player has the same or a better rank than you, you can’t do this.”)
return
end
if Trace.Entity:IsVehicle() and IsValid(Trace.Entity:GetDriver()) then
Trace.Entity:GetDriver():ExitVehicle()
end
umsg.Start(‘perp_bomb’)
umsg.Vector(Trace.Entity:GetPos())
umsg.End()

			timer.Simple(.5, function()
				if IsValid(Trace.Entity) then
					if Trace.Entity:IsPlayer() then
						Trace.Entity:Kill()
					else
						Trace.Entity:Remove()
					end
				end
			end)
		end
end

)

AddGear(“Explode ( Damage )”, “Aim at any object to explode it.”, true,
function ( Player, Trace )
if IsValid(Trace.Entity) then
if Trace.Entity:IsPlayer() and (Trace.Entity:IsOwner() or (Trace.Entity:IsSuperAdmin() and not Player:IsOwner()) or (Trace.Entity:IsAdmin() and not Player:IsSuperAdmin())) then
Player:PrintMessage(HUD_PRINTTALK, “This player has the same or a better rank than you, you can’t do this.”)
return
end
if Trace.Entity:IsVehicle() and IsValid(Trace.Entity:GetDriver()) then
Trace.Entity:GetDriver():ExitVehicle()
end

			umsg.Start('perp_bomb')
				umsg.Vector(Trace.Entity:GetPos())
			umsg.End()

			
			for i = 1, 5 do
				util.BlastDamage(Player, Player, Trace.Entity:GetPos(), 300, 300 )
			end
			
			timer.Simple(.5, function()
				if IsValid(Trace.Entity) then
					if Trace.Entity:IsPlayer() then
						Trace.Entity:Kill()
					else
						Trace.Entity:Remove()
					end
				end
			end)
		end
end

)

AddGear(“Freeze”, “Target a player to change his freeze state.”, true,
function ( Player, Trace )
if IsValid(Trace.Entity) and Trace.Entity:IsPlayer() then
if Trace.Entity:IsPlayer() and (Trace.Entity:IsOwner() or (Trace.Entity:IsSuperAdmin() and not Player:IsOwner()) or (Trace.Entity:IsAdmin() and not Player:IsSuperAdmin())) then
Player:PrintMessage(HUD_PRINTTALK, “This player has the same or a better rank than you, you can’t do this.”)
return
end
if Trace.Entity.IsFrozens then
Trace.Entity:Freeze(false)
Player:PrintMessage(HUD_PRINTTALK, “Player unfrozen.”)
Trace.Entity:PrintMessage(HUD_PRINTTALK, “You have been unfrozen.”)
Trace.Entity.IsFrozens = nil
else
Trace.Entity.IsFrozens = true
Trace.Entity:Freeze(true)
Player:PrintMessage(HUD_PRINTTALK, “Player frozen.”)
Trace.Entity:PrintMessage(HUD_PRINTTALK, “You have been frozen.”)
end
end
end
)

AddGear(“Telekinesis ( Stupid )”, “Left click to make it float.”, true,
function ( Player, Trace )
local self = Player:GetActiveWeapon()

		if self.Floater then
			self.Floater = nil
			self.FloatSmart = nil
		elseif IsValid(Trace.Entity) then
			self.Floater = Trace.Entity
			self.FloatSmart = nil
		end
end

)

AddGear(“Telekinesis ( Smart )”, “Left click to make it float and follow your crosshairs.”, true,
function ( Player, Trace )
local self = Player:GetActiveWeapon()

		if self.Floater then
			self.Floater = nil
			self.FloatSmart = nil
		elseif IsValid(Trace.Entity) then
			self.Floater = Trace.Entity
			self.FloatSmart = true
		end
end

)

AddGear(“Tornado”, “Left click to spawn a tornado.”, true,
function ( Player, Trace )
local Fire = ents.Create(‘tornado’)
Fire:SetPos(Trace.HitPos)
Fire:Spawn()

		Player:PrintMessage(HUD_PRINTTALK, "Tornado spawned.")
end

)

AddGear(“Delete Tornados”, “Left click to kill all tornados.”, true,
function ( Player, Trace )
for k, v in pairs(ents.FindByClass(‘tornado’)) do
v:Remove()
end

		for k, v in pairs(player.GetAll()) do
			v:Notify("All tornados on the map have been removed to preserve gameplay.")
		end
		
		Player:PrintMessage(HUD_PRINTTALK, "Tornados removed.")
end

)
AddGear(“Flying Car”, “Left click to make a car fly.”, true,
function ( Player, Trace )
if IsValid(Trace.Entity) and Trace.Entity:IsVehicle() then
Trace.Entity.CanFly = true
Player:PrintMessage(HUD_PRINTTALK, “You are now the proud owner of a flying car.”)
end
end
)
AddGear(“Daytime”, “Left click to make it day time.”, true,
function ( Player, Trace )
ENV.Second = 30000
end
)
AddGear(“Night Time”, “Left click to make it night time.”, true,
function ( Player, Trace )
ENV.Second = 69000
end
)
function SWEP:Think()
if(not ValidEntity(self.Owner)) then
return
end

if ValidEntity(self.Floater) then
		local trace = {}
		trace.start = self.Floater:GetPos()
		trace.endpos = trace.start - Vector(0, 0, 100000)
		trace.filter = { self.Floater }
		local tr = util.TraceLine( trace )
	
	local altitude = tr.HitPos:Distance(trace.start)
	
	local ent = self.Spazzer
	local vec
	
	if self.FloatSmart then
		local trace = {}
		trace.start = self.Owner:GetShootPos()
		trace.endpos = trace.start + (self.Owner:GetAimVector() * 400)
		trace.filter = { self.Owner, self.Weapon }
		local tr = util.TraceLine( trace )
		
		vec = trace.endpos - self.Floater:GetPos()
	else
		vec = Vector(0, 0, 0)
	end
	
	if altitude < 150 then
		if vec == Vector(0, 0, 0) then
			vec = Vector(0, 0, 25)
		else
			vec = vec + Vector(0, 0, 100)
		end
	end
	
	vec:Normalize()
	
	if self.Floater:IsPlayer() then
		local speed = self.Floater:GetVelocity()
		self.Floater:SetVelocity( (vec * 1) + speed)
	else
		local speed = self.Floater:GetPhysicsObject():GetVelocity()
		self.Floater:GetPhysicsObject():SetVelocity( (vec * math.Clamp((self.Floater:GetPhysicsObject():GetMass() / 20), 10, 20)) + speed)
	end
end

end

function MonitorWeaponVis()
local t = player.GetAll()
for k=1, #t do
local v = t[k]
if(v.Invisible) then
v:SetColor(0, 0, 0, 0)
v:SetNoDraw(true)
v:DrawWorldModel(false)
end
if v:IsAdmin() and IsValid(v:GetActiveWeapon()) then
local pr, pg, pb, pa = v:GetColor()
local wr, wg, wb, wa = v:GetActiveWeapon():GetColor()

		if pa == 0 and wa == 255 then
			v:GetActiveWeapon():SetColor(wr, wg, wb, 0)
		elseif pa == 255 and wa == 0 then
			v:GetActiveWeapon():SetColor(wr, wg, wb, 255)
		end
	end
	
	/*
	if v:InVehicle() and v:GetVehicle().CanFly then
		local t, r, a = v:GetVehicle()
		
		if ValidEntity(t) then
			local p = t:GetPhysicsObject()
			a = t:GetAngles()
			r = 180 * ((a.r-180) > 0 and 1 or -1) - (a.r - 180)
			p:AddAngleVelocity(p:GetAngleVelocity() * -1 + Angle(a.p * -1, 0, r))
		end
	end
	*/
end

end
timer.Create(“MonitorWeaponVis”, 0.5, 0, MonitorWeaponVis)

function MonitorKeysForFlymobile ( Player, Key )
if Player:InVehicle() and Player:GetVehicle().CanFly then
local Force

	if Key == IN_ATTACK then
		Force = Player:GetVehicle():GetUp() * 450000
	elseif Key == IN_ATTACK2 then
		Force = Player:GetVehicle():GetForward() * 100000
	end
	
	if Force then
		Player:GetVehicle():GetPhysicsObject():ApplyForceCenter(Force)
	end
end

end
hook.Add(‘KeyPress’, ‘MonitorKeysForFlymobile’, MonitorKeysForFlymobile)

if SERVER then
function GodSG ( Player, Cmd, Args )
Player:GetTable().CurGear = tonumber(Args[1])
end
concommand.Add(‘god_sg’, GodSG)
end

timer.Simple(.5, function () GAMEMODE.StickText = Gears[1][1] … ’ - ’ … Gears[1][2] end)

/---------------------------------------------------------
Name: SWEP:SecondaryAttack()
Desc: +attack2 has been pressed
---------------------------------------------------------
/
function SWEP:SecondaryAttack()
if SERVER then return false; end

	local MENU = DermaMenu()
	
	for k, v in pairs(Gears) do
		local Title = v[1]
		
		if v[3] then
			Title = "[SA] " .. Title
		end
		
		MENU:AddOption(Title, 	function()
									RunConsoleCommand('god_sg', k) 
									LocalPlayer():PrintMessage(HUD_PRINTTALK, v[2])
									GAMEMODE.StickText = v[1] .. ' - ' .. v[2]
								end )
	end
	
	MENU:Open( 100, 100 )	
	timer.Simple( 0, gui.SetMousePos, 110, 110 )

end

function TryRevive ()
if !LocalPlayer():IsAdmin() then return false; end

local EyeTrace = LocalPlayer():GetEyeTrace()

		for k, v in pairs(player.GetAll()) do
			if !v:Alive() then
				for _, ent in pairs(ents.FindInSphere(EyeTrace.HitPos, 1)) do						
					if ent == v:GetRagdollEntity() then
						RunConsoleCommand('perp_m_h', v:UniqueID(), "1")
						LocalPlayer():PrintMessage(HUD_PRINTTALK, "Player revived.")
						return false
					end
				end
			end
		end

end
usermessage.Hook(‘god_try_revive’, TryRevive);[/LUA]



///////////////////////////////
// © 2009-2010 Pulsar Effect //
//    All rights reserved    //
///////////////////////////////
// This material may not be  //
//   reproduced, displayed,  //
//  modified or distributed  //
// without the express prior //
// written permission of the //
//   the copyright holder.   //
///////////////////////////////


[lua] tags.
Edit your post instead of reposting the code.

You forgot something:

[lua]///////////////////////////////
// © 2009-2010 Pulsar Effect //
// All rights reserved //
///////////////////////////////
// This material may not be //
// reproduced, displayed, //
// modified or distributed //
// without the express prior //
// written permission of the //
// the copyright holder. //
///////////////////////////////[/lua]

Please don’t post warez.

I saw a few ValidEntity in the code, which you should replace with IsValid

That’s not even a valid copyright.

Persious, that helped.

But now I’m getting this:
[ERROR] bad argument #2 to ‘?’ (number expected, got no value)

  1. unknown - [C]:-1

Timer Failed! [Simple][@gamemodes/sandbox/entities/weapons/god_stick/shared.lua (line 729)]
[ERROR] bad argument #2 to ‘?’ (number expected, got no value)

  1. unknown - [C]:-1

Timer Failed! [Simple][@gamemodes/sandbox/entities/weapons/god_stick/shared.lua (line 729)]
[ERROR] bad argument #2 to ‘?’ (number expected, got no value)

  1. unknown - [C]:-1

Timer Failed! [Simple][@gamemodes/sandbox/entities/weapons/god_stick/shared.lua (line 729)]Disconnect: “Too many Lua Errors! Sorry!”.
D

Replace line 729 with
[lua]
timer.Simple( 0, function() gui.SetMousePos(110, 110) end)
[/lua]

Ok, now it’s erroring when calling “IsOwner” when I try to run commands on it.

any idea what to replace with?

Replace line 143, 157, 178, 203, 221, 234, 246, 292, 306, 346, 424, 444, 472, 555 with
[lua]
if Trace.Entity:IsPlayer() and ((Trace.Entity():IsSuperAdmin() and not Player:IsOwner()) or (Trace.Entity:IsAdmin() and not Player:IsSuperAdmin())) then
[/lua]

That got rid of that, and now erroring when calling ‘Entity’

Line?

it isn’t referencing a line, just saying entity