Raised This Month: $ Target: $400
 0% 

Check client command


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
biscuit628
Senior Member
Join Date: Jun 2007
Location: 香港HongKong
Old 03-14-2009 , 02:02   Check client command
Reply With Quote #1

how to check a client command?
example..
i want to know player have or haven't a command call "Apple"
now..i put this in my code..
PHP Code:
client_cmd(id,Apple
then
Check PlayerA , PlayerA doesn't have the command, so he get "Unknow Command" in the console //true
Check PlayerB , PlayerB has the command,but it is nothing in the value <Apple ""> //false
Check PlayerC , PlayerC has the command, and the value is<Apple "Orange">//false
how can i get true or false?

sorry for my very very poor english..
biscuit628 is offline
TheRadiance
Senior Member
Join Date: Nov 2007
Location: Kazakhstan
Old 03-14-2009 , 02:14   Re: Check client command
Reply With Quote #2

PHP Code:
register_clcmd"Apple""CommandApple" )

public 
CommandAppleid )
    return 
PLUGIN_HANDLED 
Also this should help you:
PHP Code:
query_client_cvar(id, const cvar[], const resultFunc[], paramlen=0, const params[] = ""
TheRadiance is offline
Send a message via ICQ to TheRadiance
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 03-14-2009 , 03:01   Re: Check client command
Reply With Quote #3

If you mean checking client's aliases, you can't, otherwise, client commands are handled server-side, with a few exceptions (connect, disconnect, etc)
__________________

Community / No support through PM
danielkza is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 03-14-2009 , 18:02   Re: Check client command
Reply With Quote #4

It actually is possible... I made this check with statsme a long time ago... you CAN check whenever a player uses an unknown command but CANNOT check if a player has a command that is aliased... or... you could... by sending it and expect unknown command, if you receive it, it's not set, if not, it's aliased

don't really remember how I did it tough, I'll search through my old scripts and see what I can find

EDIT:
yeah, was something like hooking TextMsg and checking argument 2 with "#Game_unknown_command"... or something

EDIT #2: tested a code and works, gets user ID and the unknown command sent:
PHP Code:
#include <amxmodx>
 
public plugin_init()
{
    
register_event("TextMsg""hook_textMsg""b""2=#Game_unknown_command")
}
 
public 
hook_textMsg(idmsg[], cmd[])
{
    
client_print(0print_chat"%d - unknown command: %s"idcmd)
 
    return 
PLUGIN_CONTINUE

__________________

Last edited by Hunter-Digital; 03-15-2009 at 13:47. Reason: added working code
Hunter-Digital is offline
biscuit628
Senior Member
Join Date: Jun 2007
Location: 香港HongKong
Old 03-16-2009 , 09:29   Re: Check client command
Reply With Quote #5

Quote:
Originally Posted by Hunter-Digital View Post
It actually is possible... I made this check with statsme a long time ago... you CAN check whenever a player uses an unknown command but CANNOT check if a player has a command that is aliased... or... you could... by sending it and expect unknown command, if you receive it, it's not set, if not, it's aliased
...
Thank!,but i got some problem
i compile the code
PHP Code:
#include <amxmodx>
#include <amxmisc>


public plugin_init() {
    
register_plugin("New Plug-In""1.0""Administrator")
    
register_event("TextMsg""hook_textMsg""b""2=#Game_unknown_command")
}

public 
client_putinserver(id)
{
    
client_cmd(id,"Apple")
}
public 
hook_textMsg(idmsg[], cmd[])
{
    new 
name[30]
    
get_user_name(id,name,29)
    
server_print("%s - unknown command: %s"namecmd)
    return 
PLUGIN_CONTINUE

when PlayerA use the unknowcommand,it's print the msg "PlayerA - unknow command: New Plug-In"
biscuit628 is offline
Owyn
Veteran Member
Join Date: Nov 2007
Old 03-16-2009 , 12:53   Re: Check client command
Reply With Quote #6

and to me it says ""PlayerA - unknow command: textMsg"

ps - so with hlguard on this thing gonna spam like hell? =\

but it works, lol at people who said it is impossible to see what is going on in player's console +_+

Last edited by Owyn; 03-16-2009 at 13:25.
Owyn is offline
Send a message via ICQ to Owyn
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 03-16-2009 , 13:17   Re: Check client command
Reply With Quote #7

Quote:
Originally Posted by .Owyn. View Post
but it works, lol at people who said it is impossible to see what is going on in player's console +_+
Can't see any, at least not in this thread.
SnoW is offline
Send a message via MSN to SnoW
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 03-16-2009 , 17:23   Re: Check client command
Reply With Quote #8

Why not just register_clcmd() the command, and run it using client_cmd? If the callback is executed the command is not aliased, if it's not, it is.
__________________

Community / No support through PM
danielkza is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 03-17-2009 , 05:53   Re: Check client command
Reply With Quote #9

that's odd... when I tested that code it worked showed my player ID and the command sent... now it doesn't... zomfg
__________________
Hunter-Digital is offline
Owyn
Veteran Member
Join Date: Nov 2007
Old 03-20-2009 , 10:06   Re: Check client command
Reply With Quote #10

i think it needs a read_data() func to show unknown command
__________________
☜ Free Mozy ☂backup\҉sync user
Quote:
Американский форум - Задаёшь вопрос, потом тебе отвечают.
Израильский форум - Задаёшь вопрос, потом тебе задают вопрос.
Русский форум - Задаёшь вопрос, потом тебе долго рассказывают, какой ты мудак.
Owyn is offline
Send a message via ICQ to Owyn
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 08:55.


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