AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   blocking fire in client side (https://forums.alliedmods.net/showthread.php?t=10247)

larnk 02-13-2005 01:14

blocking fire in client side
 
I have searched the forums, in general, using
entity_set_int(id,entity_get_init(id,EV_INT_b utton)& ~IN_ATTACK))
to block fire, but in the client, we still see rapid fire and hear fire sound.
If we can real block firing in the client side ?

for example, when we are reloading ammos, press fire is no use, without fire, but I do not the how to make a fake reloading event....

XxAvalanchexX 02-13-2005 02:07

You can try this, but I haven't tested.

Code:
public client_PreThink(id) {   if(!is_user_alive(id)) {     return PLUGIN_CONTINUE;   }   new button = entity_get_int(id,EV_INT_button);   if(button & IN_ATTACK) {     entity_set_int(id,EV_INT_button,button & ~IN_ATTACK);     entity_set_int(id,EV_INT_weaponanim,0);   }   return PLUGIN_CONTINUE; }

It's your basic stop firing code with the added reset of weaponanim, but you would still hear the sound and muzzle flash. I suppose you could catch the emitting of the sound with FakeMeta and stop it, but it would be hard (with so many different firing sounds).

larnk 02-13-2005 03:57

well, thank you for your kind...

I have tried useing client_PreThink... but still hear sound..

I mean If we can set the weapon is busy or is reloading ammos...just like when Reload is pressed in client side....

knekter 02-13-2005 11:15

hmmm
 
Instead of:

Code:
entity_get_int(id,EV_INT_button)

Use:

Code:
if(get_user_button(id) & IN_ATTACK) {

Less lines and is easier to use.


All times are GMT -4. The time now is 19:20.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.