floats
#1

the fStock variable's value: 13.92
When i do this:
Код:
FactoryInfo[GetPVarInt(playerid, "InFactory")][fStock] -= 1.00;
Then it shows up as: 137853251231.00 can someone help me?
I use this format to show the value:
%0.2f
Reply
#2

if fStock in your enum marked with Float: ?
Reply
#3

yes lol, i said that it shows up as 13.92 before the -= 1.00
Reply
#4

I am not too good with pWars, i cant help you there
Reply
#5

Quote:
Originally Posted by Mean
Посмотреть сообщение
I am not too good with pWars, i cant help you there
The pvars is fine, but the -= 1; is not
Reply
#6

new Float:minus=-1.00;
FactoryInfo[GetPVarInt(playerid, "InFactory")][fStock] -= 1.00;

and then use floatsub(tract) with the vars
Reply
#7

You print it wrong you want print decial as float or float as decimal, cant understand from your post that.
Reply
#8

GetPVarFloat, not GetPVarInt? ah silly me, an array calling this way aint possible ><
Reply
#9

Babul, i dont need an float there example: InFactory = 1( factory id from wich i want to take off the 1.00)
Reply
#10

Quote:
Originally Posted by armyoftwo
Посмотреть сообщение
Babul, i dont need an float there example: InFactory = 1( factory id from wich i want to take off the 1.00)
Quote:
Originally Posted by Macluawn
Посмотреть сообщение
did you even read what i said◘? i repeat again THERES NOTHING WRONG WITH THE GETPVARINT ITS JUST THE -1.00!! sorry for caps

Thanks legodude, i am sure that the function will work.
Reply
#11

i assume you want to it like this:
FactoryInfo[GetPVarInt(playerid, "InFactory")][fStock] -= 1.00;
equals
FactoryInfo[1][fStock] -= 1.00;// nothing wrong with the PVar. it needs to be an Integer (to call an array indeed)
equals
FactoryInfo[1][1] -= 1.00;//assuming any value 1 for fStock would do fine...
that makes me to ask you if you initialized it as a float? coz you store a float inside...
Код:
new Float:FactoryInfo[][];
if you print out an integer as a float, such huge values like 137853251231.00 are normal.
i suggest you to store the values as a float and later then you can print them out by using
Код:
format(string,sizeof(string),"%f",FactoryInfo[1][1]);//1 and 1 made it simpler to read
as you told us. is there any difference to the way you tried? or did i run into the same problem yet?
Reply
#12

Yes i have the variable as a float, its in table. Float:fStock
And no i am storing them as floats not as integers
EDIT: fu** i just needed to convert the TakeOff = 1; to a float,
Код:
FactoryInfo[GetPVarInt(playerid, "InFactory")][fStock] -= float(TakeOff);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)