Raised This Month: $ Target: $400
 0% 

get use command.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 03-23-2009 , 16:39   get use command.
Reply With Quote #1

how to get a user command? for exam :

if user use the command "+left" show a hud.
i just need the code 4 get cmd.
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 03-23-2009 , 17:50   Re: get use command.
Reply With Quote #2

To catch buttons(+attack, -jump, etc.), you can use the FM_CmdStart forward or check the player's pev_buttons/pev_oldbutton at PreThink.

If something else then just get the first argument of the command at the client_command(id) forward. Just notice that a lot of client-sided commands cannot be hooked.
__________________
O o
/¯________________________
| IMMA FIRIN' MAH LAZOR!!!
\_¯¯¯
Dores is offline
Dr.G
Senior Member
Join Date: Nov 2008
Old 03-23-2009 , 17:52   Re: get use command.
Reply With Quote #3

something like this:

PHP Code:
#include <amxmodx>
#include <fakemeta>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

public plugin_init() 
{
 
register_plugin(PLUGINVERSIONAUTHOR)
 
 
/* prethink */
 
register_forwardFM_PlayerPreThink"client_prethink" )
}
public 
client_prethink(id)
{
 new 
button pev(id,pev_button)
 
 if(
button IN_MOVERIGHT)
 {
  
//do something
 
}
 
 if(
button IN_MOVELEFT)
 {
  
//do something else
 
}

the buttons you can catch, you can find in hlsdk_const.inc
__________________
Dr.G is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-23-2009 , 17:54   Re: get use command.
Reply With Quote #4

Better to use FM_CmdStart.
Arkshine is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 03-23-2009 , 18:02   Re: get use command.
Reply With Quote #5

ok... my PC is down.( virus )ill try later to catch +reload. & ty.
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 03-24-2009 , 12:30   Re: get use command.
Reply With Quote #6

Code:
#include <amxmodx> #include <fakemeta>   public plugin_init()         register_forward(FM_CmdStart, "HookReload");   public HookReload(ClientID, UC_Handle) {         if (!is_user_alive(ClientID))                 return;           static Button;         Button = get_uc(UC_Handle, Buttons);           if (Button & IN_RELOAD)         {                 // Client used +reload command                   // If you want to block it, use this                 Button &= ~IN_RELOAD;         }           // This will block it         set_uc(UC_Handle, UC_Buttons, Button);           return FMRES_SUPERCEDE; }
__________________
hleV is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 03-24-2009 , 12:40   Re: get use command.
Reply With Quote #7

Quote:
Originally Posted by hleV View Post
Code:
#include <amxmodx> #include <fakemeta> public plugin_init() register_forward(FM_CmdStart, "HookReload");

public HookReload(ClientID, UC_Handle) { if (!is_user_alive(ClientID)) return;

static Button;
Button = get_uc(UC_Handle, Buttons);

if (Button & IN_RELOAD) { // Client used +reload command // If you want to block it, use this Button &= ~IN_RELOAD; } // This will block it set_uc(UC_Handle, UC_Buttons, Button);

return FMRES_SUPERCEDE;
}

YEa. ty . i have it. but a new problem.ill better ask u in PM. this willbe the last question & i can release ma new plug.
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
TheRadiance
Senior Member
Join Date: Nov 2007
Location: Kazakhstan
Old 03-24-2009 , 12:46   Re: get use command.
Reply With Quote #8

Quote:
Originally Posted by hleV View Post
Code:
#include <amxmodx> #include <fakemeta>   public plugin_init()         register_forward(FM_CmdStart, "HookReload");   public HookReload(ClientID, UC_Handle) {         if (!is_user_alive(ClientID))                 return;           static Button;         Button = get_uc(UC_Handle, Buttons);           if (Button & IN_RELOAD)         {                 // Client used +reload command                   // If you want to block it, use this                 Button &= ~IN_RELOAD;         }           // This will block it         set_uc(UC_Handle, UC_Buttons, Button);           return FMRES_SUPERCEDE; }
Sorry for offtop:

What means / does ~ ( tilda )?
TheRadiance is offline
Send a message via ICQ to TheRadiance
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-24-2009 , 16:19   Re: get use command.
Reply With Quote #9

Quote:
Originally Posted by Pawn Language Reference
~e : results in the one’s complement of e.
Arkshine is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 03-24-2009 , 16:42   Re: get use command.
Reply With Quote #10

Quote:
Originally Posted by Pawn Language Reference
~e : results in the one’s complement of e.
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Reply


Thread Tools
Display Modes

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 09:04.


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