Advertisement
FlacoBey

Untitled

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