• Help(if then statement lua error help/ k,v loop error)
    5 replies, posted
Server-side script sv_spawn_zombies [CODE]util.AddNetworkString( "zombieSpawned" ) function spawnZombie() for k, v in pairs(ents.FindInBox( Vector(1945, 24, 0), Vector(986, 478, 500) )) do if v:IsPlayer then net.Start( "zombieSpawned" ) net.Send(ply) local zombiespawns = ents.Create("npc_zombie") zombiespawns:SetPos(346, 0, 129) zombiespawns:Spawn() zombiespawns:SetHealth(600) end end end timer.Create( "zombieSpawned", 5, 0, zombieSpawned )[/CODE] client side [CODE]net.Receive( "zombieSpawned", function() notification.AddLegacy( "Work!", 1, 4) ply:ChatPrint( "WORK1" ) end )[/CODE] I get this error and it's running on the server so I should be allowed to create things? [B][ERROR] gamemodes/zombietower/gamemode/spawn_zombies/sv_spawn_zombies.lua:17: bad argument #4 to 'Create' (function expected, got nil) 1. Create - [C]:-1 2. unknown - gamemodes/zombietower/gamemode/spawn_zombies/sv_spawn_zombies.lua:17 3. include - [C]:-1 4. unknown - gamemodes/zombietower/gamemode/init.lua:13[/B] ___________________________________________________ anyone have a better way of checking if someone is in a certain area so I don't have to use a timer or just a better way?
if v:IsPlayer() then
[QUOTE=lilas0426;50618424]if v:IsPlayer() then[/QUOTE] New issue??
[QUOTE=dustyroo;50618539]New issue??[/QUOTE] :what:
You are using a function in timer.Create that doesn't exist
[QUOTE=danker pepers;50618562]You are using a function in timer.Create that doesn't exist[/QUOTE] Thanks, Im going to scrap this and rebuild it from the ground up.
Sorry, you need to Log In to post a reply to this thread.