Advertisement
FlacoBey

Untitled

Jun 13th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.00 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdktools>
  3. #include <sdkhooks>
  4.  
  5. #pragma semicolon 1
  6. #pragma newdecls required
  7.  
  8. public void OnEntityCreated(int entity, const char[] classname)
  9. {
  10.     SDKHook(entity, SDKHook_SpawnPost, ItemSpawnPost);
  11. }
  12.  
  13. public void ItemSpawnPost(int entity)
  14. {
  15.     if (IsValidEntity(entity))
  16.     {
  17.         SDKUnhook(entity, SDKHook_SpawnPost, ItemSpawnPost);
  18.         SDKHook(entity, SDKHook_Use, OnPlayerUse);
  19.     }
  20. }
  21.  
  22. public Action OnPlayerUse(int iEnt, int client, int caller, UseType type, float value)
  23. {
  24.     if(IsValidEdict(iEnt) && IsSurvivor(client))
  25.     {
  26.         int iCurrentWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
  27.         if(!IsValidEntity(iCurrentWeapon)) return Plugin_Continue;
  28.            
  29.         if(GetEntProp(iCurrentWeapon, Prop_Send, "m_bInReload") > 0)
  30.         {
  31.             return Plugin_Handled;
  32.         }
  33.     }
  34.     return Plugin_Continue;
  35. }
  36.  
  37. stock bool IsSurvivor(int client)
  38. {
  39.     if (client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2) return true;
  40.     return false;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement