From 7bee7eba4d16dc0e3e6b3507ab85e3a3de905e60 Mon Sep 17 00:00:00 2001 From: Mircea Kitsune Date: Mon, 24 Oct 2011 16:42:19 +0300 Subject: [PATCH] Don't allow spawning objects without a model. --- qcsrc/server/mutators/sandbox.qc | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/qcsrc/server/mutators/sandbox.qc b/qcsrc/server/mutators/sandbox.qc index 6933e84c6..1e66c9d26 100644 --- a/qcsrc/server/mutators/sandbox.qc +++ b/qcsrc/server/mutators/sandbox.qc @@ -1,25 +1,32 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand) { if(MUTATOR_RETURNVALUE) // command was already handled? - return 0; + return FALSE; if(cmd_name == "g_sandbox") { if(cmd_argc < 2) { print_to(self, "Sandbox mode is active. For more information, use 'g_sandbox help'"); - return 1; + return TRUE; } if(argv(1) == "help") { print_to(self, "You can use the following sandbox commands:"); print_to(self, "^7\"^2spawn ^3models/foo/bar.md3^7\" spawns a new object in front of the player, and gives it the specified model"); - return 1; + return TRUE; } else if(argv(1) == "spawn") { // spawn a new object with the default settings + if(cmd_argc < 3) + { + // don't allow spawning objects without a model + print_to(self, "WARNING: Attempted to spawn an object without a model. Please specify the path to your mesh after the 'spawn' command"); + return TRUE; + } + entity e; e = spawn(); e.classname = "object"; @@ -32,10 +39,10 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand) if(autocvar_g_sandbox_info) print(strcat(self.netname, " spawned an object at origin ", vtos(e.origin), "\n")); - return 1; + return TRUE; } } - return 0; + return FALSE; } MUTATOR_DEFINITION(sandbox) -- 2.39.2