Need help....
#1

Код:
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);
}
}
}
The problem is the SendClientMessage works perfect, it shows the stats of all players who are online. The textdraw only shows 1player.. how to fix this? i really need help with this problem.. would be cool if someone can help me.Or give ur msn or something so u can explain..

Thanks.
Reply
#2

I'm not sure if it will work, but try

pawn Код:
TextDrawShowForPlayer(i, DikkeDraw);
Instead of:

pawn Код:
TextDrawShowForAll(Text:DikkeDraw);
Reply
#3

Still the same. Someone else knows?
Reply
#4

EDIT: I failed

The reason its not working is because you set (TextDrawSetString) the text inside a loop. When you set the text it deletes the old one. Even if you formated the textdraw string you might not get the desired result because you would have x amount of players. Unless you have made the textdraw ok to hold all the info for your max players.
Reply
#5

Don't really understand..
Reply
#6

Hmm. Some fails...
pawn Код:
Stats()
{
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        if(IsPlayerConnected(i))
        {
            new temp[256]; //Max client message length = 128. This is too big string. And using this in a loop? WTF
            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); //In a loop? So it'll send the message ~ times (~ = ammount of connected players)
            TextDrawSetString(Text:DikkeDraw,temp); //Edit it ~ times for everyone? + Make a PLAYER textdraw.
            TextDrawShowForAll(Text:DikkeDraw); //See above
        }
    }
}
About the Make a PLAYEr textdraw:
That thing above is a global textdraw, I see. So, the player with the highest ID that's connected, his stats'll be displayed to everyone.
Reply
#7

Try indenting your code to make it easier to read!
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)