Raised This Month: $ Target: $400
 0% 

random_num() query


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fezh
Veteran Member
Join Date: Dec 2008
Location: BANNED
Old 05-12-2009 , 17:38   random_num() query
Reply With Quote #1

I want to know how I can use random_num() to set random prints, or something like that. Give me an example.
__________________
"There is no knowledge, that is not power"
fezh is offline
Dr.G
Senior Member
Join Date: Nov 2008
Old 05-12-2009 , 17:47   Re: random_num() query
Reply With Quote #2

PHP Code:
public something()
{
 static 
ran_num ran_num random_num(110)
 
 switch(
ran_num)
 {
  case 
1:
   
client_print(03"# %d"ran_num)
  case 
2:
   
client_print(03"# %d"ran_num)
  case 
3:
   
client_print(03"# %d"ran_num)
  case 
4:
   
client_print(03"# %d"ran_num)
  case 
5:
   
client_print(03"# %d"ran_num)
  case 
6:
   
client_print(03"# %d"ran_num)
  case 
7:
   
client_print(03"# %d"ran_num)
  case 
8:
   
client_print(03"# %d"ran_num)
  case 
9:
   
client_print(03"# %d"ran_num)
  case 
10:
   
client_print(03"# %d"ran_num)
 }

__________________
Dr.G is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-12-2009 , 19:21   Re: random_num() query
Reply With Quote #3

Example usage of the switch statement

PHP Code:
switch ( ran_num )
{
    case 
3:    // 1 , 2 , 3
    
case .. 8:    // 4 , 5 , 6 , 7 , 8
    
case 9:    // 9
    
case 10:    // 10
    
default:    // ran_num > 10, ran_num < 0 or ( 1 > ran_num > 10 )

__________________

Last edited by Bugsy; 05-12-2009 at 19:26.
Bugsy 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 01:26.


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