Raised This Month: $ Target: $400
 0% 

Random task time


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 06-20-2011 , 10:25   Random task time
Reply With Quote #1

Hi

How i do random task time something like this

PHP Code:
new const RANDOM_TASKTIME[][] =
{  
         
25,
         
15,
         
40,
         
150,
          
12,
            
2,
          
150              
}
 
// And set task something
set_task(RANDOM_TASKTIME"thunderclap"TASK_THUNDER_PRE
But i want like this way

new const RANDOM_TASKTIME[][] =
{
25, // first task time
15, // then this
40, // then this
150, // then this
12, // then this
2, // then this
150 // And start again 24
}

thanking in advance.
.Dare Devil. is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-20-2011 , 11:18   Re: Random task time
Reply With Quote #2

You don't need two [], just one, since one dimension.
Also make the value as float.

Just use a var which will be incremented.

set_task( RANDOM_TASKTIME[ myvar ], ... );
[...]
myvar++;
__________________
Arkshine is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 06-20-2011 , 11:27   Re: Random task time
Reply With Quote #3

Quote:
Originally Posted by Arkshine View Post
You don't need two [], just one, since one dimension.
Also make the value as float.

Just use a var which will be incremented.

set_task( RANDOM_TASKTIME[ myvar ], ... );
[...]
myvar++;
Thanks
You are pro man...
.Dare Devil. is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 06-20-2011 , 13:38   Re: Random task time
Reply With Quote #4

wouldnt just this work?
set_task( RANDOM_TASKTIME[ myvar++ ], ... );
jimaway is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-20-2011 , 14:05   Re: Random task time
Reply With Quote #5

Yes, sure.
__________________
Arkshine is offline
DjOptimuS
Senior Member
Join Date: Jan 2009
Old 06-20-2011 , 23:40   Re: Random task time
Reply With Quote #6

you can use the numbers in that form but use the set task function like this

PHP Code:
set_task(float(RANDOM_TASKTIME), "thunderclap"TASK_THUNDER_PRE
DjOptimuS is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-21-2011 , 01:01   Re: Random task time
Reply With Quote #7

Quote:
Originally Posted by DjOptimuS View Post
you can use the numbers in that form but use the set task function like this

PHP Code:
set_task(float(RANDOM_TASKTIME), "thunderclap"TASK_THUNDER_PRE
Useless native call since they can be declared as float.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
DjOptimuS
Senior Member
Join Date: Jan 2009
Old 06-21-2011 , 05:40   Re: Random task time
Reply With Quote #8

I camed with the solution. maybe the coder is comfortable coding like this.
DjOptimuS is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-21-2011 , 12:49   Re: Random task time
Reply With Quote #9

Quote:
Originally Posted by DjOptimuS View Post
I camed with the solution. maybe the coder is comfortable coding like this.
The "solution" you provided is pointless and also inefficient since the coder can already declare them as float values.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-31-2011 , 23:52   Re: Random task time
Reply With Quote #10

Quote:
Originally Posted by Exolent[jNr] View Post
The "solution" you provided is pointless and also inefficient since the coder can already declare them as float values.
Do you even read?
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Reply


Thread Tools
Display Modes

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 23:34.


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