19.08.2015, 22:26
What is wrong at this command?
It fills my vehicle but it won't take my money.
It says "You payed 0$ ro refill your car's fuel."
Is there a problem because of floatround?
BusinessFee = 5000, so:
Example: if I have 20/100 fuel I want to take my money 80% from BusinessFee, so 80/100*5000
Another example: if I have 70/100 fuel I want to take my money 30% from BusinessFee, so 30/100*5000
Can anyone help me? thanks!
PHP код:
CMD:fill(playerid, params[])
{
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new fillstring[128];
format( fillstring, sizeof(fillstring), "You payed {FFFFFF}%d"ORANGESV"$ to refill your car's fuel.", floatround(((100-CarFuel[GetPlayerVehicleID(playerid)])/100)*BusinessInfo[18][bFee]));
BusinessInfo[18][bMoney] += floatround(((100-CarFuel[GetPlayerVehicleID(playerid)])/100 )*BusinessInfo[18][bFee]);
GivePlayerTheMoney(playerid, - floatround(((100-CarFuel[GetPlayerVehicleID(playerid)])/100)*BusinessInfo[18][bFee]));
SCM(playerid, ORANGES, fillstring);
foreach(Player, i)
{
if(GetPlayerVehicleID(i) == GetPlayerVehicleID(playerid))
{
KillTimer(CarTimer[playerid]);
TogglePlayerControllable(i, 0);
FillTimer[playerid] = SetTimerEx("Fill", 250, false, "i", i);
}
}
}
else SCM(playerid, COLOR_DGREY, "You are not driving a car.");
return 1;
}
It says "You payed 0$ ro refill your car's fuel."
Is there a problem because of floatround?
BusinessFee = 5000, so:
Example: if I have 20/100 fuel I want to take my money 80% from BusinessFee, so 80/100*5000
Another example: if I have 70/100 fuel I want to take my money 30% from BusinessFee, so 30/100*5000
Can anyone help me? thanks!