Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. // Can a client shoot now
  2. bool Util_CanClientShoot(int client)
  3. {
  4. // Get active weapon
  5. int weapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
  6. if (weapon == INVALID_ENT_REFERENCE)
  7. {
  8. return false;
  9. }
  10.  
  11. float nextAttack = GetEntPropFloat(weapon, Prop_Send, "m_flNextPrimaryAttack");
  12.  
  13. return GetGameTime() >= nextAttack;
  14. }
  15.  
  16. public Action OnPlayerRunCmd(int client, int& buttons, int& impulse, float vel[3], float angles[3], int& weapon, int& subtype, int& cmdnum, int& tickcount, int& seed, int mouse[2])
  17. {
  18. // ...
  19. if (buttons & IN_ATTACK && Util_CanClientShoot(client))
  20. {
  21. angles[0] = -89.0;
  22. PrintToChat(client, "You just shot your gun");
  23. }
  24. return Plugin_Continue;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement