PHP Code:
#include <clientprefs>
public OnPluginStart()
{
AddCommandListener(JoinListener, "jointeam");
}
public Action:JoinListener(client, const String:command[], argc)
{
new String:team[50];
GetCmdArgString(team, sizeof(team));
if (StrEqual(team, "auto")) // we also need to hook auto, otherwise it will allow everybody to join to both teams
{
if (GetAdminFlag(GetUserAdmin(client), Admin_Reservation)) // check if player has flag A
ChangeClientTeam(client, GetRandomInt(2,3)); // gets random numer. 2 = red, 3 = blue
else
ChangeClientTeam(client, 2); // red
return Plugin_Handled;
}
if (GetAdminFlag(GetUserAdmin(client), Admin_Reservation)) // check if player has flag A
return Plugin_Continue;
else {
if (StrEqual(team, "blue"))
{
PrintToChat(client, "This team is reserver for admins Only.");
ChangeClientTeam(client, 2); // moves player to RED
return Plugin_Handled;
}
}
return Plugin_Continue;
}
Static code, add dynamic change support yourself.