Resetting a string.. or something. - 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: Resetting a string.. or something. (
/showthread.php?tid=594612)
Resetting a string.. or something. -
Yochui - 20.11.2015
So, today I've encountered a problem with my /members command
pawn Код:
CMD:members(playerid, params[])
{
new userlist[250];
new name[MAX_PLAYER_NAME];
new counton[128];
new count = 0;
if(PlayerVar[playerid][GroupRank] > 5)
{
for(new i; i < MAX_PLAYERS; i++) {
if(PlayerVar[i][Group] == PlayerVar[playerid][Group]){
GetPlayerName(i, name, sizeof(name));
format(userlist, sizeof(userlist), "%s{068481}%s{FFFFFF} - Rank %d\n", userlist, name, PlayerVar[i][GroupRank]);
count++;
format(counton, sizeof(counton), "Membrii totali conectati in factiunea %s: %d", GroupInfo[PlayerVar[playerid][Group]][gName], count);
}
}
}
SCM(playerid, COLOR_NOB, counton);
ShowPlayerDialog(playerid, 97, DIALOG_STYLE_LIST, "UXG RPG: Members", userlist, "OK", "Cancel");
return 1;
}
Everything works fine, it is doing exactly what it is supposed to do (show online members of a faction)
But here's the problem, while the player is online it is being displayed in a dialog, along with other members
whenever he logs out, he's not being removed from that string and I can still see him when I use /members.
What might cause this bug?
Re: Resetting a string.. or something. -
Kyle - 20.11.2015
Change line: if(PlayerVar[i][Group] == PlayerVar[playerid][Group]){
To - if(PlayerVar[i][Group] == PlayerVar[playerid][Group] && IsPlayerConnected(i)){
Re: Resetting a string.. or something. -
Yochui - 20.11.2015
Quote:
Originally Posted by KyleSmith
Change line: if(PlayerVar[i][Group] == PlayerVar[playerid][Group]){
To - if(PlayerVar[i][Group] == PlayerVar[playerid][Group] && IsPlayerConnected(i)){
|
Thank you, it's working now.