15.03.2015, 15:33
I am trying to create a bonus health textdraw like a littlebar on healthbar which shows bonus HP,i tried to create but problem is i don't know how to update it when we take damage and remove it when bonushp reaches 0
CMD:test(playerid,params[]) { HPTimer = SetTimerEx("HBUpdate", 500, true, "i", playerid); GetPlayerHealth(playerid,health); BonusHP = SetPlayerHealth(playerid,health + 20); SendClientMessage(playerid,COLOR_GREEN,"ACTIVATED"); return 1; }
forward HBUpdate(playerid); public HBUpdate(playerid) { HealthBar[playerid] = CreatePlayerProgressBar(playerid, 589.000000, 69.000000, 20.000000, 2.000000, 1189758719, 20.000000, BAR_DIRECTION_RIGHT); SetPlayerProgressBarValue(playerid, HealthBar[playerid], BonusHP); ShowPlayerProgressBar(playerid,HealthBar[playerid]); if(BonusHP == 0) { KillTimer(HPTimer); DestroyPlayerProgressBar(playerid,HealthBar[playerid]); } return 1; }