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

Timed respawn


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ancient1
Senior Member
Join Date: Jul 2004
Location: UK
Old 09-19-2012 , 13:46   Timed respawn
Reply With Quote #1

I'm trying to port one of Chronics plugins over to TFC from CS (Power up plugin).

Part of the code is round based.

Code:
public new_round()
{
   for(new i=0;i<count_pups;i++)
   {
      if((!ents[i] || !pev_valid(ents[i])) && !task_exists(i+50))
      {
         spawn_pup(i+50)
      }
   }
}
Since TFC is not round based! how would I go about making the power ups auto respawn after a set period (cvar) lets say 3 minutes?

Thanks for help in advance.

Ancient
__________________
ancient1 is offline
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 09-19-2012 , 14:54   Re: Timed respawn
Reply With Quote #2

set_task()
__________________
Quote:
#define true ((rand() % 2)? true: false) //Happy debugging suckers
mottzi is offline
Send a message via MSN to mottzi
ancient1
Senior Member
Join Date: Jul 2004
Location: UK
Old 09-19-2012 , 15:41   Re: Timed respawn
Reply With Quote #3

Could you be a bit more specific?

What exact code would I need to take over from the public new_round()

Much appreciated.

Ancient
__________________
ancient1 is offline
ancient1
Senior Member
Join Date: Jul 2004
Location: UK
Old 09-19-2012 , 15:48   Re: Timed respawn
Reply With Quote #4

So could I do something like:

Code:
set_task( 180 )
{
   for(new i=0;i<count_pups;i++)
   {
      if((!ents[i] || !pev_valid(ents[i])) && !task_exists(i+50))
      {
         spawn_pup(i+50)
      }
   }
}
Cheers
__________________

Last edited by ancient1; 09-19-2012 at 15:48.
ancient1 is offline
ancient1
Senior Member
Join Date: Jul 2004
Location: UK
Old 09-19-2012 , 15:50   Re: Timed respawn
Reply With Quote #5

The help guide lists this code

Code:
set_task
[ Main ] [ Core ] [ amxmodx.inc ]
[ comments ]

set_task - Calls function on specified time.
Syntax:
     set_task ( Float:time, const function[], id = 0, const parameter[] = "", len = 0,const flags[] = "", repeat = 0 )
Type:
    Native
Notes:
Flags :

"a" - repeat.
"b" - loop task.
"c" - do task on time after a map timeleft.
"d" - do task on time before a map timelimit.

Example of executing a task once : set_task( 15.0, "MyFunction" )

Remember that functions executed by set_task needs be public.
Not sure it would work as I have posted in previous post?

Cheers,

Ancient
__________________
ancient1 is offline
Old 09-20-2012, 10:03
pizzahut
This message has been deleted by pizzahut. Reason: Ancient wants the plugin to be private.
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 09-20-2012 , 13:17   Re: Timed respawn
Reply With Quote #6

Post the entire plugin.
__________________
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
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 13:23.


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