From 4d9d034503dac45eea6da1e32da7fa8b2e97ea6a Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Mon, 7 Mar 2016 18:44:21 -0500 Subject: Fixed npc's bugging out (hopefully) --- gamemode/npcsystem/npcs/antlion1.lua | 2 +- gamemode/npcsystem/npcs/antlion2.lua | 2 +- gamemode/npcsystem/npcs/bird.lua | 2 +- gamemode/npcsystem/npcs/zombie.lua | 2 +- gamemode/shared/player_accountinventory.lua | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gamemode/npcsystem/npcs/antlion1.lua b/gamemode/npcsystem/npcs/antlion1.lua index d772603..c9ae1b6 100644 --- a/gamemode/npcsystem/npcs/antlion1.lua +++ b/gamemode/npcsystem/npcs/antlion1.lua @@ -87,7 +87,7 @@ NPC.Attacks = { --Attack priority is a fucntion that takes a player, and returns an int describing it's prority to attack (higher = more important) NPC will always attack the player with the highest priority function NPC:AttackPriority(ply) - if not ply then return 0 end + if not ply or not ply:IsValid() then return 0 end local plypos = ply:GetPos() local mypos = self:GetPos() if not plypos then return 0 end diff --git a/gamemode/npcsystem/npcs/antlion2.lua b/gamemode/npcsystem/npcs/antlion2.lua index 5d1a435..e50cce4 100644 --- a/gamemode/npcsystem/npcs/antlion2.lua +++ b/gamemode/npcsystem/npcs/antlion2.lua @@ -109,7 +109,7 @@ NPC.Attacks = { --Attack priority is a fucntion that takes a player, and returns an int describing it's prority to attack (higher = more important) NPC will always attack the player with the highest priority function NPC:AttackPriority(ply) - if not ply then return 0 end + if not ply or not ply:IsValid() then return 0 end local plypos = ply:GetPos() local mypos = self:GetPos() if not plypos then return 0 end diff --git a/gamemode/npcsystem/npcs/bird.lua b/gamemode/npcsystem/npcs/bird.lua index af63e76..55a5c3d 100644 --- a/gamemode/npcsystem/npcs/bird.lua +++ b/gamemode/npcsystem/npcs/bird.lua @@ -38,7 +38,7 @@ end local dorun = function(self,ply) self:StartActivity(ACT_FLY) self:PlaySequenceAndWait( "Fly01" ) - + if(not ply or not ply:IsValid()) then return end --Find a position in roughly the oposite direction of the player local tpos = self:GetPos() local ppos = ply:GetPos() diff --git a/gamemode/npcsystem/npcs/zombie.lua b/gamemode/npcsystem/npcs/zombie.lua index c18083e..de4a389 100644 --- a/gamemode/npcsystem/npcs/zombie.lua +++ b/gamemode/npcsystem/npcs/zombie.lua @@ -88,7 +88,7 @@ NPC.Attacks = { --Attack priority is a fucntion that takes a player, and returns an int describing it's prority to attack (higher = more important) NPC will always attack the player with the highest priority function NPC:AttackPriority(ply) - if not ply then return end + if not ply or not ply:IsValid() then return end local plypos = ply:GetPos() local mypos = self:GetPos() if not plypos then return 0 end diff --git a/gamemode/shared/player_accountinventory.lua b/gamemode/shared/player_accountinventory.lua index 4bb7fad..d606a83 100644 --- a/gamemode/shared/player_accountinventory.lua +++ b/gamemode/shared/player_accountinventory.lua @@ -64,7 +64,7 @@ else net.Receive("UpdateAccountInventory",function() local pl = LocalPlayer() - if (!pl.AccountInv) then pl.AccountInv = {} end + if (not pl.AccountInv) then pl.AccountInv = {} end local ID = net.ReadUInt(5) if(not pl.AccountInv) then return end -- cgit v1.2.3-70-g09d2