1 MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand)
3 if(MUTATOR_RETURNVALUE) // command was already handled?
5 if(cmd_name == "g_sandbox")
9 print_to(self, "Sandbox mode is active. For more information, use 'g_sandbox help'");
15 print_to(self, "You can use the following sandbox commands:");
16 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");
19 else if(argv(1) == "spawn")
21 // spawn a new object with the default settings
25 makevectors(self.v_angle);
26 traceline(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * 250, MOVE_NOMONSTERS, self);
27 setorigin(e, trace_endpos);
28 setmodel(e, "models/vehicles-static/raptor.md3");
29 e.angles = self.v_angle; // give the player's angles to the object, as he spawns it from behind
31 if(autocvar_g_sandbox_info)
32 print(strcat(self.netname, " spawned an object at origin ", vtos(e.origin), "\n"));
40 MUTATOR_DEFINITION(sandbox)
42 MUTATOR_HOOK(SV_ParseClientCommand, sandbox_PlayerCommand, CBC_ORDER_ANY);