diff --git a/src/server/spawn.qc b/src/server/spawn.qc index 563672f2..6feacbea 100644 --- a/src/server/spawn.qc +++ b/src/server/spawn.qc @@ -92,11 +92,19 @@ entity Spawn_SelectRandom(string cname) float max = 0; + /* check if _any_ entity of this type exists */ + entity testcase = find(world, ::classname, cname); + /* count our max count */ for (entity e = world;(e = find(e, ::classname, cname));) { max++; } + if (max <= 0) { + print(sprintf("^1Error: %s is not present on this map.\n", cname)); + return __NULL__; + } + for (int i = random(1, max); i > 0; i--) { spot = find(spot, classname, cname); }