Little help on textdraws.
#1

okay so basicly what i was doing is trying to show all players name that are in table to a textdraw but it seems to be mixed up or it shows only one name anyway heres my code

Код:
for(new i, j=GetPlayerPoolSize(); i<=j; i++)
	{
	    if(GetPVarInt(i,"ontable") == GetPVarInt(playerid,"ontable"))
		{
			new string[50];
			format(string,sizeof(string),"%s",RoleName(i));
                        TextDrawSetString(Textdraw0[i],string);
                        TextDrawShowForPlayer(i,Textdraw0[i]);
                } 
         }
RoleName

Код:
stock RoleName(playerid)
{
    new string[24];
    GetPlayerName(playerid,string,24);
    new str[24];
    strmid(str,string,0,strlen(string),24);
    for(new i = 0; i < MAX_PLAYER_NAME; i++)
    {
        if (str[i] == '_') str[i] = ' ';
    }
    return str;
}
Reply
#2

You never concatenate the strings, so only one name will be shown

PHP код:
new string[512];
for(new 
ij=GetPlayerPoolSize(); i<=ji++)
{
    if(
GetPVarInt(i,"ontable") == GetPVarInt(playerid,"ontable"))
    {
        
strcat(string"\n");
        
strcat(stringRoleName(i));
    }
}
TextDrawSetString(Textdraw0[playerid], string);
TextDrawShowForPlayer(playeridTextdraw0[playerid]); 
You should switch to playertextdraws because the limit for global textdraws is 2048
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)