what wrong!!
#1

hey i do a dilaog for online donors but when 2+ donors ingame its show only the first one not all.

code:
Код:
CMD:donors(playerid, params[])
{
   new count = 0, string[900];
   for(new i = 0; i < MAX_PLAYERS; i ++)
   {

		  if(PlayerInfo[i][dRank] >= 1){
             count++;
             
       format(string, sizeof(string),"{0affea}%s | {FF7E19}dRank: %d\n",PlayerName2(i), PlayerInfo[i][dRank]);
             
}
   }
   if (!count) SendClientMessage(playerid, COLOR_PINK,"No Donors Online");
  else ShowPlayerDialog(playerid, DIALOG_WELCOMED, DIALOG_STYLE_MSGBOX, "{FF0000}Current Online Donors:", string, "Close", "");
   return 1;
}
Reply
#2

Write it like this:

PHP код:
CMD:donors(playerid, params[])
{
   new 
string[512];
   for(new 
i,l=GetPlayerPoolSize()+1; i < l; i ++)
   {
      if(!
IsPlayerConnected(i) || !PlayerInfo[i][dRank]) continue;
      
format(string, sizeof(string),"%s{0affea}%s | {FF7E19}dRank: %d\n",string,PlayerName2(i), PlayerInfo[i][dRank]);
   }
   if (!
string[0]) return SendClientMessage(playerid, COLOR_PINK,"No Donors Online");
   
ShowPlayerDialog(playerid, DIALOG_WELCOMED, DIALOG_STYLE_MSGBOX, "{FF0000}Current Online Donors:", string, "Close", "");
   return 
1;
} 
Reply
#3

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
Write it like this:

PHP код:
CMD:donors(playerid, params[])
{
   new 
string[512];
   for(new 
i,l=GetPlayerPoolSize()+1; i < l; i ++)
   {
      if(!
IsPlayerConnected(i) || !PlayerInfo[i][dRank]) continue;
      
format(string, sizeof(string),"%s{0affea}%s | {FF7E19}dRank: %d\n",string,PlayerName2(i), PlayerInfo[i][dRank]);
   }
   if (!
string[0]) return SendClientMessage(playerid, COLOR_PINK,"No Donors Online");
   
ShowPlayerDialog(playerid, DIALOG_WELCOMED, DIALOG_STYLE_MSGBOX, "{FF0000}Current Online Donors:", string, "Close", "");
   return 
1;
} 
thank you <3 +rep
Reply
#4

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
Write it like this:

PHP код:
CMD:donors(playerid, params[])
{
   new 
string[512];
   for(new 
i,l=GetPlayerPoolSize()+1; i < l; i ++)
   {
      if(!
IsPlayerConnected(i) || !PlayerInfo[i][dRank]) continue;
      
format(string, sizeof(string),"%s{0affea}%s | {FF7E19}dRank: %d\n",string,PlayerName2(i), PlayerInfo[i][dRank]);
   }
   if (!
string[0]) return SendClientMessage(playerid, COLOR_PINK,"No Donors Online");
   
ShowPlayerDialog(playerid, DIALOG_WELCOMED, DIALOG_STYLE_MSGBOX, "{FF0000}Current Online Donors:", string, "Close", "");
   return 
1;
} 
How about it?
(You know , it just mix up everything and shows other players instead admins and sometimes mixs up ranks and I don't know why, It was not like this way before I change it to TEXTDRAW mode.)
pawn Код:
if(strcmp(cmd, "/admins", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            //SendClientMessage(playerid, COLOR_WHITE, "Admins Online:");
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pStealthed] == 0)
                    {
                        new alevel[50];
                        if(PlayerInfo[i][pAdmin] == 1) { alevel = "{951FD0}Probie Admin"; }
                        if(PlayerInfo[i][pAdmin] == 2) { alevel = "{00FF0C}Junior Admin"; }
                        if(PlayerInfo[i][pAdmin] == 3) { alevel = "{00FF0C}General Admin"; }
                        if(PlayerInfo[i][pAdmin] >= 4 && PlayerInfo[i][pAdmin] <= 1335) { alevel = "{F4A460}Senior Admin"; }
                        if(PlayerInfo[i][pAdmin] >= 1336 && PlayerInfo[i][pAdmin] <= 99998) { alevel = "{FF0000}Head Admin"; }
                        if(PlayerInfo[i][pAdmin] >= 99999) { alevel = "{B52B19}Executive Admin"; }
                        format(string, 256, "%s{FFFFFF}[ %s {FFFFFF}] %s\n",string, alevel, PlayerRPName(i));

                    }
                }
            }
            ShowPlayerDialog(playerid,1378,DIALOG_STYLE_LIST,"{FFFFFF}Admins Online",string,"Ok","");
        }
        return 1;
    }
Reply
#5

You must use a local string:

PHP код:
if(strcmp(cmd, "/admins", true) == 0)
{
    new 
t_string[512]; //a local string is important!
    
for(new i,l=GetPlayerPoolSize()+1,alevel[50]; i < l; i++)
    {
        if(!
IsPlayerConnected(i)) continue;
        if(
PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pStealthed] == 0)
        {
            switch(
PlayerInfo[i][pAdmin]) {
                case 
1: alevel = "{951FD0}Probie Admin";
                case 
2: alevel = "{00FF0C}Junior Admin";
                case 
3: alevel = "{00FF0C}General Admin";
            }
            if(
PlayerInfo[i][pAdmin] >= 4 && PlayerInfo[i][pAdmin] <= 1335) { alevel = "{F4A460}Senior Admin"; }
            else if(
PlayerInfo[i][pAdmin] >= 1336 && PlayerInfo[i][pAdmin] <= 99998) { alevel = "{FF0000}Head Admin"; }
            else if(
PlayerInfo[i][pAdmin] >= 99999) { alevel = "{B52B19}Executive Admin"; }
            
format(t_string, sizeof t_string, "%s{FFFFFF}[ %s {FFFFFF}] %s\n",t_string, alevel, PlayerRPName(i));
        }
    }
    
ShowPlayerDialog(playerid,1378,DIALOG_STYLE_LIST,"{FFFFFF}Admins Online",t_string,"Ok","");
    return 
1;
} 
Reply


Forum Jump:


Users browsing this thread: