09.11.2010, 21:43
I need a command to change someone's else team. Like : /changeteam <ID>
team[playerid] = 2; infected[playerid] = 0; SetPlayerPos(playerid,X,Y,Z); SetPlayerColor(playerid,ZRED); SetPlayerTeam(playerid, 2); SetPlayerHealth(playerid, 200); SetPlayerSkin(playerid,162); GameTextForPlayer(playerid,"~r~Zombie: ~b~/hide",10000,1); return 1; } if(team[playerid] == 1) //Humans { SetPlayerColor(playerid,CYAN); SetPlayerTeam(playerid, 1); GameTextForPlayer(playerid,"~b~~h~Human: ~b~/panic",10000,1); GivePlayerWeapon(playerid,24,300); GivePlayerWeapon(playerid,25,300); GivePlayerMoney(playerid, 20000); } if(team[playerid] == 2) //Zombies { SetPlayerColor(playerid,ZRED); SetPlayerTeam(playerid, 2); SetPlayerHealth(playerid, 200); GameTextForPlayer(playerid,"~r~Zombie: ~b~/hide",10000,1); } if(team[playerid] == 4) //Scientists { SetPlayerColor(playerid,WHITE); SetPlayerTeam(playerid, 1); GameTextForPlayer(playerid,"~w~Scientist: ~b~/anti",10000,1); GivePlayerWeapon(playerid,23,300); GivePlayerMoney(playerid, 20000); SetPlayerArmour(playerid, 100); } if(team[playerid] == 5) //Doctor { SetPlayerColor(playerid,ORANGE); SetPlayerTeam(playerid, 1); GameTextForPlayer(playerid,"~r~~h~Doctor: ~b~/heal",10000,1); SetPlayerPos(playerid,1624.2527,1821.0498,10.8203); SetPlayerFacingAngle(playerid,5.6779); GivePlayerWeapon(playerid,24,300); GivePlayerMoney(playerid, 20000); SetPlayerInterior(playerid,0); SetPlayerArmour(playerid, 100); return 1; } if(team[playerid] == 6) //S.T.A.R.S { SetPlayerColor(playerid,GREEN); SetPlayerTeam(playerid, 1); SetPlayerPos(playerid,1624.2527,1821.0498,10.8203); SetPlayerFacingAngle(playerid,5.6779); GivePlayerWeapon(playerid,31,300); GivePlayerWeapon(playerid,24,300); GivePlayerMoney(playerid, 20000); SetPlayerInterior(playerid,0); SetPlayerArmour(playerid, 100); return 1; } if(team[playerid] == 7) //UC { SetPlayerColor(playerid,TAN); SetPlayerTeam(playerid, 1); SetPlayerFacingAngle(playerid,5.6779); GivePlayerWeapon(playerid,31,300); GivePlayerWeapon(playerid,24,300); GivePlayerMoney(playerid, 20000); SetPlayerInterior(playerid,0); SetPlayerArmour(playerid, 100); return 1; }
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[128], idx;
cmd = strtok(cmdtext, idx);
if(!strcmp(cmd, "/setteam", false))
{
new tmp[128], tmp2[128], id, teams;
tmp = strtok(cmd, idx);
id = strval(tmp);
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xF0F0F0AA, "Player not connected.");
{
tmp2 = strtok(tmp, idx);
teams = strval(tmp2);
if(teams > 7 || 1 < teams) return SendClientMessage(playerid, 0xF0F0F0AA, "Valid teams are from 1 to 7.");
{
team[id] = teams;
SetPlayerTeam(id, teams);
SpawnPlayer(id);
}
}
}
return 0;
}
stock strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
This forum requires that you wait 120 seconds between posts. Please try again in 86 seconds.