Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- #include <sdkhooks>
- #pragma semicolon 1
- #pragma newdecls required
- public void OnEntityCreated(int entity, const char[] classname)
- {
- SDKHook(entity, SDKHook_SpawnPost, ItemSpawnPost);
- }
- public void ItemSpawnPost(int entity)
- {
- if (IsValidEntity(entity))
- {
- SDKUnhook(entity, SDKHook_SpawnPost, ItemSpawnPost);
- SDKHook(entity, SDKHook_Use, OnPlayerUse);
- }
- }
- public Action OnPlayerUse(int iEnt, int client, int caller, UseType type, float value)
- {
- if(IsValidEdict(iEnt) && IsSurvivor(client))
- {
- int iCurrentWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
- if(!IsValidEntity(iCurrentWeapon)) return Plugin_Continue;
- if(GetEntProp(iCurrentWeapon, Prop_Send, "m_bInReload") > 0)
- {
- return Plugin_Handled;
- }
- }
- return Plugin_Continue;
- }
- stock bool IsSurvivor(int client)
- {
- if (client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2) return true;
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement