SA-MP Forums Archive
Little help on textdraws. - 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: Little help on textdraws. (/showthread.php?tid=631319)



Little help on textdraws. - LazzyBoy - 26.03.2017

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;
}



Re: Little help on textdraws. - Nero_3D - 26.03.2017

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