Raised This Month: $ Target: $400
 0% 

Loopin a function?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NeverDie
Junior Member
Join Date: Mar 2006
Old 03-01-2006 , 14:54   Loopin a function?
Reply With Quote #1

I was wonding how you can make a function loop for a few seconds then stop for a few then loop again etc over and over?
NeverDie is offline
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 03-01-2006 , 15:12  
Reply With Quote #2

you mean something like an sleep method?
if yes:
NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
if you say e.g. sleep for 5 seconds, then the FULL game will sleep for 5 seconds


Regards
Greenberet
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
NeverDie
Junior Member
Join Date: Mar 2006
Old 03-01-2006 , 15:16  
Reply With Quote #3

1. I fault there was no sleep function in amxx

2. I said i need a loop eg while function not a sleep function
NeverDie is offline
Ramono
Veteran Member
Join Date: Nov 2005
Location: Netherlands
Old 03-01-2006 , 15:22  
Reply With Quote #4

Code:
#include <amxmodx> #define PLUGIN "looptime" #define VERSION "1.0" #define AUTHOR "NL)Ramon(NL" #define ONSECONDS 5.0   // must be a float #define OFFSECONDS 5.0  // must be a float new on = 0 public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     set_task(OFFSECONDS,"seton")     set_task(0.1,"code",0,"",0,"b") } public seton(){     set_task(ONSECONDS,"setoff")     on = 1 } public setoff(){     set_task(OFFSECONDS,"seton")     on = 0 } public code() {     if(on == 1)         {         //code here     } }

UNTESTED test it yourself ( i think it should work )
It redoes the code every 0.1 if it is on
__________________
Um, hi.
Ramono is offline
wouter
Senior Member
Join Date: Feb 2005
Location: Belgium
Old 03-01-2006 , 15:25  
Reply With Quote #5

i read about it.
0.1 is the minimum
wouter is offline
Ramono
Veteran Member
Join Date: Nov 2005
Location: Netherlands
Old 03-01-2006 , 15:29  
Reply With Quote #6

Quote:
Originally Posted by wouter
i read about it.
0.1 is the minimum
I think the minimum must be set to 0.01, can be very usefull.
__________________
Um, hi.
Ramono is offline
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 03-01-2006 , 15:49  
Reply With Quote #7

Quote:
Originally Posted by NeverDie
1. I fault there was no sleep function in amxx
where's the problem, it is easy to code. So it doesn't realy matter if it exists or not( but it is still bad

Quote:
2. I said i need a loop eg while function not a sleep function
well
Quote:
make a function loop for a few seconds
sounds like an sleep function
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
MaximusBrood
Veteran Member
Join Date: Sep 2005
Location: The Netherlands
Old 03-01-2006 , 16:57  
Reply With Quote #8

Quote:
Originally Posted by Ramono
Quote:
Originally Posted by wouter
i read about it.
0.1 is the minimum
I think the minimum must be set to 0.01, can be very usefull.
Sure, lets do that... and let amxmodx take even more CPU!

---

http://www.amxmodx.org/funcwiki.php?search=set_task
__________________
Released six formerly private plugins. Not active here since ages.
MaximusBrood 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 20:18.


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