Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. #include sdktools
  2.  
  3. float fNextAttack[MAXPLAYERS + 1], flGameTime[MAXPLAYERS + 1], flLastTime[MAXPLAYERS + 1];
  4.  
  5. static const char gMelee[][] =
  6. {
  7. "baseball_bat",
  8. "cricket_bat",
  9. "crowbar",
  10. "electric_guitar",
  11. "fireaxe",
  12. "frying_pan",
  13. "golfclub",
  14. "katana",
  15. "machete",
  16. "tonfa",
  17. "knife"
  18. };
  19.  
  20. static const float gSpeed[] =
  21. {
  22. 0.04,
  23. 0.04,
  24. 0.04,
  25. 0.04,
  26. 0.00,
  27. 0.04,
  28. 0.04,
  29. 0.04,
  30. 0.04,
  31. 0.15,
  32. 0.04
  33. };
  34.  
  35. int g_iNextPAttO;
  36.  
  37. public void OnPluginStart()
  38. {
  39. g_iNextPAttO = FindSendPropInfo("CBaseCombatWeapon","m_flNextPrimaryAttack");
  40. }
  41.  
  42. public void OnGameFrame()
  43. {
  44. for(int i = 1;i < MaxClients; i++)
  45. {
  46. if(IsClientInGame(i))
  47. {
  48. int iCurrentWeapon = GetEntPropEnt(i, Prop_Send, "m_hActiveWeapon");
  49. if(IsValidEntity(iCurrentWeapon))
  50. {
  51. char sWeaponEx[56];
  52. GetEntityClassname(iCurrentWeapon, sWeaponEx, sizeof sWeaponEx);
  53. if(strcmp(sWeaponEx, "weapon_melee") == 0)
  54. {
  55. GetEntPropString(iCurrentWeapon, Prop_Data, "m_strMapSetScriptName", sWeaponEx, sizeof sWeaponEx);
  56. for(int v; v < 11; v++)
  57. {
  58. if(strcmp(sWeaponEx, gMelee[v]) == 0)
  59. {
  60. fNextAttack[i] = GetEntDataFloat(iCurrentWeapon, g_iNextPAttO);
  61. flGameTime[i] = GetGameTime();
  62. if ((flGameTime[i] - flLastTime[i]) > 0.5)
  63. {
  64. SetEntDataFloat(iCurrentWeapon, g_iNextPAttO, fNextAttack[i] - gSpeed[v], true);
  65. flLastTime[i] = GetGameTime();
  66. }
  67. }
  68. }
  69. }
  70. }
  71. }
  72. }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement