The online racing simulator
Help
(11 posts, started )
Help
i got a lil problem in my cruise insim

if a user has negative money it has ( $ ) around the money but when a user has +money its fine my code for it is


<?php 
openPrivButton
"Cruise_HUD_Cash",2,140,20,5,12,-1,32,strFormat"^7Cash: {0:C}",GetCurrentPlayerVar"Cash" ) ) );
?>

does the method is in byte or in int ?

byte goes from 0-255
int goes from -9999...-99999...

EDIT: what an dumb answer
maybe convert it to int32
Don't use currency in format
#5 - Krayy
Th eproblem is that Lapper is hard coded to set the Globalization CultureInfo to en-US, so you are unable to use the currency formats if you do not want brackets around them. The best way would to be put an IF clause in to convert the negative to a positive and then print the negative sign:


<?php 
$tmpCash 
GetCurrentPlayerVar"Cash" );
IF (  
$tmpCash )
THEN
    $tmpCash 
$tmpCash $tmpCash $tmpCash# This converts the number to a positive
    
openPrivButton"Cruise_HUD_Cash",2,140,20,5,12,-1,32,strFormat"^7Cash: {0:C}",$tmpCash ) ); 
ELSE
    
openPrivButton"Cruise_HUD_Cash",2,140,20,5,12,-1,32,strFormat"^7Cash: {0:C}",$tmpCash ) ); 
ENDIF
?>

I had to do 3 minuses because for some odd reason, multiplying by -1 doesnt work.
round the values and add $, i don't know where is the problem and why the reason you use currency on format string
Quote from Gai-Luron :round the values and add $, i don't know where is the problem and why the reason you use currency on format string

its for cash D: currency = cash D:
Quote from Krayy :Th eproblem is that Lapper is hard coded to set the Globalization CultureInfo to en-US, so you are unable to use the currency formats if you do not want brackets around them. The best way would to be put an IF clause in to convert the negative to a positive and then print the negative sign:


<?php 
$tmpCash 
GetCurrentPlayerVar"Cash" );
IF (  
$tmpCash )
THEN
    $tmpCash 
$tmpCash $tmpCash $tmpCash# This converts the number to a positive
    
openPrivButton"Cruise_HUD_Cash",2,140,20,5,12,-1,32,strFormat"^7Cash: {0:C}",$tmpCash ) ); 
ELSE
    
openPrivButton"Cruise_HUD_Cash",2,140,20,5,12,-1,32,strFormat"^7Cash: {0:C}",$tmpCash ) ); 
ENDIF
?>

I had to do 3 minuses because for some odd reason, multiplying by -1 doesnt work.

ye i relised that
#9 - Krayy
Even betterer:


<?php 
...
        
openPrivButton"Cruise_HUD_Cash",2,140,20,5,12,-1,32"^7Cash: " FormatCashGetCurrentPlayerVar"Cash" ) ) ); 
...

Sub FormatCash $tmpCash )
    IF (  
ToNum($tmpCash) < )
    
THEN
        $tmpCash 
= -$tmpCash# This converts the number to a positive
        
return ( "-" strFormat"{0:C}",$tmpCash )); 
    ELSE
        return ( 
strFormat"{0:C}",$tmpCash ) ); 
    ENDIF
EndSub
?>


Quote from Krayy :Even betterer:


<?php 
...
        
openPrivButton"Cruise_HUD_Cash",2,140,20,5,12,-1,32"^7Cash: " FormatCashGetCurrentPlayerVar"Cash" ) ) ); 
...

Sub FormatCash $tmpCash )
    IF (  
ToNum($tmpCash) < )
    
THEN
        $tmpCash 
= -$tmpCash# This converts the number to a positive
        
return ( "-" strFormat"{0:C}",$tmpCash )); 
    ELSE
        return ( 
strFormat"{0:C}",$tmpCash ) ); 
    ENDIF
EndSub
?>



works like a charm ty

Help
(11 posts, started )
FGED GREDG RDFGDR GSFDG