AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Am I Crazy? Momma says yes. (https://forums.alliedmods.net/showthread.php?t=64672)

Wilson [29th ID] 12-21-2007 00:15

Am I Crazy? Momma says yes.
 
I feel like I must be.

But I have looked at this code very hard. And it's not even that late at night...it's just odd.

I'm blocking weapon fire server sided, both attack and attack2. Just like I normally do. But for some reason, if you fire or attack2 while you are not on the ground (ie. falling or walking off a step) it does not get blocked.

Code:
public fwd_CmdStart( id, uc_handle, seed ) {     if( plugin_enabled() && is_user_alive(id) && has_flamethrower(id, get_user_weapon(id)) )     {         static buttons;         buttons = get_uc( uc_handle, UC_Buttons );                 if( buttons & IN_ATTACK )         {             buttons &= ~IN_ATTACK;                         set_animation( id, sequences:altfirecycle );             client_print( id, print_center, "Firing" );         }         if( buttons & IN_ATTACK2 )         {             buttons &= ~IN_ATTACK2;             client_print( id, print_center, "Attack2 Blocked" );         }         set_uc( uc_handle, UC_Buttons, buttons );         return FMRES_SUPERCEDE;     }     return FMRES_IGNORED; }

The Client_Print always gets sent - even when you are falling (and the block doesn't work).

The block always works when you are on the ground.

I have tried the equivelant of this with FM_PlayerPreThink and the same thing happens.

I can't imagine why it hasn't been noticed before...am I doing something wrong here?

Code:
register_forward( FM_CmdStart, "fwd_CmdStart" ); // Tried post too - same thing

Wilson [29th ID] 12-21-2007 10:29

Re: Am I Crazy? Momma says yes.
 
Someone edited my post and added "Momma says yes." to the end of the subject.

That is a violation of my first amendment coding rights of the AMXX Constitution.

Magistrate Bailopan, please incarcerate him.

purple_pixie 12-21-2007 11:16

Re: Am I Crazy? Momma says yes.
 
It's not a violation ... it's just an amendment ;-)

puns rock my world.

hlstriker 12-21-2007 13:48

Re: Am I Crazy? Momma says yes.
 
I'm thinking some reason the first if statement is returning false so it won't ever get to supercede the buttons. I tried the same thing without that first statement and it worked fine.

Note: I also found that when blocking attack and attack2, if you click them both at once it will still fire (at least in CS). Not sure if you knew that or not but it was about 2 weeks into my plugin I found that out :P

Wilson [29th ID] 12-21-2007 23:29

Re: Am I Crazy? Momma says yes.
 
If the first statement was blocking it, the text notification wouldn't show up though; it does


All times are GMT -4. The time now is 11:05.

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