AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Help] handle_say. (https://forums.alliedmods.net/showthread.php?t=134292)

nakash 08-03-2010 02:15

[Help] handle_say.
 
Hey guys. I searched everywhere but couldn't find a good solution for this.
I want to kick someone using a chat command, I mean something like this;

Quote:

!kick PLAYER
Quote:

[SERVER] %s has been kicked by %s.
I know that I should use handle say but I don't know how to use it with parameters.

Also, if possible, I want to change map with this command;
Quote:

!map de_dust2
Quote:

[SERVER] %s has changed the map to %s
Thanks in advance.




Mxnn 08-03-2010 15:34

Re: [Help] handle_say.
 
PHP Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Kick"
#define VERSION "1.0"
#define AUTHOR "Mxnn"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say""handle_say")
}

public 
handle_say(id) {
    
    if(
get_user_flags(id) & ADMIN_KICK)
        return 
PLUGIN_CONTINUE
        
    
new said[64], player[32]
    
read_args(said63)
    
remove_quotes(said)
    
    if (
said[0] == ' ')
        return 
PLUGIN_CONTINUE
    
else
        
strtok(saidsaid63player31' ')
        
    if (!
equal(said"!kick"))
        return 
PLUGIN_CONTINUE
    
    
new user cmd_target(idplayer2)
    
    if (!
user) {
        
client_print(idprint_chat"[AMXX] User not found")
        return 
PLUGIN_CONTINUE
    
}
    
    new 
szTargetName[32], szAdminName[32]
    
get_user_name(idszAdminName31)
    
get_user_name(userszTargetName31)
    
    
client_print(0print_chat"[AMXX] Admin %s KICK %s"szAdminNameszTargetName)
    
server_cmd("kick #%d"user)
    
    return 
PLUGIN_HANDLED
    


Try to do the same with "!map"

katna 08-03-2010 15:53

Re: [Help] handle_say.
 
PHP Code:

#include <amxmodx>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

new const AmxCmds[][]= { "ct","t","roundtime","ft","freezetime","revive","restart","rr","gag","ungag","bury",
"unbury","rocket","kick","ban","slay","slap","map","glow""noclip""godmode""pause",
"heal""weapon""ff","pass","nopass""gravity","aa","alltalk""restartserver" }


public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd"say""HandleSay" );
    
register_clcmd"say_team""HandleSay" );
}

public 
HandleSay(id) {
    new 
message[128];
    
read_argv(1message127);
    for(new 
i=0;i<sizeof(AmxCmds);i++) {
        new 
cmd[33];
        
formatex(cmd,32,"!%s",AmxCmds[i])
        if(
containi(message,cmd) == 0) {
            if(!(
get_user_flags(id) & ADMIN_CVAR))
                return 
PLUGIN_CONTINUE;
            
HandleChatCmd(id,i);
            return 
PLUGIN_HANDLED;
        }
    }
    return 
PLUGIN_CONTINUE;
}

public 
HandleChatCmd(idtype) {
    new 
message[128], cmd[33], arg[65], arg2[65], name[32];
    
read_argv (1message128);
    
get_user_name(id,name,31);
    
parse(message,cmd,32,arg,64,arg2,64);
    
    switch(
type) {
        case 
1// !ct
        
case 2// !t
        
case 3// !roundtime
        
case 4,5// !ft,!freezetime
        // and you keep continue...
    
}



ConnorMcLeod 08-03-2010 16:08

Re: [Help] handle_say.
 
PHP Code:

#include <amxmodx>
#include <amxmisc>

#define VERSION "0.0.1"

public plugin_init()
{
    
register_plugin("Say Cmds"VERSION"ConnorMcLeod")

    
register_clcmd("say""ClientCommand_Say")
    
register_clcmd("say_team""ClientCommand_Say")
}

public 
ClientCommand_Sayid )
{
    if( 
is_user_admin(id) )
    {
        new 
szSaid[192]
        
read_argv(1szSaidcharsmax(szSaid))
        if( 
szSaid[0] == '!' )
        {
            
client_cmd(id"amx_%s"szSaid[1])
            return 
PLUGIN_HANDLED
        
}
    }
    return 
PLUGIN_CONTINUE



fysiks 08-03-2010 19:13

Re: [Help] handle_say.
 
And ConnorMcLeod wins!

GarbageBox 08-04-2010 00:47

Re: [Help] handle_say.
 
I think so too.

nakash 08-04-2010 03:12

Re: [Help] handle_say.
 
Hehe thank you very much guys! :)


All times are GMT -4. The time now is 00:07.

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