/Wanted
#1

I have a cycle.
How to make the list of the cycle displayed in the chat in a row / line (not in the column, and row / row)
PHP код:
new string[50];
  
send(playeridCOLOR_GREEN"Wanted");
  for(new 
0MAX_PLAYERSi++)
  {
    if(
pl[i][pWlevel] > 0)
    {
          
format(string,sizeof(string),"%s[ID:%d] level: %d",pl[i][pName],i,pl[i][pWlevel]);
          
send(playerid,COLOR_IVORY,string);
    }
  } 
Reply
#2

Instead of instantly sending the message to the player during every loop iteration you would need to keep formatting the string while also including the string inside itself. In the end you will end up with a string that will (the majority of time) not fit into a single line.

PHP код:
new string[144]; 
  
format(string,sizeof(string),"Wanted:\n"); 
  for(new 
0MAX_PLAYERSi++) 
  { 
    if(
pl[i][pWlevel] > 0
    { 
          
format(string,sizeof(string),"%s%s[ID:%d] level: %d | ",string,pl[i][pName],i,pl[i][pWlevel]); 
    } 
  }
send(playerid,COLOR_IVORY,string); 
Notice how I included the older string inside the new formatted string and only sent the message after the loop ends.
I absolutely don't suggest doing this since it's guaranteed that the string will be too long to fit (unless you are using that multi-line text include) and the players won't see most of it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)