Need help changing code for gmod 13. Do you guys see anything wrong with the code. I really need help with this.
Code 1: [CODE]AddCSLuaFile( "shared.lua" )
include('shared.lua')
SWEP.Weight = 3
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = true
function SWEP:ShouldDropOnDie()
return false
end[/CODE]
Code 2: [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]
Code 3: [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]
Well no one will do this for you.
Here are some tools for you:
[URL="https://docs.google.com/document/d/1khSuIYrAMkqXu7wlH5YRJNwz6hOH6Xqi5lqBhE3x6gA/edit"]https://docs.google.com/document/d/1khSuIYrAMkqXu7wlH5YRJNwz6hOH6Xqi5lqBhE3x6gA/edit[/URL]
[URL="http://wiki.garrysmod.com/page/Main_Page"]http://wiki.garrysmod.com/page/Main_Page[/URL]
Sorry, you need to Log In to post a reply to this thread.