aboutsummaryrefslogtreecommitdiff
path: root/gamemode/npcsystem/aidirector.lua
diff options
context:
space:
mode:
authorAlexander Pickering <Alexander.Pickering@anondomain.site90.net>2016-01-10 21:10:03 -0500
committerAlexander Pickering <Alexander.Pickering@anondomain.site90.net>2016-01-10 21:10:03 -0500
commit31641879af7d32f1570b59bb5d27a193ed0931c3 (patch)
tree65799bc24214382c26ee212b460a6b84ace5b8e9 /gamemode/npcsystem/aidirector.lua
parent312f321f771960872fb3ee3e1bb24ebaf91aa38f (diff)
downloadwintersurvival2-31641879af7d32f1570b59bb5d27a193ed0931c3.tar.gz
wintersurvival2-31641879af7d32f1570b59bb5d27a193ed0931c3.tar.bz2
wintersurvival2-31641879af7d32f1570b59bb5d27a193ed0931c3.zip
Fixed npc's breaking when they don't have an initial target
Diffstat (limited to 'gamemode/npcsystem/aidirector.lua')
-rw-r--r--gamemode/npcsystem/aidirector.lua14
1 files changed, 11 insertions, 3 deletions
diff --git a/gamemode/npcsystem/aidirector.lua b/gamemode/npcsystem/aidirector.lua
index fb85b2d..2f9b7a7 100644
--- a/gamemode/npcsystem/aidirector.lua
+++ b/gamemode/npcsystem/aidirector.lua
@@ -8,7 +8,7 @@ concommand.Add("ws_spawnbird",function(ply,cmd,args)
SpawnNpcByName("Bird",ply:GetPos())
end)
-concommand.Add("ws_spawnnpc",function(ply,cmd,args)
+local function spawnnpcfunc(ply,cmd,args)
if(!args[1]) then print("You must enter the name of an npc")
return end
@@ -18,7 +18,9 @@ concommand.Add("ws_spawnnpc",function(ply,cmd,args)
print("attempting to spawn npc...")
SpawnNpcByName(args[1],ply:GetPos())
print("NPC spawned!")
-end, function(cmd,stringargs)
+end
+
+local function spawnnpccomplete(cmd,stringargs)
print(cmd, stringargs)
local tbl = {}
stringargs = string.sub(stringargs,2)
@@ -36,7 +38,13 @@ end, function(cmd,stringargs)
end
end
return tbl
-end, "Spawns an NPC from winter survival, useage: ws_spawnnpc <name>")
+end
+
+if(SERVER) then
+ concommand.Add("ws_spawnnpc",spawnnpcfunc, spawnnpccomplete, "Spawns an NPC from winter survival, useage: ws_spawnnpc <name>")
+else
+ concommand.Add("ws_spawnnpc",spawnnpcfunc, spawnnpccomplete, "Spawns an NPC from winter survival, useage: ws_spawnnpc <name>")
+end
function SpawnNpcByName(name, position)
if(CLIENT) then return end