28.10.2011, 18:29
PHP код:
CMD:invite(playerid,params[])
{
new string[128],id,sendername[MAX_PLAYER_NAME];
if(PlayerInfo[playerid][pGroup] <= 0) return SendClientMessage(playerid,COLOR_GRAY,"You're not part of a group!");
else if(sscanf(params,"u",id)) return SendClientMessage(playerid,COLOR_GRAY,"Syntax: /invite [id]");
else if(id==INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_GRAY,"Error: Player is not connected!");
else
{
PlayerInfo[playerid][pGroup] = id;
PlayerInfo[playerid][pRank] = 1;
GetPlayerName(playerid, sendername, sizeof(sendername));
if(PlayerInfo[playerid][pGroup] == 1) return PlayerInfo[id][pGroup] == 1;
else if(PlayerInfo[playerid][pGroup] == 2) return PlayerInfo[id][pGroup] == 2;
else if(PlayerInfo[playerid][pGroup] == 3) return PlayerInfo[id][pGroup] == 3;
else if(PlayerInfo[playerid][pGroup] == 4) return PlayerInfo[id][pGroup] == 4;
else if(PlayerInfo[playerid][pGroup] == 5) return PlayerInfo[id][pGroup] == 5;
else if(PlayerInfo[playerid][pGroup] == 6) return PlayerInfo[id][pGroup] == 6;
else if(PlayerInfo[playerid][pGroup] == 7) return PlayerInfo[id][pGroup] == 7;
else if(PlayerInfo[playerid][pGroup] == 8) return PlayerInfo[id][pGroup] == 8;
else if(PlayerInfo[playerid][pGroup] == 9) return PlayerInfo[id][pGroup] == 9;
else if(PlayerInfo[playerid][pGroup] == 10) return PlayerInfo[id][pGroup] == 10;
format(string,sizeof(string),"[INVITE] %s has invited you to group %d",sendername,id);
SendClientMessage(id,COLOR_YELLOW,string);
}
return 1;
}