Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- forward Fresh();
- new Text:Health[3];
- new PlayerText:PlayerHpT[MAX_PLAYERS][5];
- new DrawHP[MAX_PLAYERS];
- public OnGameModeInit()
- {
- SetTimer("Fresh",1000,1); //one second timer
- Health[0] = TextDrawCreate(365.125000, 107.083328, "usebox");
- TextDrawLetterSize(Health[0], 0.000000, 1.562963);
- TextDrawTextSize(Health[0], 261.125000, 0.000000);
- TextDrawAlignment(Health[0], 1);
- TextDrawColor(Health[0], 0);
- TextDrawUseBox(Health[0], true);
- TextDrawBoxColor(Health[0], 102);
- TextDrawSetShadow(Health[0], 0);
- TextDrawSetOutline(Health[0], 0);
- TextDrawFont(Health[0], 0);
- Health[1] = TextDrawCreate(365.125000, 127.500000, "usebox");
- TextDrawLetterSize(Health[1], 0.000000, 0.072222);
- TextDrawTextSize(Health[1], 261.125000, 0.000000);
- TextDrawAlignment(Health[1], 1);
- TextDrawColor(Health[1], 0);
- TextDrawUseBox(Health[1], true);
- TextDrawBoxColor(Health[1], 102);
- TextDrawSetShadow(Health[1], 0);
- TextDrawSetOutline(Health[1], 0);
- TextDrawFont(Health[1], 0);
- Health[2] = TextDrawCreate(365.125000, 134.500000, "usebox");
- TextDrawLetterSize(Health[2], 0.000000, 0.072222);
- TextDrawTextSize(Health[2], 261.125000, 0.000000);
- TextDrawAlignment(Health[2], 1);
- TextDrawColor(Health[2], 0);
- TextDrawUseBox(Health[2], true);
- TextDrawBoxColor(Health[2], 102);
- TextDrawSetShadow(Health[2], 0);
- TextDrawSetOutline(Health[2], 0);
- TextDrawFont(Health[2], 0);
- return true;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- for(new i; i < 5; i ++) PlayerTextDrawDestroy(playerid, PlayerHpT[playerid][i]);
- return true;
- }
- public OnPlayerConnect(playerid)
- {
- DrawHP[playerid] = 0;
- PlayerHpT[playerid][0] = CreatePlayerTextDraw(playerid, 269.375000, 109.083335, "Ayzek_Clark");
- PlayerTextDrawLetterSize(playerid, PlayerHpT[playerid][0], 0.190000, 0.917499);
- PlayerTextDrawAlignment(playerid, PlayerHpT[playerid][0], 1);
- PlayerTextDrawColor(playerid, PlayerHpT[playerid][0], -1);
- PlayerTextDrawSetShadow(playerid, PlayerHpT[playerid][0], 0);
- PlayerTextDrawSetOutline(playerid, PlayerHpT[playerid][0], 1);
- PlayerTextDrawBackgroundColor(playerid, PlayerHpT[playerid][0], 51);
- PlayerTextDrawFont(playerid, PlayerHpT[playerid][0], 1);
- PlayerTextDrawSetProportional(playerid, PlayerHpT[playerid][0], 1);
- PlayerHpT[playerid][1] = CreatePlayerTextDraw(playerid, 266.20, 127.500000, "usebox"); //111
- PlayerTextDrawLetterSize(playerid, PlayerHpT[playerid][1], 0.000000, 0.032222);
- PlayerTextDrawTextSize(playerid, PlayerHpT[playerid][1], 261.95000, 0.000000);
- PlayerTextDrawAlignment(playerid, PlayerHpT[playerid][1], 1);
- PlayerTextDrawColor(playerid, PlayerHpT[playerid][1], -1);
- PlayerTextDrawUseBox(playerid, PlayerHpT[playerid][1], 1);
- PlayerTextDrawBoxColor(playerid, PlayerHpT[playerid][1], COLOR_REDD);
- PlayerTextDrawSetShadow(playerid, PlayerHpT[playerid][1], 0);
- PlayerTextDrawSetOutline(playerid, PlayerHpT[playerid][1], 0);
- PlayerTextDrawFont(playerid, PlayerHpT[playerid][1], 0);
- PlayerTextDrawBackgroundColor(playerid, PlayerHpT[playerid][1], 255);
- PlayerHpT[playerid][2] = CreatePlayerTextDraw(playerid, 266.20, 134.500000, "usebox"); //222
- PlayerTextDrawLetterSize(playerid, PlayerHpT[playerid][2], 0.000000, 0.032222);
- PlayerTextDrawTextSize(playerid, PlayerHpT[playerid][2], 261.95000, 0.000000);
- PlayerTextDrawAlignment(playerid, PlayerHpT[playerid][2], 1);
- PlayerTextDrawColor(playerid, PlayerHpT[playerid][2], -1);
- PlayerTextDrawUseBox(playerid, PlayerHpT[playerid][2], 1);
- PlayerTextDrawBoxColor(playerid, PlayerHpT[playerid][2], COLOR_LIGHTBLUE);
- PlayerTextDrawSetShadow(playerid, PlayerHpT[playerid][2], 0);
- PlayerTextDrawSetOutline(playerid, PlayerHpT[playerid][2], 0);
- PlayerTextDrawFont(playerid, PlayerHpT[playerid][2], 0);
- PlayerTextDrawBackgroundColor(playerid, PlayerHpT[playerid][2], 255);
- PlayerHpT[playerid][3] = CreatePlayerTextDraw(playerid, 305.625000, 124.250000, "100");
- PlayerTextDrawLetterSize(playerid, PlayerHpT[playerid][3], 0.196248, 0.649165);
- PlayerTextDrawAlignment(playerid, PlayerHpT[playerid][3], 1);
- PlayerTextDrawColor(playerid, PlayerHpT[playerid][3], -1);
- PlayerTextDrawSetShadow(playerid, PlayerHpT[playerid][3], 0);
- PlayerTextDrawSetOutline(playerid, PlayerHpT[playerid][3], 1);
- PlayerTextDrawBackgroundColor(playerid, PlayerHpT[playerid][3], 51);
- PlayerTextDrawFont(playerid, PlayerHpT[playerid][3], 1);
- PlayerTextDrawSetProportional(playerid, PlayerHpT[playerid][3], 1);
- PlayerHpT[playerid][4] = CreatePlayerTextDraw(playerid, 305.625000, 131.250000, "100");
- PlayerTextDrawLetterSize(playerid, PlayerHpT[playerid][4], 0.196248, 0.649165);
- PlayerTextDrawAlignment(playerid, PlayerHpT[playerid][4], 1);
- PlayerTextDrawColor(playerid, PlayerHpT[playerid][4], -1);
- PlayerTextDrawSetShadow(playerid, PlayerHpT[playerid][4], 0);
- PlayerTextDrawSetOutline(playerid, PlayerHpT[playerid][4], 1);
- PlayerTextDrawBackgroundColor(playerid, PlayerHpT[playerid][4], 51);
- PlayerTextDrawFont(playerid, PlayerHpT[playerid][4], 1);
- PlayerTextDrawSetProportional(playerid, PlayerHpT[playerid][4], 1);
- return true;
- }
- public Fresh()
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(DrawHP[i] > 0)
- {
- DrawHP[i] --;
- if(DrawHP[i] == 1) HideDrawHP(i);
- }
- }
- return true;
- }
- stock HideDrawHP(playerid)
- {
- for(new i; i < 3; i ++) TextDrawHideForPlayer(playerid, Health[i]);
- for(new i; i < 5; i ++) PlayerTextDrawHide(playerid, PlayerHpT[playerid][i]);
- DrawHP[playerid] = 0;
- return 1;
- }
- public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
- {
- new string[128];
- if(GetPlayerWeapon(playerid) > 18)
- {
- new sendername[24];
- GetPlayerName(damagedid, sendername, sizeof(sendername));
- new oldhp = floatround(Float:amount, floatround_ceil);
- new Float:draw;
- for(new i; i < 3; i ++) TextDrawShowForPlayer(playerid, Health[i]);
- new Float:armour;
- GetPlayerArmour(damagedid, armour);
- if(armour-oldhp > 0)
- {
- if(armour-oldhp < 0) format(string, sizeof(string), "0");
- else format(string,sizeof(string),"%.0f",armour-oldhp);
- PlayerTextDrawSetString(playerid,PlayerHpT[playerid][4], string);
- draw = 261.95 + armour-oldhp * 1.00;
- if(draw < 261.95) draw = 261.95;
- else if(draw > 359.6) draw = 359.6;
- else if(draw < 0.0) draw = 0.0;
- PlayerTextDrawTextSize(playerid, PlayerHpT[playerid][2], draw, 0.0);
- new Float:Healthh;
- GetPlayerHealth(damagedid, Healthh);
- format(string,sizeof(string),"%.0f",Healthh);
- PlayerTextDrawSetString(playerid,PlayerHpT[playerid][3], string);
- draw = 261.95 + Healthh * 1.00;
- if(draw < 261.95) draw = 261.95;
- else if(draw > 359.6) draw = 359.6;
- else if(draw < 0.0) draw = 0.0;
- PlayerTextDrawTextSize(playerid, PlayerHpT[playerid][1], draw, 0.0);
- }
- else if(armour-oldhp < 0)
- {
- new Float:Healthh;
- GetPlayerHealth(damagedid, Healthh);
- if(Healthh-oldhp < 0) format(string, sizeof(string), "0");
- else format(string,sizeof(string),"%.0f",Healthh-oldhp);
- PlayerTextDrawSetString(playerid,PlayerHpT[playerid][3], string);
- draw = 261.95 + Healthh-oldhp * 1.00;
- if(draw < 261.95) draw = 261.95;
- else if(draw > 359.6) draw = 359.6;
- else if(draw < 0.0) draw = 0.0;
- PlayerTextDrawTextSize(playerid, PlayerHpT[playerid][1], draw, 0.0);
- format(string, sizeof(string), "0");
- PlayerTextDrawSetString(playerid,PlayerHpT[playerid][4], string);
- PlayerTextDrawTextSize(playerid, PlayerHpT[playerid][2], 261.95, 0.0);
- }
- format(string,sizeof(string),"%s - %d",sendername, damagedid);
- PlayerTextDrawSetString(playerid,PlayerHpT[playerid][0], string);
- for(new i; i < 5; i ++) PlayerTextDrawShow(playerid, PlayerHpT[playerid][i]);
- DrawHP[playerid] = 6;
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment