Raised This Month: $ Target: $400
 0% 

how?: if a float=0.0 ..then set float=1.0


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-28-2010 , 18:36   Re: how?: if a float=0.0 ..then set float=1.0
Reply With Quote #7

Quote:
Originally Posted by cs1.7 View Post
thx..

well if g_AlivePlayers = 0 ..then the outcome of the formula is 0
Dividing by zero will result in an error.

Quote:
Originally Posted by cs1.7 View Post
edit:

another question:

if variable is >30.0 --> set it to 30.0
if it is <15.0 -->set it to 15.0

how do i create such a code most efficiently? Can i create this via one if sentence?
Code:
new Float:variable
variable = floatclamp(variable, 15.0, 30.0)
Quote:
Originally Posted by cs1.7 View Post
here i need two if conditions to achieve my goal:
PHP Code:
    if(variableX 30.0)
    {
        
variableX  30.0;
    }
    else
    {
        
variableX  MAXm 400.0;
    } 
    
    if(
variableX  15.0)
    {
        
variableX  15.0;
    }
    else
    {
        
variableX  MAXm 400.0;
    } 
I don't understand this code.
__________________
fysiks is offline
 



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 14:51.


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