Whitetigerswt

Untitled

Oct 17th, 2011
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.23 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. new Float:HP[MAX_PLAYERS];
  4. new Float:AP[MAX_PLAYERS];
  5. new tempdamage[MAX_PLAYERS] = 0;
  6. new tempdamagetimer[MAX_PLAYERS] = -1;
  7. new Text3D:label[MAX_PLAYERS];
  8.  
  9. public OnFilterScriptInit() {
  10.     for(new i=0; i != MAX_PLAYERS; ++i) {
  11.         label[i] = Create3DTextLabel("-",0xDC143FF,0.0, 0.0, 0.0, 30.0, 0, 0);
  12.     }
  13.     return 1;
  14. }
  15.  
  16. public OnPlayerUpdate(playerid) {
  17.     new Float:HPt, Float:APt;
  18.     GetPlayerHealth(playerid, HPt);
  19.     GetPlayerArmour(playerid, APt);
  20.  
  21.     if(HP[playerid] != HPt || APt != AP[playerid]) {
  22.         new Float:res = (HP[playerid] + AP[playerid]) - (HPt+APt);
  23.         tempdamage[playerid] += floatround(res);
  24.         KillTimer(tempdamagetimer[playerid]);
  25.         tempdamagetimer[playerid] = SetTimerEx("Resettmp", 3000, 0, "d", playerid);
  26.         new str[10];
  27.         format(str, sizeof(str), "%d", tempdamage[playerid]);
  28.         Update3DTextLabelText(label[playerid], 0xDC143FF, str);
  29.         Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.7);
  30.         //SetPlayerChatBubble(playerid, str, 0xDC143CFF, 30.0, 2000);
  31.     }
  32.     HP[playerid] = HPt;
  33.     AP[playerid] = APt;
  34.     return 1;
  35. }
  36.  
  37. forward Resettmp(playerid);
  38. public Resettmp(playerid) {
  39.     tempdamage[playerid] = 0;
  40.     Update3DTextLabelText(label[playerid], 0xDC143FF, "-");
  41.     return 1;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment