Problem with text draw timer
#1

Hello all,

I have tried to create a text draw stats bar that sits at the bottom of the screen and updates as your stats update,
The text draw works fine, and will display, it's just as soon as the timer updates for the first time, the bar dissapears.

pawn Код:
public UpdateStats(playerid)
{
    for(new i; i < MAX_PLAYERS; i++)// this is to find the playerid
    {
        if(IsPlayerConnected(i))
        {
            i = playerid;
        }
    }
    new
        str[128],
        Float:ratio,
        k,d;
    if((PlayerInfo[playerid][Kills] != 0) && PlayerInfo[playerid][Deaths] == 0)//just a script to work out a kill death ratio
    {
        ratio = 100.00;
    }
    else
    {
        ratio = floatdiv(PlayerInfo[playerid][Kills], PlayerInfo[playerid][Deaths]);
    }
    k = PlayerInfo[playerid][Kills];
    d = PlayerInfo[playerid][Deaths];


    format(str,sizeof(str),"~r~K: ~w~%d | ~r~D: ~w~%d | ~r~K/D: ~w~%.2f ",k,d,ratio);
    TextDrawSetString(TotalStats[playerid],str);
    SendClientMessage(playerid,WHITE,str);
    return 1;
}
the reason I put the loop in there to find the playerid is because I want to put the timer under OnGameModeInit, that way there is 1 continuous timer, instead of a seperate timer for each individual player.

I get the text: "~r~K: ~w~%d | ~r~D: ~w~%d | ~r~K/D: ~w~%.2f " sent to me through SendClientMessage, it just won't work through textdraw.

This has been bugging me for quite some time,
any help will be greatly appreciated.
Reply


Messages In This Thread
Problem with text draw timer - by mrcoolballs - 09.06.2012, 04:31
Re: Problem with text draw timer - by JhnzRep - 09.06.2012, 05:38
Re: Problem with text draw timer - by mrcoolballs - 09.06.2012, 06:21
Re: Problem with text draw timer - by JhnzRep - 09.06.2012, 06:45
Re: Problem with text draw timer - by mrcoolballs - 09.06.2012, 06:50
Re: Problem with text draw timer - by JhnzRep - 09.06.2012, 06:53
Re: Problem with text draw timer - by [KHK]Khalid - 09.06.2012, 07:05
Re: Problem with text draw timer - by mrcoolballs - 09.06.2012, 07:09
Re: Problem with text draw timer - by [KHK]Khalid - 09.06.2012, 07:40
Re: Problem with text draw timer - by mrcoolballs - 09.06.2012, 08:24

Forum Jump:


Users browsing this thread: 5 Guest(s)