SA-MP Forums Archive
Need help please.. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need help please.. (/showthread.php?tid=245047)



Need help please.. - [Ha]Lommo - 29.03.2011

Код:
Stats()
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
new temp[256];
format(temp,sizeof(temp),"%s Kills: %d Deaths: %d Ratio: %0.2f\r\n Teamkills: %d",name,PlayerData[i][Kills],
PlayerData[i][Deaths],ratio,PlayerData[i][Tkills]);
SendClientMessageToAll(COLOR_RED,temp);
TextDrawSetString(Text:DikkeDraw,temp);
TextDrawShowForAll(Text:DikkeDraw);
}
}
}
Kay, well my problem is that if there are 2players in the server the sendclientmessage works good, it shows an apart message for every player and his stats. But the Text in the textdraw is only from one player.. and it doesn't show the 2nd one.. Hope u understand me.


Re: Need help please.. - [Ha]Lommo - 29.03.2011

bump.. please someone?


Re: Need help please.. - airsoft - 29.03.2011

first of all,

dont do Text:Dikkedraw in functions
just use DikkeDraw :p

2nd use
pawn Код:
SendClientMessage(i,COLOR_RED,temp);
3rd of all use
pawn Код:
TextDrawSetString(DikkeDraw,temp);
4th of all use
pawn Код:
TextDrawShowForPlayer(i,DikkeDraw);
its a loop, why use ForAll's ..?
I dont really know if thats what you need, but i can't really understand your english

EDIT: You don't need this in a loop


Re: Need help please.. - Jochemd - 30.03.2011

pawn Код:
Stats()
{
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        if(IsPlayerConnected(i))
        {
            new temp[128]; // 128 is enough, since it's the max for SendClientMessageToAll
            format(temp,sizeof(temp),"%s Kills: %d Deaths: %d Ratio: %0.2f\r\n Teamkills: %d",name,PlayerData[i][Kills],
            PlayerData[i][Deaths],ratio,PlayerData[i][Tkills]);
            SendClientMessageToAll(COLOR_RED,temp);
            TextDrawSetString(DikkeDraw,temp);
            TextDrawShowForAll(DikkeDraw);
        }
    }
}