07.11.2010, 19:22
How do I make a command that changes a player's team ?
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); SetPlayerSkin(playerid,188); GivePlayerWeapon(playerid,25,300); GivePlayerMoney(playerid, 20000); } if(team[playerid] == 2) //Zombies { SetPlayerColor(playerid,ZRED); SetPlayerTeam(playerid, 2); SetPlayerHealth(playerid, 200); SetPlayerSkin(playerid,162); 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); SetPlayerSkin(playerid, 70); 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); SetPlayerSkin(playerid,276); 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,0x00FF00FF); SetPlayerTeam(playerid, 1); SetPlayerPos(playerid,1624.2527,1821.0498,10.8203); SetPlayerFacingAngle(playerid,5.6779); SetPlayerSkin(playerid,287); GivePlayerWeapon(playerid,31,300); GivePlayerWeapon(playerid,24,300); GivePlayerMoney(playerid, 20000); SetPlayerInterior(playerid,0); SetPlayerArmour(playerid, 100); return 1; } if(team[playerid] == 3) { GameTextForPlayer(playerid,"ERROR",10000,1); } SetPlayerRandomSpawn(playerid); infected[playerid] = 0; return 1; }
if(strcmp(cmdtext, "/putzombie", 10) == true)
{
team[strval(cmdtext[11])] = 2;
return 1;
}
CMD:putzombie(playerid, params[])
{
new target;
if(unformat(params, "u", target)) return SendClientMessage(playerid, 0xFAFAFAFA, "USAGE: /putzombie <playerid/name>");
else if(target == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFAFAFAFA, "Player not found");
team[target] = 2;
SetPlayerColor(target, ZRED);
SetPlayerTeam(target, 2);
SetPlayerHealth(target, 200);
SetPlayerSkin(target, 162);
GameTextForPlayer(target, "~r~Zombie: ~b~/hide", 10000, 1);
return 1;
}
if(strcmp(cmdtext, "/putzombie", 10) == true)
{
new id = strval(cmdtext[11]); //this is the id of the player whos team your trying to change
//just do everything with 'id', such as:
team[id] = 2; //change your players team
//change their color, etc
return 1;
}