26.12.2016, 02:23
I tried using this command
When I used /factions, the members became a string (The player's name).
This is the enumerator
PHP код:
CMD:makeleader(playerid, params[])
{
new targetid, factionid, string[128], targetname[24], playername[24];
new lname[MAX_PLAYER_NAME];
lname = PlayerName(playerid);
if(pInfo[playerid][pAdminLevel] <= 5) return SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use this command");
if(sscanf(params, "ui", targetid, factionid)) {
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makeleader [playerid] [factionid]");
SendClientMessage(playerid, COLOR_GRAD4, "1: S.F.P.D 2: B.A.E 3: M.A.O 4: A.G.O.V 5: S.A.N 6: A.R.M.Y");
return 1;
}
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified!");
if(0 < factionid < 7)
{
GetPlayerName(playerid, playername, sizeof(playername));
GetPlayerName(targetid, targetname, sizeof(targetname));
pInfo[playerid][pFaction] = factionid;
pInfo[playerid][pFRank] = 10;
pInfo[playerid][pFLeader] = factionid;
strcpy(FacInfo[pInfo[playerid][pFaction]][fLeader], lname, MAX_PLAYER_NAME);
FacInfo[pInfo[playerid][pFaction]][fMembers]++; //HERE
format(string, sizeof(string), "You made %s leader of faction id %i(%s)!", PlayerName(targetid), factionid, FactionName(playerid));
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "You were made leader of faction id %i(%s) by %s %s", factionid, FactionName(playerid), AdminRank(playerid), playername);
SendClientMessage(targetid, COLOR_LIGHTBLUE, string);
}
else return SendClientMessage(playerid, -1, "Invalid faction ID.");
SaveStats(playerid);
return 1;
}
This is the enumerator
PHP код:
enum FactionInfo {
fMembers,
fLeader[MAX_PLAYER_NAME+5]
};