Update player statistics in the textdraw
#3

Then how would I do it correctly? This is what I have right now in my game mode.

PHP Code:
public OnPlayerSpawn(playerid)
{
    
ShowHud(playerid)
    return 
1;
}
ShowHud(playerid)
{
    
PlayerTextDrawShow(playeridTD_HUD[playerid][0]);
    
PlayerTextDrawShow(playeridTD_HUD[playerid][1]);
    
PlayerTextDrawShow(playeridTD_HUD[playerid][2]);
    
PlayerTextDrawShow(playeridTD_HUD[playerid][3]);
    
    
KillTimer(TIMER[playerid]);
    
TIMER[playerid] = SetTimerEx("UpdateHud"1000true"i"playerid);
    return 
1;

PHP Code:
UpdateHud(playerid)
{
    if(
PLAYER_EXP[playerid] >= PLAYER_LEVEL[playerid] * 12)
    {
        
PLAYER_LEVEL[playerid] ++;
        
PLAYER_EXP[playerid] = 1;
        
        new 
Query[256];
        
format(Querysizeof Query"UPDATE PLAYERS SET LEVEL = '%d', EXP = '%d' WHERE PLAYER_ID = '%d';"PLAYER_LEVEL[playerid], PLAYER_EXP[playerid], PLAYER_ID[playerid]);
        
db_query(DT_DBQuery);
    }
    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
Update player statistics in the textdraw - by N3mesiS - 11.02.2019, 00:13
Re: Update player statistics in the textdraw - by Pottus - 11.02.2019, 00:33
Re: Update player statistics in the textdraw - by N3mesiS - 11.02.2019, 00:46
Re: Update player statistics in the textdraw - by Pottus - 11.02.2019, 01:13
Re: Update player statistics in the textdraw - by N3mesiS - 11.02.2019, 11:50
Re: Update player statistics in the textdraw - by N3mesiS - 11.02.2019, 22:14
Re: Update player statistics in the textdraw - by SymonClash - 11.02.2019, 22:30
Re: Update player statistics in the textdraw - by Pottus - 11.02.2019, 22:31
Re: Update player statistics in the textdraw - by SymonClash - 12.02.2019, 20:18
Re: Update player statistics in the textdraw - by N3mesiS - 12.02.2019, 20:32

Forum Jump:


Users browsing this thread: 2 Guest(s)