Raised This Month: $ Target: $400
 0% 

Complete a task every 30 minutes


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 07-01-2011 , 20:11   Complete a task every 30 minutes
Reply With Quote #1

How can I register a mode in the server that every 30 minutes it does that and that...?
Diegorkable is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 07-01-2011 , 22:28   Re: Complete a task every 30 minutes
Reply With Quote #2

Using set_task?
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
am_amx
Senior Member
Join Date: Jul 2010
Location: here
Old 07-01-2011 , 22:56   Re: Complete a task every 30 minutes
Reply With Quote #3

set_task
__________________
am_amx is offline
Tirant
Veteran Member
Join Date: Jul 2008
Location: Los Angeles, California
Old 07-02-2011 , 03:43   Re: Complete a task every 30 minutes
Reply With Quote #4

You need to use a save file and get_gametime(), and have it save the next check and check like once every minute. set_task will just have the task execute 30 minutes after the method is called every map, but using get_gametime() with it saving will have it happen every 30 minutes in real life.
__________________

PM me if you're interested in buying the Credits addition for Base Builder
Battlefield Rebirth [66% done]
Call of Duty: MW2 [100% done]
Base Builder [100% done]
Tirant is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-02-2011 , 04:40   Re: Complete a task every 30 minutes
Reply With Quote #5

The method used is going to depend on what is being done and your timelimit (and if you want it to start over or not on a new map). Could you explain what you are trying to do?
__________________
fysiks is offline
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 07-02-2011 , 10:25   Re: Complete a task every 30 minutes
Reply With Quote #6

I simply want a task, like a vote, to be done every 30 minutes, how will the whole code look? cuz I know set_task will happen once and never again, how will the public be called? what do i need to register in plugin_init? thats what i really dont know.
Lets say that the voting will be to change a map, so lets say its on de_dust2, after 30 minutes it gives a vote of what next map should be
Diegorkable is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-02-2011 , 16:53   Re: Complete a task every 30 minutes
Reply With Quote #7

A task can be repeated. You can look at mapchooser.sma to see how it's done there. It basically has a repeating task and each time it runs the function it checks to see if it is time to start the vote, if not, then it just return and does nothing. So, then, when it is time to do something it just does it (shows the vote).

Lines to note: Line 82 and 176 - 182.
__________________
fysiks 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 12:11.


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