Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Feb 16th, 2020 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=====================INCLUDES=====================
  2.  
  3. #include    <a_samp>
  4. #include    <zcmd>
  5. #include    <sscanf2>
  6.  
  7. //=====================DIALOGS======================
  8.  
  9. #define     DIALOG_DAMAGE       1927
  10.  
  11. //==================CONTROL PANEL===================
  12.  
  13. #define     FILTERSCRIPT
  14. #define     MAX_DAMAGES         1000
  15.  
  16. #define     SCM                 SendClientMessage
  17. #define     FORMAT:%0(%1)       format(%0, sizeof(%0), %1)
  18.  
  19. #define     BODY_PART_TORSO     3
  20. #define     BODY_PART_GROIN     4
  21. #define     BODY_PART_RIGHT_ARM 5
  22. #define     BODY_PART_LEFT_ARM  6
  23. #define     BODY_PART_RIGHT_LEG 7
  24. #define     BODY_PART_LEFT_LEG  8
  25. #define     BODY_PART_HEAD      9
  26.  
  27. //===================ENUMERATORS====================
  28.  
  29. enum dmgInfo
  30. {
  31.     dmgDamage,
  32.     dmgWeapon,
  33.     dmgBodypart,
  34.     dmgKevlarhit,
  35.     dmgSeconds[90],
  36. }
  37. new DamageInfo[MAX_PLAYERS][MAX_DAMAGES][dmgInfo];
  38.  
  39. public OnFilterScriptInit()
  40. {
  41.     print("\n ==================================");
  42.     print(" |                                |");
  43.     print(" |          Damage System         |");
  44.     print(" |           By Hreesang          |");
  45.     print(" |                                |");
  46.     print(" ==================================\n");
  47.     return 1;
  48. }
  49.  
  50. public OnFilterScriptExit()
  51. {
  52.     return 1;
  53. }
  54.  
  55. stock ResetPlayerDamages(playerid)
  56. {
  57.     for(new id = 0; id < MAX_DAMAGES; id++)
  58.     {
  59.         if(DamageInfo[playerid][id][dmgDamage] != 0)
  60.         {
  61.             DamageInfo[playerid][id][dmgDamage] = 0;
  62.             DamageInfo[playerid][id][dmgWeapon] = 0;
  63.             DamageInfo[playerid][id][dmgBodypart] = 0;
  64.             DamageInfo[playerid][id][dmgKevlarhit] = 0;
  65.             strcpy(DamageInfo[playerid][id][dmgSeconds], "-", 90);
  66.         }
  67.     }
  68.     return 1;
  69. }
  70.  
  71. public OnPlayerConnect(playerid)
  72. {
  73.     ResetPlayerDamages(playerid);
  74.     return 1;
  75. }
  76.  
  77. public OnPlayerDeath(playerid, killerid, reason)
  78. {
  79.     ResetPlayerDamages(playerid);
  80.     return 1;
  81. }
  82.  
  83. stock ShowPlayerDamages(playerid, toid)
  84. {
  85.     new
  86.     str[1000], str1[500], count = 0, name[MAX_PLAYER_NAME];
  87.     GetPlayerName(playerid, name, sizeof(name));
  88.     for(new id = 0; id < MAX_DAMAGES; id++)
  89.     {
  90.         if(DamageInfo[playerid][id][dmgDamage] != 0) count++;
  91.     }
  92.     if(count == 0) return ShowPlayerDialog(toid, DIALOG_DAMAGE, DIALOG_STYLE_LIST, name, "There is no damage to display...", "Close", "");
  93.     else if(count > 0)
  94.     {
  95.         for(new id = 0; id < MAX_DAMAGES; id++)
  96.         {
  97.             if(DamageInfo[playerid][id][dmgDamage] != 0)
  98.             {
  99.                 FORMAT:str1("%d dmg from %s to %s (Kevlarhit: %d) %s\n", DamageInfo[playerid][id][dmgDamage], GetWeaponNameEx(DamageInfo[playerid][id][dmgWeapon]), GetBodypartName(DamageInfo[playerid][id][dmgBodypart]), DamageInfo[playerid][id][dmgKevlarhit], DamageInfo[playerid][id][dmgSeconds]);
  100.                 strcat(str, str1);
  101.             }
  102.         }
  103.         ShowPlayerDialog(toid, DIALOG_DAMAGE, DIALOG_STYLE_LIST, name, str, "Close", "");
  104.     }
  105.     return 1;
  106. }
  107.  
  108. stock GetName(playerid)
  109. {
  110.     new name;
  111.     GetPlayerName(playerid, name, sizeof(name));
  112.     return name;
  113. }
  114. CMD:damages(playerid, params[])
  115. {
  116.     new
  117.     id, Float: pPos[3];
  118.     if(sscanf(params, "u", id)) return SCM(playerid, 0xFF6347FF, "USAGE: {FFFFFF}/damages [playerid/PartOfName]");
  119.     if(!IsPlayerConnected(id)) return SCM(playerid, 0xFF6347FF, "Playerid is not an active player.");
  120.    
  121.     GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
  122.     if(IsPlayerInRangeOfPoint(playerid, 7.0, pPos[0], pPos[1], pPos[2]))
  123.     {
  124.         ShowPlayerDamages(id, playerid);
  125.     }
  126.     else return SCM(playerid, 0xB8BAC6FF, "You're too far away.");
  127.     return 1;
  128. }
  129.  
  130. stock ReturnDate()
  131. {
  132.     new sendString[90], MonthStr[40];
  133.  
  134.     gettime(hour, minute, second);
  135.     getdate(year, month, day);
  136.  
  137.     switch(month)
  138.     {
  139.         case 1:  MonthStr = "January";
  140.         case 2:  MonthStr = "February";
  141.         case 3:  MonthStr = "March";
  142.         case 4:  MonthStr = "April";
  143.         case 5:  MonthStr = "May";
  144.         case 6:  MonthStr = "June";
  145.         case 7:  MonthStr = "July";
  146.         case 8:  MonthStr = "August";
  147.         case 9:  MonthStr = "September";
  148.         case 10: MonthStr = "October";
  149.         case 11: MonthStr = "November";
  150.         case 12: MonthStr = "December";
  151.     }
  152.  
  153.     format(sendString, sizeof(sendString), "%s %d %d - %02d:%02d:%02d", MonthStr, day, year, hour, minute, second);
  154.     return sendString;
  155. }
  156.  
  157. public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
  158. {
  159.     if(IsPlayerConnected(playerid))
  160.     {
  161.         new
  162.         id, Float: pHP, Float: pArm;
  163.         GetPlayerHealth(playerid, pHP);
  164.         GetPlayerArmour(playerid, pArm);
  165.         for(new i = 0; i < MAX_DAMAGES; i++)
  166.         {
  167.             if(!DamageInfo[playerid][i][dmgDamage])
  168.             {
  169.                 id = i;
  170.                 break;
  171.             }
  172.         }
  173.        
  174.         DamageInfo[playerid][id][dmgDamage] = floatround(amount, floatround_round);
  175.         DamageInfo[playerid][id][dmgWeapon] = weaponid;
  176.         DamageInfo[playerid][id][dmgBodypart] = bodypart;
  177.         if(pArm > 0) DamageInfo[playerid][id][dmgKevlarhit] = 1;
  178.         else if(pArm < 1) DamageInfo[playerid][id][dmgKevlarhit] = 0;
  179.         strcpy(DamageInfo[playerid][id][dmgSeconds], ReturnDate(), 90);
  180.     }
  181.     return 1;
  182. }
  183.  
  184. stock GetWeaponNameEx(weaponid)
  185. {
  186.     new weaponname[60];
  187.     GetWeaponName(weaponid, weaponname, sizeof(weaponname));
  188.     return weaponname;
  189. }
  190.  
  191. stock GetBodypartName(bodypart)
  192. {
  193.     new bodyname[60];
  194.     switch(bodypart)
  195.     {
  196.         case BODY_PART_TORSO: FORMAT:bodyname("TORSO");
  197.         case BODY_PART_GROIN: FORMAT:bodyname("GROIN");
  198.         case BODY_PART_RIGHT_ARM: FORMAT:bodyname("RIGHT ARM");
  199.         case BODY_PART_LEFT_ARM: FORMAT:bodyname("LEFT ARM");
  200.         case BODY_PART_RIGHT_LEG: FORMAT:bodyname("RIGHT ARM");
  201.         case BODY_PART_LEFT_LEG: FORMAT:bodyname("LEFT LEG");
  202.         case BODY_PART_HEAD: FORMAT:bodyname("HEAD");
  203.     }
  204.     return bodyname;
  205. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top