21.06.2018, 11:27
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.
Test this out and tell me if it works.
Edit: just make sure you show the textdraw in OnPlayerConnect
PHP код:
if(GetPVarInt(playerid,"Wanted") != pInfo[playerid][pWanted])
{
new wlvl[9];
format(wlvl, 9, "%d", pInfo[playerid][pWanted]);
PlayerTextDrawSetString(playerid, WLvlTD[playerid], wlvl);
SetPVarInt(playerid,"Wanted", pInfo[playerid][pWanted]);
new query[128], name[24];
GetPlayerName(playerid, name, 24);
format(query, sizeof(query), "UPDATE `playerdata` SET `wanted` = '%d' WHERE `username` = '%s'", pInfo[playerid][pWanted], name);
mysql_tquery(dbHandle, query);
new starCount = 0, genTextStr[30];
if(pInfo[playerid][pWanted] > 0) {
format(genTextStr, sizeof genTextStr, "");
for(new i = 0; i < pInfo[playerid][pWanted]; i++) {
starCount++;
if(starCount == 6) {
break;
}
else {
strcat(genTextStr, "[]", sizeof genTextStr);
}
}
PlayerTextDrawSetString(playerid, wLvlStars[playerid], genTextStr);
}
if(pInfo[playerid][pWanted] == 0) {
PlayerTextDrawSetString(playerid, wLvlStars[playerid], "");
}
}
Edit: just make sure you show the textdraw in OnPlayerConnect
PHP код:
PlayerTextDrawShow(wLvlStars[playerid]);