Raised This Month: $51 Target: $400
 12% 

Task Scheduler - by JustinHoMi


Post New Thread Reply   
 
Thread Tools Display Modes
BlackMilk
Veteran Member
Join Date: Jun 2007
Old 09-25-2007 , 01:44   Re: Task Scheduler - by JustinHoMi
Reply With Quote #121

I'm already using amx_map

And if I remove my maps.ini, where do my admins get a full mapchange/mapvote list? Nowhere, unless you use the currently active mapcycle but I still want them to be able to change to ANYTHING, not just the "active" maps.
__________________
Mod:
User:
BlackMilk is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-25-2007 , 04:18   Re: Task Scheduler - by JustinHoMi
Reply With Quote #122

So, you need to use a modified mapchooser.amxx
ConnorMcLeod is offline
BlackMilk
Veteran Member
Join Date: Jun 2007
Old 09-25-2007 , 08:06   Re: Task Scheduler - by JustinHoMi
Reply With Quote #123

Riiight...
That doesn't really mean anything to me.
__________________
Mod:
User:
BlackMilk is offline
wbeattie
AlliedModders Donor
Join Date: May 2007
Location: Melbourne, Australia
Old 11-02-2007 , 00:41   Re: Task Scheduler - by JustinHoMi
Reply With Quote #124

Hi guys,

There appears to be a small "bug" in the standard mapsmenu.sma (mapsmenu.amxx) which stops the "mapcyclefile" command from working properly. The following is a quick fix and appears to work ;)

Code:
public plugin_init()
{
..
..
..
    //if (!file_exists(maps_ini_file))
    //    format(maps_ini_file, 63, "mapcycle.txt")
    
    ///////////////////     Fix a little bugger ///////////////
    if (!file_exists(maps_ini_file))
        get_cvar_string("mapcyclefile", maps_ini_file, 63)
FWIW, I prepared this to help a friend

Code:
Hi Peter,

I think I have managed to get this working - there is a "small" bug in the standard
mapsmenu.amxx file.

Basically, the Scheduler task reads the amxx.cfg file and executes commands defined by the
"amx_task" command - in this example it first displays a notification and then it changes the 
mapcyclefile to our new file name (default is mapcycle.txt).

This is not necessarily stuck at 3 cycles per day.

The new map cycle will not be displayed via the menues until after a map has changed or
until a "rcon restart" etc is issued. (it may be worthwhile actually adding a  ... amx_task "restart"
after each of the mapcyclefile commands .. not sure if it will work or not).

cheers 
Will

------------------------------------------------------------
Instructions
------------------------------------------------------------
1. Create 3 new text files in dod\
    dod\morningmaps.txt
    dod\afternoonmaps.txt
    dod\eveningmaps.txt

(or any names you choose - they just have to match the names in the amxx.cfg file)
populate them with the full map names for each time...

------------------------------------------------------------------------------
2. Rename
    dod\addons\amxmodx\configs\maps.ini -> old_maps.ini
    (this make amxmodx then use the HL "mapcyclefile" variable get used -
    usually
------------------------------------------------------------------------------
3. Copy the file: 
    mapsmenuwlb.amxx   -> dod\addons\amxmodx\plugins
------------------------------------------------------------------------------
4. Copy the file: 
    task_scheduler.amxx -> dod\addons\amxmodx\plugins
------------------------------------------------------------------------------
5. Edit the file:
    dod\addons\amxmodx\configs\plugins.ini

    a) by adding task_scheduler.amxx
    b) commenting out mapsmenu.amxx
    c) by adding mapsmenuWLB.amxx

    --------- Start plugins.ini ------------------
    ; AMX Mod X plugins

    ; Admin Base - Always one has to be activated
    ...
    task_scheduler.amxx    ; JGHG Task Scheduler

    ; Menus
    ...
    ;        
    ; maps menu (vote, changelevel)
    mapsmenuWLB.amxx        ; maps menu (vote, changelevel)
    --------- End plugins.ini ------------------
----------------------------------------------------------------------------------
6. Edit the file 
    dod\addons\amxmodx\configs\amxx.cfg

    a) by adding the following lines

    --------- Start amxx.cfg ------------------
    amx_task 03:59 "amx_tsay RED 'Morning Map Cycle Starting'" t
    amx_task 04:00 "mapcyclefile morningmaps.txt" t

    amx_task 13:59 "amx_tsay RED 'Afternoon Map Cycle starting 2'" t
    amx_task 14:00 "mapcyclefile afternoonmaps.txt" t

    amx_task 17:59 "amx_tsay RED 'Evening Map Cycle Starting'" t
    amx_task 18:00 "mapcyclefile eveningmaps.txt" t
    --------- End amxx.cfg ------------------
wbeattie is offline
Old 12-24-2007, 03:50
eXtrim
This message has been deleted by eXtrim.
panda82
Member
Join Date: Aug 2007
Old 12-27-2007 , 16:52   Re: Task Scheduler - by JustinHoMi
Reply With Quote #125

hi i put this line in amxx.cfg and no effect

amx_task 1 "amx_execall bind f12 "say am apasat un buton"" mr

what is wrong!
panda82 is offline
deejay87
Senior Member
Join Date: Apr 2004
Location: Pays du Glaude - France
Old 12-27-2007 , 18:01   Re: Task Scheduler - by JustinHoMi
Reply With Quote #126

lot of quote " " " " not permit only one for open and one for close try like this :
Quote:
amx_task 1 "amx_execall bind f12 \'say am apasat un buton\'" mr
or
Quote:
amx_task 1 "amx_execall bind f12 'say am apasat un buton'" mr
I don't have install this two plugins to test now.
__________________
deejay87 is offline
Send a message via MSN to deejay87 Send a message via Skype™ to deejay87
panda82
Member
Join Date: Aug 2007
Old 12-28-2007 , 11:48   Re: Task Scheduler - by JustinHoMi
Reply With Quote #127

the command for amx_exec is

Code:
amx_execall bind f12 "say am apasat un buton"
and i tryed what you say'd but no effect!
panda82 is offline
deejay87
Senior Member
Join Date: Apr 2004
Location: Pays du Glaude - France
Old 12-28-2007 , 12:49   Re: Task Scheduler - by JustinHoMi
Reply With Quote #128

if you don't find , put your command in a .cfg file and exec it

bindf12.cfg
Quote:
amx_execall bind f12 "say am apasat un buton"
And you can do this :
Quote:
amx_task 1 "exec bindf12.cfg" mr
Put the file in your mod location. (cstrike/czero ...)
__________________
deejay87 is offline
Send a message via MSN to deejay87 Send a message via Skype™ to deejay87
MAUGHOLD
Veteran Member
Join Date: Nov 2004
Location: CA USA
Old 02-03-2008 , 12:45   Re: Task Scheduler - by JustinHoMi
Reply With Quote #129

Does anybody know what i would have to change in this plugins code in order to be able to set more tasks. Or better yet is there a better way to do things like this.

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
}

I have 26 tasks set so far but i would like to be able to run a max of 100
here are the tasks i have set in my server.cfg.

Code:
//change mapcycle time changer tasks
amx_task 01:00 "amx_map dod_orange" t
amx_task 01:01 "amx_cvar mp_timelimit 0" t
amx_task 10:00 "amx_map dod_dust" t
amx_task 10:01 "amx_cvar mp_timelimit 45" t

//restart task
amx_task 09:45 "amx_tsay yellow This server will reboot in 60 secs at (6:00am)" t
amx_task 09:46 "restart" t
amx_task 09:48 "amx_tsay green This server has just been restarted (Welcome Back to [FJ])" t

//Bot fun mode tasks
amx_task 09:00 "amx_tsay white Bot funmode has been enabled" t
amx_task 09:01 "shr funmode 1" t
amx_task 09:44 "amx_tsay white bot funmode has been disabled" t
amx_task 09:45 "shr funmode 0" t

amx_task 11:00 "amx_tsay white Bot funmode has been enabled" t
amx_task 11:01 "shr funmode 1" t
amx_task 11:44 "amx_tsay white bot funmode has been disabled" t
amx_task 11:45 "shr funmode 0" t

amx_task 13:00 "amx_tsay white Bot funmode has been enabled" t
amx_task 13:01 "shr funmode 1" t
amx_task 13:44 "amx_tsay white bot funmode has been disabled" t
amx_task 13:45 "shr funmode 0" t

amx_task 15:00 "amx_tsay white Bot funmode has been enabled" t
amx_task 15:01 "shr funmode 1" t
amx_task 15:44 "amx_tsay white bot funmode has been disabled" t
amx_task 15:45 "shr funmode 0" t

Code:
L 02/03/2008 - 09:49:00: [AMXX] Displaying debug trace (plugin "task_scheduler.amxx")
L 02/03/2008 - 09:49:00: [AMXX] Run time error 4: index out of bounds
L 02/03/2008 - 09:49:00: [AMXX]    [0] task_scheduler.sma::load_task (line 43)
This is line 43 and im not sure how to change it or if thats whats needed.
copy(task_cmds[numtasks],108,cmd)

Thanks all.
__________________
{FJ}Justice STEAM_0:0:633975 If anyone needs any help with their server, Just add me to steam friends and I'll help you out.

Last edited by MAUGHOLD; 02-03-2008 at 12:56.
MAUGHOLD is offline
deelight
Junior Member
Join Date: Mar 2007
Location: Germany
Old 03-24-2008 , 02:56   Re: Task Scheduler - by JustinHoMi
Reply With Quote #130

Hi,
i am using the AMXX Autorr plugin for my Dust2 only Server. Cause the Server never make any mapreloads i get up to 60MB logs in a few days

Also i am using Psychsostats and it gets high problem with so large log files.

So i want to restart the server evryday and reload the map evry 120minutes

Is is right to do it like this?

Code:
amx_task 119 "amx_tsay [TARGET info] Automatic Mapreload in 1 minute" mr
amx_task 120 "amx_rcon restart" mr

amx_task 5:40 "amx_tsay [TARGET info] Server restarts in 5 minutes" tr
amx_task 5:45 "amx_tsay [TARGET info] Automatic Serverrestart in 1 minute" tr
amx_task 5:46 "amx_shutdown" tr
amx_shutdown is the automatic server restart from the amx_super all in one admin commands packege
__________________

Last edited by deelight; 03-24-2008 at 02:59.
deelight 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 18:21.


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