Raised This Month: $51 Target: $400
 12% 

[Help] Run a cmd on name


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mikaeel123
Senior Member
Join Date: Oct 2018
Old 04-20-2020 , 14:53   [Help] Run a cmd on name
Reply With Quote #1

Hello . How do i can run a cmd on name like this ??
/q "name" On chat . /q = amx_quit "name"
For the example i make this slash command
i can add it to this ? or its a different type ?
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>
#include <colorchat>


#define ACCESS ADMIN_CVAR

new g_pCvarchname
new g_pCvarNoSay
new block

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
g_pCvarchname register_cvar("sv_noname""0")
    
register_forward(FM_ClientUserInfoChanged"ClientUserInfoChanged")
    

    
    
register_clcmd("say /q","quit",ACCESS)
    

public 
quit(idlevelcid

    if(
cmd_access(id,levelcid1)) 
    { 
        new 
name[32
        
get_user_info(id"name"name31
        
client_cmd(id,"amx_quit"); 
        
ColorChat(0GREEN,"%s: /q",name)
    
ColorChat(0BLUE,"*** Admin ...... Quit ...... ***");
    } 
    return 
PLUGIN_HANDLED 

Mikaeel123 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-20-2020 , 15:41   Re: [Help] Run a cmd on name
Reply With Quote #2

You need to hook the "say" command.
Use "read_args" to read the entire line.
Then use "parse" to get the separate arguments ("/q" is the first one, "name" is the second).
__________________

Last edited by OciXCrom; 04-20-2020 at 15:41.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Mikaeel123
Senior Member
Join Date: Oct 2018
Old 04-21-2020 , 06:14   Re: [Help] Run a cmd on name
Reply With Quote #3

Can you give an example ?? in php format
Mikaeel123 is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 04-21-2020 , 08:15   Re: [Help] Run a cmd on name
Reply With Quote #4

Quote:
Originally Posted by OciXCrom View Post
You need to hook the "say" command.
Use "read_args" to read the entire line.
Then use "parse" to get the separate arguments ("/q" is the first one, "name" is the second).
isn't read_argv easier to use here?
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-21-2020 , 09:19   Re: [Help] Run a cmd on name
Reply With Quote #5

Quote:
Originally Posted by Napoleon_be View Post
isn't read_argv easier to use here?
Won't work when hooking "say". The entire line will be detected as arg1.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 04-21-2020 , 09:20   Re: [Help] Run a cmd on name
Reply With Quote #6

Quote:
Originally Posted by OciXCrom View Post
Won't work when hooking "say". The entire line will be detected as arg1.
Ooh lol, didn't know.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
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 11:31.


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