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

perform function on time


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SHIELD755
Veteran Member
Join Date: Feb 2018
Location: FROM MARVEL STUDIO
Old 03-24-2019 , 02:28   perform function on time
Reply With Quote #1

hii , can any body help me , actually i wanted to perform any function when it is 0:00 time on server

example : when its 0:00 time , a function which will
changelevel to de_dust2 and mp_timelimit "bla bla" (JUST EXAMPLE) , so can you suggest me a snippet of code which will help me to perform a function on time 0:00

SORRY FOR MY BAAAAD ENGLISH
__________________
SED LYF !!!
SHIELD755 is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 03-24-2019 , 08:10   Re: perform function on time
Reply With Quote #2

Code:
/*  set_timetask (const Hour, const Minute, const Second, const function[], id = 0, const parameter[] = "", len = 0) * Creates a task to execute function at given time. */ stock set_timetask(const Hour, const Minute, const Second, const function[], id = 0, const parameter[] = "", len = 0) {         new curHour, curMinute, curSecond;     time(curHour, curMinute, curSecond);     new curTime = curHour * 3600 + curMinute * 60 + curSecond;     new goalTime = Hour * 3600 + Minute * 60 + Second;         new taskTime = goalTime - curTime;         if ( taskTime < 0 )         taskTime += 86400; // Tomorrow         static pcvarTimelimit, pcvarMaxExtend;         if ( ! pcvarTimelimit )         pcvarTimelimit = get_cvar_pointer("mp_timelimit");         if ( ! pcvarMaxExtend )         pcvarMaxExtend = get_cvar_pointer("amx_extendmap_max");         if ( taskTime > get_pcvar_num(pcvarTimelimit) * 60 + get_pcvar_num(pcvarMaxExtend) * 60 )         return 0;         return set_task(1.0 * taskTime, function, id, parameter, len); }
__________________

Last edited by Black Rose; 03-24-2019 at 08:10.
Black Rose is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 03-24-2019 , 14:36   Re: perform function on time
Reply With Quote #3

You probably also need to save the time of the task (fvault, e.g) since it will be removed once the map change or server restart, whatever.
__________________








CrazY. is offline
baneado
Veteran Member
Join Date: Dec 2012
Location: amxmodx-es.com
Old 03-25-2019 , 09:27   Re: perform function on time
Reply With Quote #4

Quote:
Originally Posted by CrazY. View Post
You probably also need to save the time of the task (fvault, e.g) since it will be removed once the map change or server restart, whatever.
Better is to start the task at every map start

Last edited by baneado; 03-25-2019 at 09:27.
baneado is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 03-29-2019 , 17:21   Re: perform function on time
Reply With Quote #5

Quote:
Originally Posted by baneado View Post
Better is to start the task at every map start
Exactly.
__________________
Black Rose is offline
SHIELD755
Veteran Member
Join Date: Feb 2018
Location: FROM MARVEL STUDIO
Old 03-29-2019 , 23:10   Re: perform function on time
Reply With Quote #6

Thanks all for support
__________________
SED LYF !!!
SHIELD755 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 17:05.


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