Raised This Month: $32 Target: $400
 8% 

REQ: Chat Commands Plugin.


Post New Thread Reply   
 
Thread Tools Display Modes
The_Ghost
Senior Member
Join Date: Jun 2006
Location: RoMaNiA
Old 11-21-2008 , 16:57   Re: REQ: Chat Commands Plugin.
Reply With Quote #11

leave it like this. it is good.

edit: i am going to sleep, it's very late here. post here if you have any other questions, and i will try to answer as soon as possible tomorrow morning. once again, thank you.
__________________
We live in a world where PIZZA arrives faster than the Police !

Last edited by The_Ghost; 11-21-2008 at 17:15.
The_Ghost is offline
Send a message via Skype™ to The_Ghost
Scherzo
Senior Member
Join Date: Feb 2007
Location: Kwidzyn, Poland
Old 11-21-2008 , 17:48   Re: REQ: Chat Commands Plugin.
Reply With Quote #12

Now I have problem only with show score. I will look at this tomorrow.

Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Chat Commands"
#define VERSION "1.0"
#define AUTHOR "R3X"

new g_restarts=0;
new g_freezetime;
new g_cmds[][]=
{
    "kick",
    "ban",
    "banip",
    "score",
    "ff",
    "demo",
    "start",
    "restart",
    "stop",
    "map"
}
public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR);
    register_clcmd("say", "chatFilter",ADMIN_BAN);
    g_freezetime=get_cvar_pointer("mp_freezetime");
}
public chatFilter(id)
{
    new message[128];
    read_argv(1, message, 127);
    for(new i=0;i<sizeof(g_cmds);i++)
    {
        new cmd[33];
        formatex(cmd,32,".%s",g_cmds[i]);
        if(containi(message,cmd)==0)
        {
            callBack(id);
            return PLUGIN_HANDLED;
        }
    }
    return PLUGIN_CONTINUE;
}
getCommandId(cmd[])
{
    for(new i=0;i<sizeof(g_cmds);i++)
    {
        if(equali(cmd, g_cmds[i]))
            return i;
    }
    return -1;
}
public showMatchEnd()
{
    new ft=get_pcvar_num(g_freezetime);
    set_hudmessage(255, 255, 255, -1.0, -1.0, 0, 6.0, float(ft-1));
    show_hudmessage(0, "The match is over.^n^n Thanks for playing!");
}
public restartRound()
{
    switch(g_restarts)
    {
        case 0:
        {
            server_cmd("say Match start in:");
            server_cmd("say 5");
        }
        case 1:
        {
            server_cmd("say 4");
            server_cmd("sv_restartround 1");
        }
        case 2:
        {
            server_cmd("say 3");
            server_cmd("sv_restartround 1");
        }
        case 3:
        {
            server_cmd("say 2");
        }
        case 4:
        {
            server_cmd("say 1");
            server_cmd("sv_restartround 1");
            set_task(2.0, "restartRound");
        }
        case 5:
        {
            new ft=get_pcvar_num(g_freezetime);
            set_hudmessage(255, 255, 255, -1.0, -1.0, 0, 6.0, float(ft-1));
            show_hudmessage(0, "Game is ON !^nLIVE ! LIVE ! LIVE !^nGood Luck and Have Fun!");
        }
        default:
        {
            g_restarts=0;
            return;
        }
    }
    g_restarts++;
    if(g_restarts<5)
    {
        set_task(1.0, "restartRound");
    }
}
public callBack(id)
{
    new message[128], cmd[33],arg[65], arg2[7];
    read_argv (1, message, 128);
    parse(message,cmd,32,arg,64,arg2,6) 
    replace(cmd,32,".","");
    new cID=getCommandId(cmd); 
    switch(cID)
    {
        case 0:
        {
            console_cmd(id,"kick %s", arg);
        }
        case 1:
        {
            new bantime=str_to_num(arg2);
            if(bantime==0)
                bantime=1;
            console_cmd(id,"amx_ban %s %d", arg, bantime);
        }
        case 2:
        {
            new bantime=str_to_num(arg2);
            if(bantime==0)
                bantime=1;
            console_cmd(id,"amx_banip %s %d", arg, bantime);
        }
        case 3:
        {
            //show score
            
        }
        case 4:
        {
            //set ff
            if(equali(arg,"on"))
            {
                console_cmd(id,"amx_cvar mp_friendlyfire 1");
            }
            else if(equali(arg,"off"))
            {
                console_cmd(id,"amx_cvar mp_friendlyfire 0");
            }
        }
        case 5:
        {
            //record demo
            new demoname[71];
            new datetime[31],mapname[21];
            get_time("%d-%m-%Y-%H-%M-%S", datetime, 30);
            get_mapname(mapname,20);
            formatex(demoname,70,"demo-%s-%s.dem",mapname,datetime);
            new player = cmd_target(id, arg, 1);
            if(player==0)
                console_print(id,"Record Demo: '%s' Not found!",arg);
            else        
            {
                console_cmd(player,"record %s",demoname);
                new name[36];
                get_user_name(player,name,35)
                console_print(id,"Record Demo: User found => '%s'",name);
            }
        }
        case 6:
        {
            //start match
            server_cmd("exec war.cfg");
            restartRound();
        }
        case 7:
        {
            log_amx("rex");
            //restart match
            restartRound();
        }
        case 8:
        {
            //stop match
            server_cmd("exec warmup.cfg");
            server_cmd("sv_restartround 3");
            set_task(4.0,"showMatchEnd");
        }
        case 9:
        {
            //changelevel
            console_cmd(id,"amx_map %s", arg);
        }
    }
    return PLUGIN_HANDLED;
}
Kick and bans gets string from chat and puts to amx_kick/amx_ban/amx_banip, so you can use this like that:

Quote:
.kick Player
.kick #214
.ban Player 1
.ban #214 1
.banip Player 1
etc
If bantime is not included or is 'not a number' string instead number plugin sets to 1minute.

Last edited by Scherzo; 11-21-2008 at 17:55.
Scherzo is offline
The_Ghost
Senior Member
Join Date: Jun 2006
Location: RoMaNiA
Old 11-22-2008 , 05:54   Re: REQ: Chat Commands Plugin.
Reply With Quote #13

so .kick and .ban commands don't work... right ?
and what problem do you have with the score ?
__________________
We live in a world where PIZZA arrives faster than the Police !
The_Ghost is offline
Send a message via Skype™ to The_Ghost
Scherzo
Senior Member
Join Date: Feb 2007
Location: Kwidzyn, Poland
Old 11-22-2008 , 06:33   Re: REQ: Chat Commands Plugin.
Reply With Quote #14

Works, but you wrote about <name>. In this plugin '.kick' and '.ban/ip' accept #userid too.

How to count it? I see it is for matches, so it should count points only after .start and before .stop . What about switch teams? Put to array results from both half and display map-results?

Last edited by Scherzo; 11-22-2008 at 06:38.
Scherzo is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 11-22-2008 , 06:41   Re: REQ: Chat Commands Plugin.
Reply With Quote #15

you should do, after .start the Terrs get a. in nick, and Ct's get b. in nick (like tags)

so all scores goign not to CT/T, going to a/b, so if you will change teams, it will same score for a/b teams
__________________
xPaw is offline
Scherzo
Senior Member
Join Date: Feb 2007
Location: Kwidzyn, Poland
Old 11-22-2008 , 06:51   Re: REQ: Chat Commands Plugin.
Reply With Quote #16

Ok, until I will do it upload optimalized and correct working version, but without '.score' command.

Edit.
Maybe you should require from players using clan tags? It could work instead a. and b. prefixes.
Attached Files
File Type: sma Get Plugin or Get Source (chatcommands.sma - 719 views - 3.5 KB)

Last edited by Scherzo; 11-22-2008 at 07:01.
Scherzo is offline
The_Ghost
Senior Member
Join Date: Jun 2006
Location: RoMaNiA
Old 11-22-2008 , 09:17   Re: REQ: Chat Commands Plugin.
Reply With Quote #17

clan tags are not a problem. i have a clan sort plugin from the site and I can sort them, no need for the a. and b. plugin, thanks. about the score command, i forgot to mention that the command can be used by every player.

i saw some time ago a plugin like this, and I remember it used hamsandwitch module. maybe that can help you.
one question: after 15 rounds, the teams switch and you have to restart the game, so the score is reset. can you make it save the score after 15 rounds ? maybe when you type .start the score starts to be saved, and when you type .stop the score is reset. same for the .restart function.

later edit: sorry, I didn't read your early post. This war server is basically used for a cs cup, so the teams have their own tag, I can't put them the a. and b. tag from the beginning. I have an idea.
You can create a separate plugin with the .score function. Look at what I was thinking.
You can create a command to lock the teams, if my expression is correct. I mean, after I use the clan sort commands, amx_clant and amx_clanct, this command should save the names of the player, (eg team1.player, team2.player, depends on what tag I set) and then start the score. so this way after they change, the score is saved.
If this can't be done, a more simple method, create a separate plugin for .score, with a cvar, when the cvar is set to 1, the plugin is activated, terrorist team recieves the 1. tag and ct recieves the 2. tag, and the .score command is available. when set to 0, the plugin is disabled, and the .score command won't work. there's no problem for me.

another question:
PHP Code:
            set_hudmessage(255255255, -1.0, -1.006.0float(ft-1));
            
show_hudmessage(0"Game is ON !^nLIVE ! LIVE ! LIVE !^nGood Luck and Have Fun!"); 
I wanted these messages in chat. Can I change these lines to server_cmd("say Game is ON !^nLIVE ! LIVE ! LIVE !^nGood Luck and Have Fun!"); ?
__________________
We live in a world where PIZZA arrives faster than the Police !

Last edited by The_Ghost; 11-22-2008 at 09:39.
The_Ghost is offline
Send a message via Skype™ to The_Ghost
Scherzo
Senior Member
Join Date: Feb 2007
Location: Kwidzyn, Poland
Old 11-22-2008 , 09:39   Re: REQ: Chat Commands Plugin.
Reply With Quote #18

In posted plugin commands can be send few times, so if you type:
say .start
and before last restart and message you type this again, it will be double. Do you need to block this command using only once at the time?

Update:
better restarts script
removed .score command

Edit:
@up
I use this suggestion:
Quote:
A center messages, like amx_csay, but without the admin name: "Game is LIVE !"
Sure, wait one second.
Attached Files
File Type: sma Get Plugin or Get Source (chatcommands.sma - 852 views - 3.4 KB)

Last edited by Scherzo; 11-22-2008 at 09:42.
Scherzo is offline
The_Ghost
Senior Member
Join Date: Jun 2006
Location: RoMaNiA
Old 11-22-2008 , 09:42   Re: REQ: Chat Commands Plugin.
Reply With Quote #19

yes. a good idea. so if I type .start, I can't type again .start unless I type another command, like .restart and .stop right ?
__________________
We live in a world where PIZZA arrives faster than the Police !
The_Ghost is offline
Send a message via Skype™ to The_Ghost
Scherzo
Senior Member
Join Date: Feb 2007
Location: Kwidzyn, Poland
Old 11-22-2008 , 09:44   Re: REQ: Chat Commands Plugin.
Reply With Quote #20

Exactly. I will do it.

what about this?
Code:
set_hudmessage(255, 255, 255, -1.0, -1.0, 0, 6.0, float(ft-1));
    show_hudmessage(0, "The match is over.^n^n Thanks for playing!");
for chat message too?
Scherzo 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 03:30.


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