decimal
#1

Hi
How can i do somting like this
new drugs[MAX_PLAYERS];

drugs[playerid] += 0.5

new String[10];
format(String, sizeof(String), "drugs %d",drugs[playerid]);
SendClientMessageToAll(COLOR_GREEN, String);

and it will show "drugs 0.5"
Reply
#2

What do you need? Rounding a decimal to an integer or showing decimals(FLOAT) ?
Reply
#3

show decimals
0.5
I tryed
new Float:drugs= 0.5;
new string[20];
format(string,sizeof(string),"drugs %f",drugs);
SendClientMessage(playerid,COLOR_GREEN,string);

it show 0.500000
and i want it to show only 0.5
Reply
#4

PHP Code:
new drugs[2] = "0.5";
new 
string[20];
format(string,sizeof(string),"drugs %f",floatstr(drugs)); 
Reply
#5

Quote:
Originally Posted by Last_Shadow
View Post
show decimals
0.5
I tryed
new Float:drugs= 0.5;
new string[20];
format(string,sizeof(string),"drugs %f",drugs);
SendClientMessage(playerid,COLOR_GREEN,string);

it show 0.500000
and i want it to show only 0.5
pawn Code:
%.1f
Quote:
Originally Posted by Golf
View Post
PHP Code:
new drugs[4] = "0.5";
new 
string[20];
format(string,sizeof(string),"drugs %f",floatstr(drugs)); 
What the actual fuck?
Reply
#6

ty Vince worked
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)