Raised This Month: $ Target: $400
 0% 

[Q.?] random_num


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kketan77
Member
Join Date: Apr 2012
Location: India
Old 05-12-2012 , 06:37   [Q.?] random_num
Reply With Quote #1

PHP Code:
public menu_handler(idmenuitem
{
    .
    .
    .
    switch(
key)
    {
        case 
1
        {
        
abc
        
}
        case 
2
        {
        
abc
        
}
        case 
3
        {
        
abc
        
}
        case 
4
        {
        
abc
        
}
        case 
5:
        {
            
menu_handler(idmenurandom_num(03))
        }
    }
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED



menu_handler(id, menu, random_num(0, 3)) is this correct?
or it should be menu_handler(id, menu, random_num(1, 4))?
or it should be menu_handler(id, menu, random_num(1, 2, 3, 4))?

Which one is correct? I am confused!
__________________
♚ || -=[ḰḝṮẫṊ]=- || ᕙ(`▽´)ᕗ || (⊙.⊙(☉_☉)⊙.⊙) || ⁀⊙﹏☉⁀
kketan77 is offline
Send a message via Yahoo to kketan77
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 05-12-2012 , 06:39   Re: [Q.?] random_num
Reply With Quote #2

What are you trying to do? Explain bether.
__________________
Quote:
#define true ((rand() % 2)? true: false) //Happy debugging suckers
mottzi is offline
Send a message via MSN to mottzi
kketan77
Member
Join Date: Apr 2012
Location: India
Old 05-12-2012 , 06:47   Re: [Q.?] random_num
Reply With Quote #3

I what to set case 5 as random case selector which select random case from 1 to 4.
__________________
♚ || -=[ḰḝṮẫṊ]=- || ᕙ(`▽´)ᕗ || (⊙.⊙(☉_☉)⊙.⊙) || ⁀⊙﹏☉⁀
kketan77 is offline
Send a message via Yahoo to kketan77
Larcyn
Senior Member
Join Date: Oct 2010
Old 05-12-2012 , 07:00   Re: [Q.?] random_num
Reply With Quote #4

Do it easier for yourself,

at case 5 add this:

PHP Code:
switch(random_num(14))
{
    case 
1// If random num is 1 add code here.
    
case 2// If random num is 2 add code here.
    
case 3// If random num is 3 add code here.
    
case 4// If random num is 4 add code here.

__________________

Taking private requests, PM me for information.
Selling HideNSeek & Jailbreak plugins.

Selling Achievement API System (PHP &
MySQL / nVault)

Last edited by Larcyn; 05-12-2012 at 07:00.
Larcyn is offline
kketan77
Member
Join Date: Apr 2012
Location: India
Old 05-12-2012 , 07:05   Re: [Q.?] random_num
Reply With Quote #5

menu_handler(id, menu, random_num(1, 4)) is correct!

I did not make it simple, bcos i want to make custom choose menu for public from case 1 to case 4.

By the way ThnxLarcyn
__________________
♚ || -=[ḰḝṮẫṊ]=- || ᕙ(`▽´)ᕗ || (⊙.⊙(☉_☉)⊙.⊙) || ⁀⊙﹏☉⁀
kketan77 is offline
Send a message via Yahoo to kketan77
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-12-2012 , 12:52   Re: [Q.?] random_num
Reply With Quote #6

Quote:
Originally Posted by kketan77 View Post
menu_handler(id, menu, random_num(1, 4)) is correct!
That is not correct.

You will have errors because you are destroy the same menu twice. You should do this:

PHP Code:
switch( key == random_num(1,4) : key )
{
    case 
1
    {
        
// abc
    
}
    case 
2
    {
        
// abc
    
}
    case 
3
    {
        
// abc
    
}
    case 
4
    {
        
// abc
    
}

__________________
fysiks is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-13-2012 , 01:48   Re: [Q.?] random_num
Reply With Quote #7

Quote:
Originally Posted by fysiks View Post
That is not correct.

You will have errors because you are destroying the same menu twice. You should do this:

PHP Code:
switch( key == random_num(1,4) : key )
{
    case 
1
    {
        
// abc
    
}
    case 
2
    {
        
// abc
    
}
    case 
3
    {
        
// abc
    
}
    case 
4
    {
        
// abc
    
}

__________________
fysiks is offline
Larcyn
Senior Member
Join Date: Oct 2010
Old 05-12-2012 , 07:13   Re: [Q.?] random_num
Reply With Quote #8

Oh, I even misunderstood you, lol.
__________________

Taking private requests, PM me for information.
Selling HideNSeek & Jailbreak plugins.

Selling Achievement API System (PHP &
MySQL / nVault)
Larcyn is offline
kketan77
Member
Join Date: Apr 2012
Location: India
Old 05-12-2012 , 07:36   Re: [Q.?] random_num
Reply With Quote #9

Ohh really?

Code:
Q.I just want to know which one is correct syntax?

1. menu_handler(id, menu, random_num(0, 3))
2. menu_handler(id, menu, random_num(1, 4))
3. menu_handler(id, menu, random_num(1, 2, 3, 4))
Larcyn your example help me to know which one is correct syntax.
Indirectly you give me answer which is menu_handler(id, menu, random_num(1, 4))

Thnx
__________________
♚ || -=[ḰḝṮẫṊ]=- || ᕙ(`▽´)ᕗ || (⊙.⊙(☉_☉)⊙.⊙) || ⁀⊙﹏☉⁀
kketan77 is offline
Send a message via Yahoo to kketan77
Aooka
Veteran Member
Join Date: Aug 2011
Location: Villeurbanne
Old 05-12-2012 , 07:51   Re: [Q.?] random_num
Reply With Quote #10

You can go to : http://www.amxmodx.org/funcwiki.php?go=func&id=286
Good luck.
__________________
Pawn ? Useless
Aooka 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 00:29.


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