11.02.2019, 01:13
You go like this, then just call UpdateHud() in the places where you code makes changes. If you have a lot of function calls where this data is changed like SetPlayerMoney() you just need to hook that function or create new ones that performs the task and calls the update. I doubt there is going to many places where level, exp, clan are changed so you just need to make sure to call UpdateHud() whenever a change is made. You can add any sqlite/mysql update queries you have here as well.
Code:
#define UPDATE_TYPE_MONEY 0 #define UPDATE_TYPE_LEVEL 1 #define UPDATE_TYPE_EXP 2 #define UPDATE_TYPE_CLAN 3 UpdateHud(playerid, type) { new str[64]; switch(type) { case UPDATE_TYPE_MONEY: { format(str, sizeof str, "$%d", PLAYER_MONEY[playerid]); //jn+ PlayerTextDrawSetString(playerid, TD_HUD[playerid][0], str); } case UPDATE_TYPE_LEVEL: { format(str, sizeof str, "- %d -", PLAYER_LEVEL[playerid]); //LEVEL PlayerTextDrawSetString(playerid, TD_HUD[playerid][1], str); } case UPDATE_TYPE_EXP: { format(str, sizeof str, "- %.3f -", PLAYER_EXP[playerid]); //EXP PlayerTextDrawSetString(playerid, TD_HUD[playerid][2], str); } case UPDATE_TYPE_CLAN: { format(str, sizeof str, "- %s -", PLAYER_CLAN[playerid]); //CLAN PlayerTextDrawSetString(playerid, TD_HUD[playerid][3], str); } } return 1; }