Integer help -
NealPeteros - 26.12.2016
I tried using this command
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;
}
When I used /factions, the members became a string (The player's name).
This is the enumerator
PHP код:
enum FactionInfo {
fMembers,
fLeader[MAX_PLAYER_NAME+5]
};
Re: Integer help -
SyS - 26.12.2016
What you mean by the members became a string? what is the problem?
Re: Integer help -
NealPeteros - 26.12.2016
The leader's name is in the leader and members section
Re: Integer help -
NealPeteros - 26.12.2016
Preview
PHP код:
1. San Fierro Police Department (SFPD) | Leader: Test | Members: Test
Re: Integer help -
StrikerZ - 26.12.2016
Can you show the /faction command?
Re: Integer help -
NealPeteros - 26.12.2016
PHP код:
CMD:factions(playerid, params[])
{
SendClientMessage(playerid, -1, " ");
new string[780];
for(new i = 0; i<MAX_FACTIONS; i++)
{
switch (i)
{
case 1:
{
format(string, sizeof(string), "1. San Fierro Police Department (SFPD) | Leader: %s | Members: %s",FacInfo[i][fLeader], FacInfo[i][fMembers]);
SendClientMessage(playerid, TEAM_BLUE_COLOR, string);
}
case 2:
{
format(string, sizeof(string), "2. Apocalyptic Bureau of Emergencies (ABE) | Leader: %s | Members: %s",FacInfo[i][fLeader], FacInfo[i][fMembers]);
SendClientMessage(playerid, TEAM_FBI_COLOR, string);
}
case 3:
{
format(string, sizeof(string), "3. Medical Apocalyptic Operations (MAO) | Leader: %s | Members: %s",FacInfo[i][fLeader], FacInfo[i][fMembers]);
SendClientMessage(playerid, TEAM_MED_COLOR, string);
}
case 4:
{
format(string, sizeof(string), "4. Apocalyptic Government Operational Ventures (AGOV) | Leader: %s | Members: %s",FacInfo[i][fLeader], FacInfo[i][fMembers]);
SendClientMessage(playerid, COLOR_GREY, string);
}
case 5:
{
format(string, sizeof(string), "5. San Andreas News (SAN) | Leader: %s | Members: %s",FacInfo[i][fLeader], FacInfo[i][fMembers]);
SendClientMessage(playerid, TEAM_NEWS_COLOR, string);
}
case 6:
{
format(string, sizeof(string), "6. Apocalyptic Response Main Yard (ARMY) | Leader: %s | Members: %s",FacInfo[i][fLeader], FacInfo[i][fMembers]);
SendClientMessage(playerid, COLOR_NG, string);
}
}
}
return 1;
}
Seems nothing wrong
Re: Integer help -
StrikerZ - 26.12.2016
You are formatting the members to %s instead of %d
Re: Integer help -
NealPeteros - 26.12.2016
Fck. Didn't see that. Peace!