AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Timed respawn (https://forums.alliedmods.net/showthread.php?t=196365)

ancient1 09-19-2012 13:46

Timed respawn
 
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

mottzi 09-19-2012 14:54

Re: Timed respawn
 
set_task()

ancient1 09-19-2012 15:41

Re: Timed respawn
 
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 09-19-2012 15:48

Re: Timed respawn
 
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 :)

ancient1 09-19-2012 15:50

Re: Timed respawn
 
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

claudiuhks 09-20-2012 13:17

Re: Timed respawn
 
Post the entire plugin.


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

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