Advertisement
Guest User

Untitled

a guest
Apr 29th, 2017
577
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <cstrike>
  3. #include <sdktools>
  4. #include <sdkhooks>
  5. #include <gum>
  6.  
  7. public Plugin myinfo =
  8. {
  9. name = "Glock damage booster",
  10. author = "Prefix",
  11. description = "none",
  12. version = "1.0",
  13. url = "www.otaku.lt"
  14. };
  15.  
  16. #define DamageBoost 2.0
  17.  
  18. #define ITEM_COST 20
  19.  
  20. #define GUN_UNLOCK "glock"
  21.  
  22. bool itemEnabled[MAXPLAYERS + 1];
  23.  
  24. public void OnPluginStart()
  25. {
  26. // We are registering item here with parameters
  27. // itemRebuy - 0 = Item can be bought one time per connect, 1 = Buy item many times, 2 = Item can be bought one time per round
  28. // itemRebuyTimes - 0 = Infinite buy, >0 = Item rebuy times
  29. registerGumItem("Glock 2x damage", "Glock does 2x damage", ITEM_COST, 0, 0);
  30. }
  31.  
  32. // Called when item/unlock was selected by menu
  33. public void gumItemSetCallback(client)
  34. {
  35. itemEnabled[client] = true;
  36. }
  37.  
  38. // Called when item/unlock was selected by menu
  39. public void gumItemUnSetCallback(client)
  40. {
  41. itemEnabled[client] = false;
  42. }
  43.  
  44. // Take the item/unlock from the player
  45. public void OnClientDisconnect(client)
  46. {
  47. if ( IsValidClient(client) )
  48. itemEnabled[client] = false;
  49. }
  50.  
  51. public OnClientPutInServer(client)
  52. {
  53. if ( IsValidClient(client) && !IsFakeClient(client) )
  54. SDKHook(client, SDKHook_TraceAttack, OnTraceAttack);
  55. }
  56.  
  57. public Action OnTraceAttack(int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &ammotype, int hitbox, int hitgroup)
  58. {
  59. if (victim == attacker)
  60. return Plugin_Continue;
  61.  
  62. if (!IsValidAlive(attacker))
  63. return Plugin_Continue;
  64.  
  65. if (!IsValidClient(victim))
  66. return Plugin_Continue;
  67.  
  68. if (GetClientTeam(victim) == GetClientTeam(attacker))
  69. return Plugin_Continue;
  70.  
  71. if (!itemEnabled[attacker])
  72. return Plugin_Continue;
  73.  
  74. char weaponName[16];
  75.  
  76. int iWeapon = GetEntPropEnt(attacker, Prop_Send, "m_hActiveWeapon");
  77. if(!(iWeapon > 0 && IsValidEdict(iWeapon))) return Plugin_Continue;
  78. GetEdictClassname(iWeapon, weaponName, sizeof(weaponName));
  79.  
  80. if (StrContains(weaponName, GUN_UNLOCK) == -1)
  81. return Plugin_Continue;
  82.  
  83. damage = damage*DamageBoost;
  84. return Plugin_Changed;
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement