ExtraCommands: sm_team
This commit is contained in:
parent
0bb248fb3a
commit
6fc117efa7
@ -46,6 +46,7 @@ public void OnPluginStart()
|
||||
RegAdminCmd("sm_iammo", Command_InfAmmo, ADMFLAG_GENERIC, "sm_iammo <#userid|name> <0|1>");
|
||||
RegAdminCmd("sm_speed", Command_Speed, ADMFLAG_GENERIC, "sm_speed <#userid|name> <0|1>");
|
||||
RegAdminCmd("sm_respawn", Command_Respawn, ADMFLAG_GENERIC, "sm_respawn <#userid|name>");
|
||||
RegAdminCmd("sm_team", Command_Team, ADMFLAG_GENERIC, "sm_team <#userid|name> <team> [alive]");
|
||||
RegAdminCmd("sm_cash", Command_Cash, ADMFLAG_GENERIC, "sm_cash <#userid|name> <value>");
|
||||
RegAdminCmd("sm_modelscale", Command_ModelScale, ADMFLAG_GENERIC, "sm_modelscale <#userid|name> <scale>");
|
||||
RegAdminCmd("sm_resize", Command_ModelScale, ADMFLAG_GENERIC, "sm_resize <#userid|name> <scale>");
|
||||
@ -725,6 +726,61 @@ public Action Command_Respawn(int client, int argc)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action Command_Team(int client, int argc)
|
||||
{
|
||||
if(argc < 2)
|
||||
{
|
||||
ReplyToCommand(client, "[SM] Usage: sm_team <#userid|name> <team>");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
char sArgs[65];
|
||||
GetCmdArg(1, sArgs, sizeof(sArgs));
|
||||
|
||||
int iTeam = CS_TEAM_NONE;
|
||||
char sArgs2[8];
|
||||
GetCmdArg(2, sArgs2, sizeof(sArgs2));
|
||||
|
||||
bool bAlive = false;
|
||||
if(argc >= 3)
|
||||
{
|
||||
char sArgs3[8];
|
||||
GetCmdArg(3, sArgs3, sizeof(sArgs3));
|
||||
if(StringToInt(sArgs3))
|
||||
bAlive = true;
|
||||
}
|
||||
|
||||
if(StringToIntEx(sArgs2, iTeam) == 0 || iTeam < CS_TEAM_NONE || iTeam > CS_TEAM_CT)
|
||||
{
|
||||
ReplyToCommand(client, "[SM] Invalid Value");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
char sTargetName[MAX_TARGET_LENGTH];
|
||||
int iTargets[MAXPLAYERS];
|
||||
int iTargetCount;
|
||||
bool bIsML;
|
||||
|
||||
if((iTargetCount = ProcessTargetString(sArgs, client, iTargets, MAXPLAYERS, COMMAND_FILTER_ALIVE, sTargetName, sizeof(sTargetName), bIsML)) <= 0)
|
||||
{
|
||||
ReplyToTargetError(client, iTargetCount);
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
for(int i = 0; i < iTargetCount; i++)
|
||||
{
|
||||
if(bAlive)
|
||||
CS_SwitchTeam(iTargets[i], iTeam);
|
||||
else
|
||||
ChangeClientTeam(iTargets[i], iTeam);
|
||||
}
|
||||
|
||||
ShowActivity2(client, "\x01[SM] \x04", "\x01Changed \x04%s\x01 to team \x04%d", sTargetName, iTeam);
|
||||
LogAction(client, -1, "\"%L\" changed team%s to %d on target \"%s\"", client, bAlive ? " ALIVE" : "", iTeam, sTargetName);
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action Command_Cash(int client, int argc)
|
||||
{
|
||||
if(argc < 2)
|
||||
|
Loading…
Reference in New Issue
Block a user