27.01.2010, 16:11
hello,
i want that e.g. a trucker can sell his fuel for e.g 0.2$/litre.
The Problem is that the player gets way to much money, instead 200$ at e.g 1001litres.
I tested a bit and i think the problem is that the money which the player should get is saved as float and not as int.
At
I geht this result:
event the variable c isnt a float, the result of litre*price is saved as float?
is there any possibility for type conversion in pawn, e.g c = (int)(a*b); or c = (new) (a*b);
i hope sbd can help me,
Toastbrot
i want that e.g. a trucker can sell his fuel for e.g 0.2$/litre.
The Problem is that the player gets way to much money, instead 200$ at e.g 1001litres.
Код:
public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/test", cmdtext, true, 10) == 0) { new litre=10000; new Float:price=0.2; GivePlayerMoney(playerid, litre*price); //player gets unlimited money -.- return 1; } return 0;}
At
Код:
new litre=1001; new Float:price=0.2; new c=litre*price; printf("litre*price int: %i, float: %.2f c int: %i, float: %.2f", litre*price, litre*price, c, c);
Код:
litre*price int:1128805171, float: 200.19 c int: 1128805171, float: 200.19
is there any possibility for type conversion in pawn, e.g c = (int)(a*b); or c = (new) (a*b);
i hope sbd can help me,
Toastbrot