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

command contain


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
anon12
Member
Join Date: Aug 2013
Old 07-25-2014 , 19:14   command contain
Reply With Quote #1

is it possible to check if the command contains something?

Example:
1. If command contains "amx_" then show all the commands in the amx_help.
2. If command contains "heal" then restore user health back to normal.
anon12 is offline
Eagle07
Veteran Member
Join Date: May 2014
Location: Morocco :D
Old 07-25-2014 , 22:59  
Reply With Quote #2

1. this ?
PHP Code:
public client_command(id

    new 
arg[32]; 
    
read_argv(0arg31); 
    if (
equali(arg"amx_")) 
    { 
        
client_cmd(id"amx_help")
    } 

or
PHP Code:
new const Commands[ ][ ] ={
    
"amx_"
}
public 
client_command(id)
{
    new 
Command[32];
    
read_argv(0Commandcharsmax(Command));
    
    for( new 
0sizeofCommands ); ++)
    {
        if( 
containiCommand Commands] ) != -)
        {
            
client_cmd(id,"amx_help")
        }
    }

and this for health
PHP Code:
new const Commands[ ][ ] ={
    
"heal"
}
public 
client_command(id)
{
    new 
Command[32];
    
read_argv(0Commandcharsmax(Command));
    
    for( new 
0sizeofCommands ); ++)
    {
        if( 
containiCommand Commands] ) != -)
        {
            
set_user_health(id,100)
        }
    }

P.S : cmd amx_ & heal write in consol !!!
(if you want to add this cmd in say ex when client say heal give him health .. just change "heal" =to> "say heal" -- or for amx_ just change "amx_" =to> "say amx_" )
__________________

Last edited by YamiKaitou; 07-26-2014 at 15:42.
Eagle07 is offline
Old 07-26-2014, 00:59
anon12
This message has been deleted by anon12. Reason: nvm
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:51.


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