AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Divide in menu (https://forums.alliedmods.net/showthread.php?t=195980)

Mr.Waffle 09-13-2012 21:36

Divide in menu
 
hello.
i got problem with Divide in menu , the code :
PHP Code:

           OpNumber 100

            
new szText555 char ];  
  
            
formatexszTextcharsmaxszText ), "Menu")    

            new 
menu menu_createszText"shop_handler_weapons" );

            
formatexszTextcharsmaxszText ), "Op Number 1 %d"OpNumber 10);                  
        
            
menu_setpropmenuMPROP_EXITMEXIT_ALL );  
  
            
menu_displayidmenu); 

when i use Divide in Variable the menu doesn't pop up.


but if i change this line:

PHP Code:

 formatexszTextcharsmaxszText ), "Op Number 1 %d"OpNumber 10); 

to this:
PHP Code:

 formatexszTextcharsmaxszText ), "Op Number 1 %d"OpNumber 10); 

its will work . there is a problem with Divide.

Sorry for my bad english.

fysiks 09-13-2012 21:57

Re: Divide in menu
 
You shouldn't be declaring your string with "char", use just the number. Also notice that you don't actually add any items to the menu . . .

Mr.Waffle 09-14-2012 07:54

Re: Divide in menu
 
i know , it only Example.
there is no way to use Divide ? I will explain myself better.
I have two variables evrey round they get random numbers

OpNumber = 100
OpNumber1 = 15

like this :
PHP Code:

 formatexszTextcharsmaxszText ), "Op Number 1 %d"OpNumber OpNumber1); 

</span></span></span></span>the problem is when i use divide the menu is not pop up..

lucas_7_94 09-14-2012 08:02

Re: Divide in menu
 
Try using num_to_str( )

Mr.Waffle 09-14-2012 08:13

Re: Divide in menu
 
can u show me how to use it ?
thanks.

lucas_7_94 09-14-2012 08:58

Re: Divide in menu
 
i see your code again and its wrong , why you declare szText as [ xxx char] ?!

Code:
new szDivideResult[ 3 ] num_to_str( 100 / 25 , szDivideResult, charsmax( szDivideResult ) )     new szOptions[ 45 ] formatex( szOptions, charsmax( szOptions ) , "Here is the result sir : %s", szDivideResult )

fysiks 09-14-2012 19:34

Re: Divide in menu
 
There is nothing wrong with the division. Read my first post again (if you even took the time to read it).


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

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