View Full Version : Task for a command
How add task for command? i want execute command automatically when 5 minutes.
set_task(300.0, "cmdTest")
public cmdTest()
{
// your code
}
Fixed.
hazard1337
05-01-2008, 16:06
its in amxmodx.inc, set_task
Edit: BAH YOU BEAT ME TO IT! :P
set_task(300, "cmdTest")
public cmdTest()
{
amx_command?}
Good?
What is cmdTest?
hazard1337
05-01-2008, 16:08
what you would do is
register_concmd("amx_cmdtest","taskcmd")
public taskcmd()
set_task(300, "cmdtest")
public cmdTest()
//insert code for whatever here
YamiKaitou
05-01-2008, 16:11
hazard1337: set_task (300.0, "cmdtest") or you will get a compile warning
I dont know what paste at "cmdtest"
#include <amxmodx>
#include <amxmisc>
new tfac_enable
public plugin_init()
{
register_plugin("Task for a Command", "1.0", "hleV")
tfac_enable = register_cvar("tfac_enable", "1")
set_task(300.0, "cmdExecute")
// set_task(300.0, "cmdExecute", _, _, _, "a", "<number>") // use this if you want to execute it not more than time. Change the <number> to like 3 if you want to execute it 3 times on each 5 minutes
}
public cmdExecute()
{
if (get_pcvar_num(tfac_enable))
{
server_cmd("your command here")
// example: server_cmd("sv_restartround 3")
}
return PLUGIN_CONTINUE
}
Can i change cmdExecute for cmdGr33tz ?? or other? or its command?
hazard1337
05-01-2008, 16:45
Yea yami I know, I kind of forgot lol
Can i change cmdExecute for cmdGr33tz ?? or other? or its command?
Yes, you can change it to whatever you want. Like "cmdExecute" to "noob" or "haha". It's just a task name. I named it cmdExecute (means command: Execute or smth) because it fits it.
vBulletin® v3.8.7, Copyright ©2000-2024, vBulletin Solutions, Inc.