Raised This Month: $ Target: $400
 0% 

+command wont work


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
urban_ninja
Senior Member
Join Date: Feb 2009
Old 03-19-2011 , 13:26   +command wont work
Reply With Quote #1

Im trying to get a feature in my plugin to be triggered when the user is firing his weapon but +attack don't work. In fact nothing with "+" in front of a command works. What causes +commands to fail?

Here's what I have.
PHP Code:
public plugin_init()
{
    
register_clcmd("+attack""fire_restrict")
    
register_clcmd("-attack""restore")

I even added a hud message to see if what I added in the code block was at fault but no hud message appeared so the code block isn't being triggered at all.
__________________
urban_ninja is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 03-19-2011 , 13:44   Re: +command wont work
Reply With Quote #2

You cannot hook all commands that way. You have to either hook command start or prethink and check if a user's button field contains IN_ATTACK.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
urban_ninja
Senior Member
Join Date: Feb 2009
Old 03-19-2011 , 14:42   Re: +command wont work
Reply With Quote #3

Im not sure how to do that. Would get_clcmd make it work? client_PreThink, get_user_button, get_usercmd only has one parameter. Idk where to start.
__________________
urban_ninja is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 03-19-2011 , 16:10   Re: +command wont work
Reply With Quote #4

Code:
register_forward( FM_CmdStart, "MetaCmdStart" ) public MetaCmdStart( id, handle, seed ) {     if( get_uc( handle, UC_Buttons ) & IN_ATTACK ) // holding IN_ATTACK     {         if( !( pev( id, pev_oldbuttons ) & IN_ATTACK ) ) // just pushed it, as it was not being held before this function call but it is now         {             // ...         }     } }
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
urban_ninja
Senior Member
Join Date: Feb 2009
Old 03-19-2011 , 19:25   Re: +command wont work
Reply With Quote #5

Ok, I tried that but wont up causing the feature no to work at all.

I have
register_forward( FM_CmdStart, "speed_task");
register_event("Spectator", "speed", "abcde");

The way I have it is when the HW looses health below 40 he gets a speed rush untill his heath is back above 40. But set_user_maxspeed over rides the slow down speed when firing his minigun so the speed never differs. So this needs to be fixed so when minigun is firing the HWguy slows down like he should. I also have set_task to keep the code responding down to the milliseconds in a way where caping the flag dont glitch amxx and forget the players index. Register_event is to start running the tasks because it only seems to index players (individually to be specific) by the player him self triggers the code block.

Im having a heck of a time applying a fix for this minor game play issue along with the pre existing code.
__________________
urban_ninja is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:33.


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