11.07.2011, 21:17
Try:
PHP код:
if(strcmp(cmd, "/invite", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /invite [playerid/PartOfName]");
new ftext[20];
giveplayerid = ReturnUser(tmp);
if(PlayerInfo[playerid][pLeader] < 1) return SendClientMessage(playerid, COLOR_GRAD1, " You are not authorized to use that command (leaders only) !");
if(IsPlayerConnected(giveplayerid) && giveplayerid != INVALID_PLAYER_ID)
{
if(PlayerInfo[giveplayerid][pMember] == 0 && PlayerInfo[giveplayerid][pLeader] == 0 && PlayerInfo[giveplayerid][pFMember] == 255)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
if(PlayerInfo[playerid][pLeader] == 1) {ftext = "Los Santos Police Department";}
else if(PlayerInfo[playerid][pLeader] == 2) {ftext = "Federal Bureau of Investigation";}
else if(PlayerInfo[playerid][pLeader] == 3) {ftext = "Department of Corrections";}
else if(PlayerInfo[playerid][pLeader] == 4) {ftext = "Los Santos Emergency Medical Services";}
else if(PlayerInfo[playerid][pLeader] == 5) {ftext = "U.S. Navy Seals";}
else if(PlayerInfo[playerid][pLeader] == 6) {ftext = "The Government";}
else if(PlayerInfo[playerid][pLeader] == 7) {ftext = "Secret Service";}
else if(PlayerInfo[playerid][pLeader] == {ftext = "Hitman Agency";}
else if(PlayerInfo[playerid][pLeader] == 9) {ftext = "San Andreas News Network";}
else if(PlayerInfo[playerid][pLeader] == 10) {ftext = "Taxi Cab Company";}
format(string, sizeof(string), "You have invited %s to join %s.", giveplayer, ftext);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "%s has invited you to join %s. Type /accept faction to accept the invitation.",sendername, ftext);
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
FactionOffer[giveplayerid] = playerid;
}
else return SendClientMessage(playerid, COLOR_GREY, "The subjected player is already a member of an official faction.");
}
return 1;
}