allow using client id

This commit is contained in:
Robin Appelman 2026-06-25 22:19:47 +02:00
commit 7ae52b678f
2 changed files with 15 additions and 1 deletions

Binary file not shown.

View file

@ -13,6 +13,8 @@ public Plugin:myinfo = {
KeyValues force_team;
public OnPluginStart() {
LoadTranslations("common.phrases");
RegServerCmd("sm_setteam", SetTeam, "Set a players team");
RegServerCmd("sm_forceteam", ForceExec, "Set a players team and keep them there");
@ -75,7 +77,19 @@ public Action:SetTeam(args) {
return Plugin_Handled;
}
int client = FindTarget(0, player, false, true);
int client = StringToInt(player);
if (client <= 0) {
client = FindTarget(0, player, false, true);
} else {
client -= 1; // status starts client ids with
}
if (client <= 0) {
PrintToServer("Player '%s' not found", player);
return Plugin_Handled;
}
set_force(client, 0);
ChangeClientTeam(client, team);