Wanted lvl updating, but not textdraw
#9

I thought of making look a bit better. What about updating the textdraw for every wanted star he gets from 1 to 6 and then stop updating the textdraw? So the textdraw will start showing stars from 1, 2, 3, 4, 5, 6 and then stick to 6. If the player wanted level gets reduced, stars will also get reduced. If his wanted level disappears, the textdraw will also become empty.

PHP код:
if(GetPVarInt(playerid,"Wanted") != pInfo[playerid][pWanted])
{
    new 
wlvl[9];
    
format(wlvl9"%d"pInfo[playerid][pWanted]);
    
PlayerTextDrawSetString(playeridWLvlTD[playerid], wlvl);
    
SetPVarInt(playerid,"Wanted"pInfo[playerid][pWanted]);
    new 
query[128], name[24];
    
GetPlayerName(playeridname24);
    
format(querysizeof(query), "UPDATE `playerdata` SET `wanted` = '%d' WHERE `username` = '%s'"pInfo[playerid][pWanted], name);
    
mysql_tquery(dbHandlequery);
    
    new 
starCount 0genTextStr[30];
    if(
pInfo[playerid][pWanted] > 0) {
        
format(genTextStrsizeof genTextStr"");
        for(new 
0pInfo[playerid][pWanted]; i++) {
            
starCount++;
            if(
starCount == 6) { 
                break;
            }
            else {
                
strcat(genTextStr"[]"sizeof genTextStr);
            }
        }
        
PlayerTextDrawSetString(playeridwLvlStars[playerid], genTextStr);
    }
    
    if(
pInfo[playerid][pWanted] == 0) {
        
PlayerTextDrawSetString(playeridwLvlStars[playerid], "");
    }

Test this out and tell me if it works.

Edit: just make sure you show the textdraw in OnPlayerConnect

PHP код:
PlayerTextDrawShow(wLvlStars[playerid]); 
Reply


Messages In This Thread
Wanted lvl updating, but not textdraw - by div - 21.06.2018, 05:17
Re: Wanted lvl updating, but not textdraw - by div - 21.06.2018, 05:28
Re: Wanted lvl updating, but not textdraw - by andrejc999 - 21.06.2018, 06:10
Re: Wanted lvl updating, but not textdraw - by div - 21.06.2018, 06:19
Re: Wanted lvl updating, but not textdraw - by div - 21.06.2018, 06:28
Re: Wanted lvl updating, but not textdraw - by div - 21.06.2018, 07:18
Re: Wanted lvl updating, but not textdraw - by Sew_Sumi - 21.06.2018, 08:25
Re: Wanted lvl updating, but not textdraw - by Revy - 21.06.2018, 09:31
Re: Wanted lvl updating, but not textdraw - by Private200 - 21.06.2018, 11:27
Re: Wanted lvl updating, but not textdraw - by div - 21.06.2018, 11:48

Forum Jump:


Users browsing this thread: 2 Guest(s)