AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Change the " task Scheduler" (https://forums.alliedmods.net/showthread.php?t=325926)

amir13 07-11-2020 09:05

Change the " task Scheduler"
 
Hi.

There is a plugin "Task Scheduler"(https://forums.alliedmods.net/showthread.php?t=1263) for changing tasks by time, whether it can be made so that it also works at the beginning of each round, that is, at the beginning of each round, it sends commands. Thanks in advance:wink:
(on other forums, they could not help me, only gave me tips on learning, but I can not write codes)


Code:

/* AMX Mod script. (Nov 10th, 2002)
*
* Task Scheduler 0.2
*  by JustinHoMi
*
* amx_task time "task" flags
* flags:
*  m - time is in minutes
*  s - time is in seconds
*  r - repeat task
*  t - specific time
*
*/

#include <amxmodx>

new task_cmds[32][108]
new task_times[32][16]
new numtasks = 0

public load_task()
{
        if (read_argc() < 4) {
                server_print("[AMX] Usage:  amx_task < time > ^"command^" < flags >")
                return PLUGIN_HANDLED
        }

        new args[128]
        read_args(args,128)
        new clock[6], cmd[108], flags[5]

        parse(args,clock,6,cmd,108,flags,5)
        new Float:time_f = floatstr(clock)

        new flag[2] = ""
        if (contain(flags,"r") != -1)
                flag="b"
        if (contain(flags,"m") != -1)
                time_f = time_f * 60

        if (contain(flags,"t") != -1)
        {
                copy(task_cmds[numtasks],108,cmd)
                copy(task_times[numtasks],6,clock)
                numtasks++
                return PLUGIN_HANDLED
        }

        set_task(time_f,"run_task",0,cmd,108,flag)

        return PLUGIN_CONTINUE
}

public run_task(cmd[])
{
        server_cmd(cmd)
        return PLUGIN_HANDLED
}

public check_time()
{
        new curtime[16]
        get_time("%H:%M",curtime,16)

        for(new i=0; i<numtasks; i++)
                if(equal(curtime,task_times[i]))
                        server_cmd(task_cmds[i])

        return PLUGIN_CONTINUE
}

public plugin_init()
{
        register_plugin("Task Scheduler","0.2","JustinHoMi")
        register_srvcmd("amx_task","load_task")
        set_task(60.0,"check_time",1,"",0,"b")
        return PLUGIN_CONTINUE
}


OciXCrom 07-11-2020 15:22

Re: Change the " task Scheduler"
 
If you cannot write codes and you're not willing to learn, don't use the section for learning and writing codes.
Post your REQUEST in the PLUGIN REQUESTS section if you want someone else to do it for you.


All times are GMT -4. The time now is 13:54.

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