Raised This Month: $ Target: $400
 0% 

[SOLVED] Chat command with arguments


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 09-14-2015 , 08:19   [SOLVED] Chat command with arguments
Reply With Quote #1

I'm trying to make the following command: /tp <player> <player2>, but I wan't to know if it's possible to do it without hooking "say".

PHP Code:
register_clcmd("say /tp""cmd_tp"ADMIN_BAN"<player> <player2>")

public 
cmd_tp(idlevelcid)
{
    if(!
cmd_access(idlevelcid3))
        return 
PLUGIN_HANDLED

    
new message[192], argument[32], argument2[32]

    
read_args(messagecharsmax(message))
    
remove_quotes(message)
    
parse(messageargumentcharsmax(argument), argument2charsmax(argument2))
    
    new 
player cmd_target(idargument4)
    
    if(!
player)
    {
        
ColorChat(idRED"Error: ^1Player not found.")
        return 
PLUGIN_HANDLED
    
}
    
    new 
player2 cmd_target(idargument24)
    
    if(!
player2)
    {
        
ColorChat(idRED"Error: ^1Player not found.")
        return 
PLUGIN_HANDLED
    
}
    
    new 
name[32], name2[32]
    
get_user_name(idnamecharsmax(name))
    
get_user_name(playername2charsmax(name2))
    
    
ColorChat(idTEAM_COLOR"^1Teleporting to ^3%s"name2)
    
log_amx("%s teleported to %s"namename2)
    return 
PLUGIN_HANDLED

This code doesn't seem to work. PS: it's only a test code, I know that it won't actually do anything. I just want someone to give me an example of how to do it, if possible.

Last edited by OciXCrom; 06-27-2016 at 17:59.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-14-2015 , 18:35   Re: Chat command with arguments
Reply With Quote #2

Quote:
Originally Posted by OciXCrom View Post
I'm trying to make the following command: /tp <player> <player2>, but I wan't to know if it's possible to do it without hooking "say".
Hooking "say" is the only way to do this in chat. IMO, people just need to learn how to use the console. It's just as easy, no extra keystrokes are necessary.
__________________

Last edited by fysiks; 09-14-2015 at 18:35.
fysiks is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 09-15-2015 , 08:50   Re: Chat command with arguments
Reply With Quote #3

I have an idea that requires the commands to be used through the chat. Someone may already figured out what I'm trying to do.

//Edit: I think that I figured out an easier way to do this, however it involves using the hook.

Last edited by OciXCrom; 09-15-2015 at 09:40.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
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 05:11.


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