Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- #include <sdkhooks>
- bool iAlready[MAXPLAYERS+1] = false;
- public Action OnReload(int weapon)
- {
- return Plugin_Handled;
- }
- public Action OnPlayerRunCmd(int client, int& buttons, int& impulse, float vel[3], float angles[3], int& weapon)
- {
- if(bIsSurvivor(client))
- {
- int iCurrentWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
- new iClip = GetEntProp(iCurrentWeapon, Prop_Send, "m_iClip1");
- if(GetEntProp(iCurrentWeapon, Prop_Send, "m_bInReload") > 0) return;
- if(!(buttons & IN_RELOAD))
- {
- if(iClip == 0)
- {
- if(!iAlready[client])
- {
- iAlready[client] = true;
- SetEntPropFloat(client, Prop_Send, "m_flNextAttack", 99999.0);
- SetEntPropFloat(iCurrentWeapon, Prop_Send, "m_flNextPrimaryAttack", 99999.0);
- SetEntProp(iCurrentWeapon, Prop_Send, "m_iClip1", 0);
- SDKHook(iCurrentWeapon, SDKHook_Reload, OnReload);
- }
- }
- }
- if(iClip == 0 && buttons & IN_RELOAD)
- {
- if(iAlready[client])
- {
- iAlready[client] = false;
- SetEntPropFloat(client, Prop_Send, "m_flNextAttack", 0.0);
- SetEntPropFloat(iCurrentWeapon, Prop_Send, "m_flNextPrimaryAttack", 0.0);
- SetEntProp(iCurrentWeapon, Prop_Send, "m_iClip1", 0);
- SDKUnhook(iCurrentWeapon, SDKHook_Reload, OnReload);
- }
- }
- }
- }
- stock bool bIsSurvivor(int client)
- {
- return client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2 && !IsClientInKickQueue(client) && IsPlayerAlive(client);
- }
Advertisement
Add Comment
Please, Sign In to add comment