AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   how random function from switch ? (https://forums.alliedmods.net/showthread.php?t=234234)

login_xcvop 01-27-2014 10:49

how random function from switch ?
 
PHP Code:

        switch(get_pcvar_num(cvar_function))
        {
            case 
1:
            {
                function
            }
            case 
2:
            {
                function
            }
            case 
3:
            {
                function
            }
            case 
4:
            {
                function
            }
            case 
5:
            {
                
random_num(get_pcvar_num(cvar_function), 4-1)
            }
        } 


YamiKaitou 01-27-2014 10:49

Re: how random function from swith ?
 
What are you trying to do?

login_xcvop 01-27-2014 10:51

Re: how random function from switch ?
 
make random is cvar volue 5

YamiKaitou 01-27-2014 10:56

Re: how random function from switch ?
 
You will either need to determine that before the switch or add another switch within case 5

login_xcvop 01-27-2014 11:03

Re: how random function from switch ?
 
how set ? sorry can't understand all, bad english

^SmileY 01-27-2014 11:08

Re: how random function from switch ?
 
This maybe???????????

PHP Code:

switch(get_pcvar_num(g_pCvar))
{
  case 
1: return;

  case 
2: return;

  case 
3: return;

  case 
4: return;

  default: 
set_pcvar_num(g_pCvar,random(1,4));



YamiKaitou 01-27-2014 11:09

Re: how random function from switch ?
 
Code:

new var = get_pcvar_num(cvar_function);
if (var >= 5)
    var = random_num(1,4);

switch(var)
{
    case 1:
    {
        function
    }
    case 2:
    {
        function
    }
    case 3:
    {
        function
    }
    case 4:
    {
        function
    }
}


login_xcvop 01-27-2014 11:10

Re: how random function from switch ?
 
i don't think

^SmileY 01-27-2014 11:15

Re: how random function from switch ?
 
Quote:

Originally Posted by login_xcvop (Post 2091622)
i don't think

You do not think what? Explain better

YamiKaitou 01-27-2014 11:17

Re: how random function from switch ?
 
Did you try my code yet?


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

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