add spawn command
This commit is contained in:
parent
c9ae3f3181
commit
55a34ef36b
@ -29,6 +29,20 @@ public void OnPluginStart() {
|
||||
RegAdminCmd("sm_quick_noclip", Command_QuickNoclip, ADMFLAG_SLAY|ADMFLAG_CHEATS);
|
||||
RegAdminCmd("sm_god", Command_Godmode, ADMFLAG_SLAY|ADMFLAG_CHEATS);
|
||||
RegAdminCmd("sm_give", Command_Give, ADMFLAG_SLAY|ADMFLAG_CHEATS);
|
||||
RegAdminCmd("sm_spawn", Command_Spawn, ADMFLAG_SLAY|ADMFLAG_CHEATS);
|
||||
}
|
||||
|
||||
public void ExecCommand(int client, char[] command) {
|
||||
int flagsgive = GetCommandFlags("give");
|
||||
int flagszspawn = GetCommandFlags("z_spawn_old");
|
||||
|
||||
SetCommandFlags("give", flagsgive & ~FCVAR_CHEAT);
|
||||
SetCommandFlags("z_spawn_old", flagszspawn & ~FCVAR_CHEAT);
|
||||
|
||||
FakeClientCommand(client, cmd);
|
||||
|
||||
SetCommandFlags("give", flagsgive|FCVAR_CHEAT);
|
||||
SetCommandFlags("z_spawn_old", flagsgive|FCVAR_CHEAT);
|
||||
}
|
||||
|
||||
public Action Command_QuickNoclip(int client, int args) {
|
||||
@ -89,10 +103,29 @@ public Action Command_Give(int client, int args)
|
||||
StrCat(cmd, sizeof(cmd), "give ");
|
||||
StrCat(cmd, sizeof(cmd), arg);
|
||||
|
||||
int flagsgive = GetCommandFlags("give");
|
||||
SetCommandFlags("give", flagsgive & ~FCVAR_CHEAT);
|
||||
FakeClientCommand(client, cmd);
|
||||
SetCommandFlags("give", flagsgive|FCVAR_CHEAT);
|
||||
ExecCommand(client, cmd);
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action Command_Spawn(int client, int args)
|
||||
{
|
||||
if (!IsClientInGame(client) || !IsPlayerAlive(client)) return Plugin_Handled;
|
||||
|
||||
if (args < 1)
|
||||
{
|
||||
ReplyToCommand(client, "[SM] Usage: sm_spawn <entity>");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
char arg[64];
|
||||
GetCmdArg(1, arg, sizeof(arg));
|
||||
|
||||
char cmd[64];
|
||||
StrCat(cmd, sizeof(cmd), "z_spawn_old ");
|
||||
StrCat(cmd, sizeof(cmd), arg);
|
||||
|
||||
ExecCommand(client, cmd);
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user