Update player statistics in the textdraw
#1

Update player statistics in this way is fine? I understand that I can use 'OnPlayerUpdate' or use a timer in 'OnGameModeInit' but "I BELIEVE" that there is some recommended and best way to do this.

PHP Code:
public OnPlayerSpawn(playerid)
{
    
KillTimer(TIMER[playerid]);
    
TIMER[playerid] = SetTimerEx("UpdateHud"1000true"i"playerid);
    return 
1;
}
////////////////
UpdateHud(playerid)
{
    new 
str[64];
    
format(strsizeof str"$%d"PLAYER_MONEY[playerid]); //MONEY
    
PlayerTextDrawSetString(playeridTD_HUD[playerid][0], str);
    
    
format(strsizeof str"- %d -"PLAYER_LEVEL[playerid]); //LEVEL
    
PlayerTextDrawSetString(playeridTD_HUD[playerid][1], str);
    
    
format(strsizeof str"- %.3f -"PLAYER_EXP[playerid]); //EXP
    
PlayerTextDrawSetString(playeridTD_HUD[playerid][2], str);
    
    
format(strsizeof str"- %s -"PLAYER_CLAN[playerid]); //CLAN
    
PlayerTextDrawSetString(playeridTD_HUD[playerid][3], str);
    return 
1;

Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)