Math problem on gametext !
#1

Problem is simple !
When i'm using this script In game it alwase shows 0.0% !
i don't kno what is the correct format
Код:
				if(Objectif[playerid] < 50){format(string,sizeof(string),"loading~n~ %.1f %",100 * Objectif[playerid] /50);}
				if(Objectif[playerid] < 100){format(string,sizeof(string),"loading~n~ %.1f %",100 * Objectif[playerid] /100);}
				GameTextForPlayer(playerid, string, 3000, 4);
Reply
#2

Do you defined Objectif[playerid] as float or integer?

You need to define it as float... new Float:Objectif[MAX_PLAYERS];
Reply
#3

ok thnks ++rep !
Reply
#4

but if i do float and i'musing Objectif in other fucntions ! is this gonna afect them in something
Reply
#5

You'll have to load it as %.f in all of your functions, as it is a float.
%d and %i are for integers.
Reply
#6

Quote:
Originally Posted by maramizo
Посмотреть сообщение
You'll have to load it as %.f in all of your functions, as it is a float.
%d and %i are for integers.
You still can use %i on float values using the floatround function.
Reply
#7

Or you can just change it for GameTextForPlayer, make new local variable...
new Float:something;
something = float (Objectif[playerid]);
Than use variable "smoething" in GameTextForPlayer...
Reply
#8

You only need the second if statement. The second one is the only one that will every go off. The reason for that is that you're re-formating the string if it's less than 100. If it's less than 50, it's less than 100.

What kind of numbers is Objectif[playerid] carrying?
Reply
#9

Whatsup with people and stating the obvious.
I was giving him a fact, no need to criticize facts.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)