Raised This Month: $ Target: $400
 0% 

Execute timed commands


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Aydeev
Junior Member
Join Date: Oct 2014
Old 10-05-2014 , 18:54   Execute timed commands
Reply With Quote #1

Hello,

is it posible to use Amxmodx to time commands to be executed automatically after a specific time?

For example, if I would like to turn off friendly fire after 10 minutes on each map.

Thanks!
Aydeev is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 10-05-2014 , 19:06   Re: Execute timed commands
Reply With Quote #2

Yes, by using set_task
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Aydeev
Junior Member
Join Date: Oct 2014
Old 10-05-2014 , 19:19   Re: Execute timed commands
Reply With Quote #3

Thanks but that requires writing a plugin doesnt it? I don't know anything about that. I was hoping to find something you can put into the servers cfgs
Aydeev is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 10-05-2014 , 19:33   Re: Execute timed commands
Reply With Quote #4

Not possible, it will require a plugin. I'll move this thread for you so someone can assist you in writing a plugin though
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
RateX
Veteran Member
Join Date: Jun 2012
Location: 0o. SEA .o0
Old 10-05-2014 , 22:19   Re: Execute timed commands
Reply With Quote #5

try:
PHP Code:
#include <amxmodx>

#define PLUGIN "Friendly fire off"
#define VERSION "1.0"
#define AUTHOR "RateX"

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
set_task(600.0"FF off")
}

public 
FF off()
{
    
server_cmd("mp_friendlyfire 0")


Last edited by RateX; 10-05-2014 at 22:20.
RateX is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 10-09-2014 , 12:51   Re: Execute timed commands
Reply With Quote #6

PHP Code:
new special_index 17003, Array:cmditself, Array:cmdindex
public plugin_init()
{
    
register_clcmd("setcmd""hook_cmd")
    
cmdindex ArrayCreate(1,1)
    
cmditself ArrayCreate(58,1)
}

// write in console:
// setcmd "sv_gravity 800; 160"
// sv_gravity is an example, anything will work, any command or cvar
// number 160 after the comma means time in secounds
public hook_cmd(id)
{
    
// only admin with rcon access flag can use this.
    
if( !(get_user_flags(id) & ADMIN_RCON) ) return
    
    new 
arg[64]
    
read_args(argcharsmax(arg))
    
remove_quotes(arg);
    
trim(arg)
    if( !
arg[0] ) return
    new 
t[6], exec[58], Float:tasktime
    strtok
(argexeccharsmax(exec), tcharsmax(t), ';')
    
trim(t); trim(exec)
    
tasktime str_to_float(t)
    
set_tasktasktime"make_cmd",  special_index )
    
ArrayPushCellcmdindexspecial_index )
    
ArrayPushStringcmditselfexec )
    
special_index++
}

public 
make_cmd(id)
{
    new 
aexec[58]
    for( 
0ArraySize(cmditself); a++ )
    {
        if( 
ArrayGetCellcmdindex) == id )
        {
            
ArrayGetStringcmditselfaexeccharsmax(exec) )
            
ArrayDeleteItemcmditselfa)
            
ArrayDeleteItemcmdindexa)
            break;
        }
    }
    if( !
exec[0] ) return
    
server_cmdexec )


if you want it to do everytime the same then i guess write things in amxx.cfg for your case write:
setcmd "mp_friendlyfire 0; 600"

just write that line inside the amxx.cfg and that should do the trick i hope... not sure tho

Last edited by .Dare Devil.; 10-09-2014 at 12:55.
.Dare Devil. 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 13:37.


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