Advertisement
FlacoBey

Untitled

Jan 16th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.02 KB | None | 0 0
  1. #include <sourcemod>
  2.  
  3. public OnPluginStart()
  4. {
  5.     HookEvent("weapon_reload", WeaponReload);
  6. }
  7.  
  8. public Action:WeaponReload(Handle:event, const String:name[], bool:dontBroadcast)
  9. {
  10.     new client = GetEventInt(event, "userid");
  11.     if(bIsSurvivor(client))
  12.     {
  13.         new iCurrentWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
  14.         float nextattack = GetEntPropFloat(client, Prop_Send, "m_flNextAttack");
  15.        
  16.         decl String:weapon[32];
  17.         GetEntityClassname(iCurrentWeapon, weapon, sizeof(weapon));
  18.        
  19.         if(StrEqual(weapon, "weapon_hunting_rifle"))
  20.         {
  21.             nextattack -= 0.2;
  22.             SetEntPropFloat(client, Prop_Send, "m_flNextAttack", nextattack);
  23.             SetEntPropFloat(iCurrentWeapon, Prop_Send, "m_flNextPrimaryAttack", nextattack);
  24.             SetEntPropFloat(client, Prop_Send, "m_flPlaybackRate", 1.2);
  25.         }
  26.     }
  27.     return Plugin_Continue;
  28. }
  29.  
  30. stock bool bIsSurvivor(int client)
  31. {
  32.     return client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2 && !IsClientInKickQueue(client) && IsPlayerAlive(client);
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement