Raised This Month: $ Target: $400
 0% 

Chat argv's look inside.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Lure.d
BANNED
Join Date: Dec 2009
Location: Lithuania->USA
Old 03-05-2010 , 06:51   Chat argv's look inside.
Reply With Quote #1

Ello there, i've got this problem:
When i try to get TWO arguments for ex:

PHP Code:
public plugin_init() {
...
     
register_clcmd("say""c_say");
     
register_clcmd("say_team""c_say");
}

public 
c_say(id) {
     new 
arg1[100];
     
readv_args(1arg1sizeof(arg1) - 1);

     
client_print(0print_chat"[TAG] %s"arg1);

     if(
contain(arg1"/settopic") != -1) {
          new 
arg2[50];
          
readv_args(2arg2sizeof(arg2) - 1);

          
client_print(0print_chat"[TAG] Topic set to: %s"arg2);
     }

It successfully gets what i type and outputs to [TAG] Text...
But if i say /settopic and it just dont get the second arg, so how to do it?
Do i have to get the second argument at very start?

EDIT: Tried putting reading arg2 on top - doesn't work.

Last edited by Lure.d; 03-05-2010 at 07:00.
Lure.d is offline
Send a message via Skype™ to Lure.d
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-05-2010 , 07:04   Re: Chat argv's look inside.
Reply With Quote #2

You don't need to register only say/say_team, register directly "say /settopic".
__________________
Arkshine is offline
Old 03-05-2010, 09:05
hleV
This message has been deleted by hleV.
Lure.d
BANNED
Join Date: Dec 2009
Location: Lithuania->USA
Old 03-05-2010 , 11:22   Re: Chat argv's look inside.
Reply With Quote #3

You MUST understand that im making plugin that:
1. Converts original chat(%name%: %message%) -> ([TAG] %name%: %message%
2. I want it to also correspond to commands(and it does)
3. I also want it to change for ex topic...
Lure.d is offline
Send a message via Skype™ to Lure.d
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 03-05-2010 , 15:06   Re: Chat argv's look inside.
Reply With Quote #4

PHP Code:
#include <amxmodx>
 
public plugin_init()
{
        new const Function[] = 
"cmdSay";
 
        
register_clcmd("say", Function);
        
register_clcmd("say_team", Function);
}
 
public 
cmdSay()
{
        new 
szText[256];
        
read_args(szText255);
        
remove_quotes(szText);
 
        if (!
equali(szText"/settopic "10))
                return 
PLUGIN_CONTINUE;
 
        
client_print(0print_chat"[TAG] Topic set to: %s"szText[10]);
 
        return 
PLUGIN_HANDLED;

__________________
hleV is offline
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:42.


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