AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Chat Is Blocked (https://forums.alliedmods.net/showthread.php?t=158887)

Dr7sTyLe 06-10-2011 15:00

Chat Is Blocked
 
I have this mod when an admin say in chat "/arishon XXX"
XXX = Something That The Admin Writes
so it show hudmessage and the XXX in there.
there are to problems
1)its shown for 1 sec and disappear very fast
2)no one can write in the chat.
this is the code
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"
new const Cmds[][]={"First"}
new const 
CmdsName[][]={"First One Who Writes"}
new 
iName[32]

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd"say /arishon""cmdHandleSay" );
    
register_clcmd"say_team /arishon""cmdHandleSay" );
}
public 
cmdHandleSay(id)
{
    new 
szMessage[32]
    
read_args(szMessagecharsmax(szMessage));
    
remove_quotes(szMessage);
    new 
message[128];
    
read_argv(1message127);
    for(new 
i=0;i<sizeof(Cmds);i++) 
    {
        
HandleChatCmd(id,i)
        return 
PLUGIN_HANDLED
    
}
}
public 
HandleChatCmd(idtype) {
    new 
message[128], cmd[33], arg[65],name[32];
    
read_argv (1message128);
    
get_user_name(id,name,31);
    
parse(message,cmd,32,arg,64);
    switch(
type)
    {
        case 
0:{
            if(
get_user_flags(id) == ADMIN_KICK)
            {
                
client_cmd(id,"say /arishon %s",arg)
                
set_hudmessage(025500.130.2306.015)
                
show_hudmessage(0"Arishon She Roshem %s Ovet CT",arg)
        
    }
}
}



fysiks 06-10-2011 19:25

Re: Chat Is Blocked
 
To read arguments you need to register only "say" and/or "say_team" then filter for the command. When you encounter the command then you can do what you need to do using read_args() and print your message. There are many topics about this and you can find many plugins that already do this. One example is adminchat.sma (with the @ chat commands).

Dr7sTyLe 06-11-2011 03:05

Re: Chat Is Blocked
 
Quote:

Originally Posted by fysiks (Post 1485366)
To read arguments you need to register only "say" and/or "say_team" then filter for the command. When you encounter the command then you can do what you need to do using read_args() and print your message. There are many topics about this and you can find many plugins that already do this. One example is adminchat.sma (with the @ chat commands).

Ive Tried It Didnt Go well :
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"
#define MAX_CLR 10
new g_msgChannel
new arg[33]
public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /arishon %s",arg,"cmdArishon",ADMIN_KICK)
}
public 
cmdArishon(idlevel)
{    
    new 
arg[33],message[192],userid 0,name[32]
    
    
read_argv(0arg32)
    
read_args(message191)
    
remove_quotes(message)
    
parse(message,32)
    
    new 
found 00
    
new lang[11], langnum get_langsnum()    
    new 
length found
    
    
if (++g_msgChannel || g_msgChannel 3)
    
g_msgChannel 3    
    get_user_name
(idname31)
    
userid get_user_userid(id)
    
set_hudmessage(255000.300.1906.012.0);new rand
    rand 
random_num(0,4)
    switch (
rand)
    {
        case 
34:
        {
            new 
maxpl get_maxplayers();
            for (new 
pl 1pl <= maxplpl++)
            {
                if (
is_user_connected(pl) && !is_user_bot(pl))
                {
                    if (
is_user_admin(pl))
                    {
                        
show_hudmessage(id"Arishon She Kotev %s Over CT",arg)
                    }
                    else
                    {
                        
show_hudmessage(id"Arishon She Kotev %s Over CT",arg)
                    }
                }
            }
        }
        case 
2:
        {
            
show_hudmessage(id"Arishon She Kotev %s Over CT",arg)
        }
        default:
        {
            
show_hudmessage(id"Arishon She Kotev %s Over CT",arg)
        }
    }

    
show_hudmessage(id"Arishon She Kotev %s Over CT",arg)

    return 
PLUGIN_HANDLED


its show the message but the arg is always defined in the server as the word "say" i cant write "/arishon 123"

Dr7sTyLe 06-11-2011 03:12

Re: Chat Is Blocked
 
Quote:

Originally Posted by fysiks (Post 1485366)
To read arguments you need to register only "say" and/or "say_team" then filter for the command. When you encounter the command then you can do what you need to do using read_args() and print your message. There are many topics about this and you can find many plugins that already do this. One example is adminchat.sma (with the @ chat commands).

Ive Tried It Didnt Go well :
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"
#define MAX_CLR 10
new g_msgChannel
new arg[33]
public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /arishon" "cmdArishon",ADMIN_KICK)
}
public 
cmdArishon(idlevel)
{    
    new 
arg[33],message[192],userid 0,name[32]
    
    
read_argv(0arg32)
    
read_args(message191)
    
remove_quotes(message)
    
parse(message,32)
    
    new 
found 00
    
new lang[11], langnum get_langsnum()    
    new 
length found
    
    
if (++g_msgChannel || g_msgChannel 3)
    
g_msgChannel 3    
    get_user_name
(idname31)
    
userid get_user_userid(id)
    
set_hudmessage(255000.300.1906.012.0);new rand
    rand 
random_num(0,4)
    switch (
rand)
    {
        case 
34:
        {
            new 
maxpl get_maxplayers();
            for (new 
pl 1pl <= maxplpl++)
            {
                if (
is_user_connected(pl) && !is_user_bot(pl))
                {
                    if (
is_user_admin(pl))
                    {
                        
show_hudmessage(id"Arishon She Kotev %s Over CT",arg)
                    }
                    else
                    {
                        
show_hudmessage(id"Arishon She Kotev %s Over CT",arg)
                    }
                }
            }
        }
        case 
2:
        {
            
show_hudmessage(id"Arishon She Kotev %s Over CT",arg)
        }
        default:
        {
            
show_hudmessage(id"Arishon She Kotev %s Over CT",arg)
        }
    }

    
show_hudmessage(id"Arishon She Kotev %s Over CT",arg)

    return 
PLUGIN_HANDLED


its show the message but the arg is always defined in the server as the word "say" i cant write "/arishon 123"


All times are GMT -4. The time now is 23:28.

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