Looping all members in Family/Faction Help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Looping all members in Family/Faction Help (
/showthread.php?tid=399407)
Looping all members in Family/Faction Help -
PRoleplay - 14.12.2012
my problem is when i type /members in game
all of the names of the list are the same but the ranks are ok
example. im Steve_John Rank 6 and i have family members online and his name is Steve_Willson Rank5 when i typing /members the result is always
Members Online
Steve_John Rank: 6
Steve_John Rank:5
same of Steve Willson

heres my looping command on /members
PHP код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "");
if(PlayerInfo[playerid][pLeader] || PlayerInfo[playerid][pMember])
{
if (PlayerInfo[i][pLeader] == teamnumber)
{
format(string, sizeof(string), "%s (Leader)",sendername);
}
else if (PlayerInfo[i][pMember] == teamnumber)
{
format(string, sizeof(string), "%s, Rank: %d.",sendername, PlayerInfo[i][pRank]);
}
}
else if(PlayerInfo[playerid][pFMember] != 255)
{
if (PlayerInfo[i][pFMember] == teamnumber)
{
format(string, sizeof(string), "%s, Rank: %d.",sendername, PlayerInfo[i][pRank]);
}
}
if (strlen(string) > 1) SendClientMessage(playerid, 0xF5DEB3AA, string);
}
}
Re: Looping all members in Family/Faction Help -
Threshold - 14.12.2012
Change
pawn Код:
GetPlayerName(playerid, sendername, sizeof(sendername));
To:
pawn Код:
GetPlayerName(i, sendername, sizeof(sendername));
You want to get the name from ID: 'i', not from 'playerid = 0 by default if not specified.
Re: Looping all members in Family/Faction Help -
PRoleplay - 14.12.2012
oh thank you so much i will try this
Re: Looping all members in Family/Faction Help -
PRoleplay - 14.12.2012
it works! thanks +rep!