Im working on a gofish server and its telling me in the console everytime I start up the server that these two weapons are missing. I need help converting the Lua files. If anyone knows whats wrong with them please tell me.
Weapon 1: npc_mover
init.lua:[CODE]AddCSLuaFile( "shared.lua" )
include('shared.lua')
SWEP.Weight = 3
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = true
function SWEP:ShouldDropOnDie()
return false
end[/CODE]
shared.lua: [CODE]SWEP.PrintName = "NPC Mover"
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = true
SWEP.ViewModelFOV = 55
SWEP.ViewModelFlip = false
SWEP.CSMuzzleFlashes = true
SWEP.Slot = 1
SWEP.SlotPos = 2
SWEP.Author = "LaZzA"
SWEP.Contact = "bloodnok16@adam.com.au"
SWEP.Purpose = "NPC Movement"
SWEP.Instructions = "Primary fire: Select NPC's, Secondary fire: Move NPC's"
SWEP.Spawnable = false
SWEP.AdminSpawnable = false
SWEP.ViewModel = "models/weapons/v_pistol.mdl"
SWEP.WorldModel = "models/weapons/w_pistol.mdl"
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
local ShootSound = Sound( "Airboat.FireGunRevDown" )
local selected_npcs_movement = {}
/*---------------------------------------------------------
Initialize
---------------------------------------------------------*/
function SWEP:Initialize()
end
/*---------------------------------------------------------
PrimaryAttack
---------------------------------------------------------*/
function SWEP:PrimaryAttack()
local trace = self.Owner:GetEyeTrace()
self:EmitSound( ShootSound )
local effectdata = EffectData()
effectdata:SetOrigin( trace.HitPos )
effectdata:SetStart( self.Owner:GetShootPos() )
effectdata:SetAttachment( 1 )
effectdata:SetEntity( self.Weapon )
util.Effect( "ToolTracer", effectdata )
if SERVER then
if (selected_npcs_movement[self:GetOwner()] == nil) then selected_npcs_movement[self:GetOwner()] = {} end
if (!trace.Entity:IsValid() || !trace.Entity:IsNPC()) then return true end
if (selected_npcs_movement[self:GetOwner()][trace.Entity] == nil) then
selected_npcs_movement[self:GetOwner()][trace.Entity] = trace.Entity
else
selected_npcs_movement[self:GetOwner()][trace.Entity] = nil
end
end
if CLIENT then
if (trace.Entity:IsNPC()) then
self.Owner:PrintMessage( HUD_PRINTTALK, "Selected NPC")
end
return true
end
end
/*---------------------------------------------------------
SecondaryAttack
---------------------------------------------------------*/
function SWEP:SecondaryAttack()
local trace = self.Owner:GetEyeTrace()
self:EmitSound( ShootSound )
local effectdata = EffectData()
effectdata:SetOrigin( trace.HitPos )
effectdata:SetStart( self.Owner:GetShootPos() )
effectdata:SetAttachment( 1 )
effectdata:SetEntity( self.Weapon )
util.Effect( "ToolTracer", effectdata )
if SERVER then
if (selected_npcs_movement[self:GetOwner()] == nil) then selected_npcs_movement[self:GetOwner()] = {} end
if (trace.HitWorld && !trace.HitSky && SERVER) then
local action = SCHED_FORCED_GO_RUN
for k, v in pairs(selected_npcs_movement[self:GetOwner()]) do
if (v != nil && v:IsValid() && v:IsNPC()) then
v:SetLastPosition( trace.HitPos )
v:SetSchedule( action )
end
end
end
end
return true
end
/*---------------------------------------------------------
Reload
---------------------------------------------------------*/
function SWEP:Reload()
end
/*---------------------------------------------------------
Think
---------------------------------------------------------*/
function SWEP:Think()
end [/CODE]
Weapon 2: prop_seller
init.lua: [CODE]AddCSLuaFile( "shared.lua" )
include('shared.lua')
SWEP.Weight = 3
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = true
function SWEP:ShouldDropOnDie()
return false
end[/CODE]
shared.lua: [CODE]SWEP.PrintName = "Prop Seller"
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = true
SWEP.ViewModelFOV = 55
SWEP.ViewModelFlip = false
SWEP.CSMuzzleFlashes = true
SWEP.Slot = 2
SWEP.SlotPos = 2
SWEP.Author = "LaZzA"
SWEP.Contact = "bloodnok16@adam.com.au"
SWEP.Purpose = "Prop Selling"
SWEP.Instructions = "Primary fire: Sell Props"
SWEP.Spawnable = false
SWEP.AdminSpawnable = false
SWEP.ViewModel = "models/weapons/v_pistol.mdl"
SWEP.WorldModel = "models/weapons/w_pistol.mdl"
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
local ShootSound = Sound( "Airboat.FireGunRevDown" )
/*---------------------------------------------------------
Initialize
---------------------------------------------------------*/
function SWEP:Initialize()
ply = self.Owner
end
local function RemoveEntity( ent )
if (ent:IsValid()) then
ent:Remove()
end
end
local function DoRemoveEntity( Entity )
if ( CLIENT ) then return true end
// Remove it properly in 1 second
timer.Simple( 1, RemoveEntity, Entity )
// Make it non solid
Entity:SetNotSolid( true )
Entity:SetMoveType( MOVETYPE_NONE )
Entity:SetNoDraw( true )
// Send Effect
local ed = EffectData()
ed:SetEntity( Entity )
util.Effect( "entity_remove", ed, true, true )
local weight = Entity:GetNetworkedInt("Weight")
addcash(ply, weight)
ply:EmitSound("items/ammo_pickup.wav", 150, 150)
return true
end
local function IsReallyValid(trace)
if not trace.Entity:IsValid() then return false end
if trace.Entity:IsPlayer() then return false end
if trace.Entity:IsNPC() then return false end
if trace.Entity:GetClass() == "fishing_rod" or trace.Entity:GetClass() == "fishing_hook" or trace.Entity:GetClass() == "fishing_bait" then return false end
return true
end
/*---------------------------------------------------------
PrimaryAttack
---------------------------------------------------------*/
function SWEP:PrimaryAttack()
local trace = self.Owner:GetEyeTrace()
if not IsReallyValid(trace) then return end
local ent = trace.Entity
if ent:GetNetworkedString("Owner") == self.Owner:Nick() then
if ( DoRemoveEntity( trace.Entity ) ) then
return true
end
end
end
/*---------------------------------------------------------
SecondaryAttack
---------------------------------------------------------*/
function SWEP:SecondaryAttack()
end
/*---------------------------------------------------------
Reload
---------------------------------------------------------*/
function SWEP:Reload()
end
/*---------------------------------------------------------
Think
---------------------------------------------------------*/
function SWEP:Think()
end
if CLIENT then
local TipColor = Color( 0, 255, 0, 255 )
surface.CreateFont( "coolvetica", 24, 500, true, false, "GModWorldtip" )
local function DrawWeightTip()
local pl = LocalPlayer()
local wep = pl:GetActiveWeapon()
if not wep:IsValid() or wep:GetClass() != "prop_seller" then return end
local trace = pl:GetEyeTrace()
if not IsReallyValid(trace) then return end
local weight = trace.Entity:GetNetworkedInt("Weight")
local text = "Worth: $"..weight
local pos = (trace.Entity:LocalToWorld(trace.Entity:OBBCenter())):ToScreen()
local black = Color( 0, 0, 0, 255 )
local tipcol = Color( TipColor.r, TipColor.g, TipColor.b, 255 )
local x = 0
local y = 0
local padding = 10
local offset = 50
surface.SetFont( "GModWorldtip" )
local w, h = surface.GetTextSize( text )
x = pos.x - w
y = pos.y - h
x = x - offset
y = y - offset
draw.RoundedBox( 8, x-padding-2, y-padding
Sorry, you need to Log In to post a reply to this thread.