how to show all connected player in one textdraw ?
#1

Код:
        new string[128];
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
            if(IsPlayerConnected(i)){
            format(string, sizeof(string), "%s(%d)~n~",PlayerName(i),i);
            PlayerTextDrawSetString(playerid,AllPlayerTextDraw[playerid],string);
            }

  		 }
but it only show 1 player

what should i do to print all players in the same textdraw ?
Reply
#2

pawn Код:
new string[2000];
for(new i = 0; i < MAX_PLAYERS; i++)
    if(IsPlayerConnected(i))
        format(string, sizeof(string), "%s%s(%d)~n~",string,PlayerName(i),i);

PlayerTextDrawSetString(playerid,AllPlayerTextDraw[playerid],string);
Reply
#3

Quote:
Originally Posted by Jefff
Посмотреть сообщение
pawn Код:
new string[2000];
for(new i = 0; i < MAX_PLAYERS; i++)
    if(IsPlayerConnected(i))
        format(string, sizeof(string), "%s%s(%d)~n~",string,PlayerName(i),i);

PlayerTextDrawSetString(playerid,AllPlayerTextDraw[playerid],string);
format(string, sizeof(string), "%s%s(%d)~n~",string,PlayerName(i),i);
Explanation of what Jefff did:

The server is formatting again the string MAX_PLAYERS times, and only the last connected player is being shown.
But with another %s and adding string as parameter, the string will contain the old string and the new.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)