AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   problem with random (https://forums.alliedmods.net/showthread.php?t=155188)

EclipseCP 04-18-2011 12:52

problem with random
 
hi, sorry for my bad english, use translator.

I have a problem with random, I make out a random MODEL (there are 2 that could leave), I did this, but I'm warning

PHP Code:

    new _model random_num(01)
    
    switch(
_model)
    {
        case 
0
        {
            
entity_set_model(iEntitytree_model)         
        }
        case 
1
        {
            
entity_set_model(iEntitytree_model2)
        }
    }

    
entity_set_vector(iEntity,EV_VEC_originOrigin)
    
_tree_model
    entity_set_int
(iEntityEV_INT_movetypeMOVETYPE_BOUNCE

grettings.

fysiks 04-18-2011 12:56

Re: problem with random
 
So what that's the problem?

georgik57 04-18-2011 13:00

Re: problem with random
 
Quote:

Originally Posted by EclipseCP (Post 1452985)
PHP Code:

    new _model random_num(01)
    
    switch(
_model)
    {
        case 
0
        {
            
entity_set_model(iEntitytree_model)         
        }
        case 
1
        {
            
entity_set_model(iEntitytree_model2)
        }
    }

    
entity_set_vector(iEntity,EV_VEC_originOrigin)
    
_tree_model
    entity_set_int
(iEntityEV_INT_movetypeMOVETYPE_BOUNCE


you can only switch a constant number
use if and else instead
PHP Code:

    new _model random_num(01)
    
    if (!
_model)
            
entity_set_model(iEntitytree_model)         
    else
            
entity_set_model(iEntitytree_model2)

    
entity_set_vector(iEntity,EV_VEC_originOrigin)
    
_tree_model
    entity_set_int
(iEntityEV_INT_movetypeMOVETYPE_BOUNCE


fysiks 04-18-2011 13:02

Re: problem with random
 
Quote:

Originally Posted by georgik57 (Post 1453000)
you can only switch a constant number
use if and else instead
PHP Code:

    new _model random_num(01)
    
    if (!
_model)
            
entity_set_model(iEntitytree_model)         
    else
            
entity_set_model(iEntitytree_model2)

    
entity_set_vector(iEntity,EV_VEC_originOrigin)
    
_tree_model
    entity_set_int
(iEntityEV_INT_movetypeMOVETYPE_BOUNCE


No. You can use a switch with any integer variable.

georgik57 04-18-2011 13:03

Re: problem with random
 
Quote:

Originally Posted by fysiks (Post 1453003)
No. You can use a switch with any integer variable.

then why it gives him a error?

fysiks 04-18-2011 13:04

Re: problem with random
 
Quote:

Originally Posted by georgik57 (Post 1453006)
then why it gives him a error?

I don't see anywhere that he said it gives him errors.

fysiks 04-18-2011 13:07

Re: problem with random
 
Quote:

Originally Posted by EclipseCP (Post 1453011)
sorry, warning is:

PHP Code:

WarningExpression has no effect 

in line "_box_model"

The code you posted does not contain "_box_model".

EclipseCP 04-18-2011 13:08

Re: problem with random
 
_tree_model sry -.-

fysiks 04-18-2011 13:08

Re: problem with random
 
Quote:

Originally Posted by EclipseCP (Post 1453015)
_tree_model sry -.-

Ok, so what is it?

georgik57 04-18-2011 13:10

Re: problem with random
 
Quote:

Originally Posted by fysiks (Post 1453008)
I don't see anywhere that he said it gives him errors.

Quote:

Originally Posted by EclipseCP (Post 1452985)
I did this, but I'm warning

an yes, your theory is correct
anyway he is switching a constant number(0 or 1)
eclipse can you show us a screen shot of your error?


All times are GMT -4. The time now is 20:12.

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