Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Can a client shoot now
- bool Util_CanClientShoot(int client)
- {
- // Get active weapon
- int weapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
- if (weapon == INVALID_ENT_REFERENCE)
- {
- return false;
- }
- float nextAttack = GetEntPropFloat(weapon, Prop_Send, "m_flNextPrimaryAttack");
- return GetGameTime() >= nextAttack;
- }
- 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])
- {
- // ...
- if (buttons & IN_ATTACK && Util_CanClientShoot(client))
- {
- angles[0] = -89.0;
- PrintToChat(client, "You just shot your gun");
- }
- return Plugin_Continue;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement