18.04.2018, 13:59
Hi all.
I have a problem with floatround function.
I'm trying to script a command where when you type /fix (/ripara in the code) it fixes your vehicle substracting 1 $ per damage, but when you try to execute it the price is like -129837297$
Thank you in advance for your help
I have a problem with floatround function.
I'm trying to script a command where when you type /fix (/ripara in the code) it fixes your vehicle substracting 1 $ per damage, but when you try to execute it the price is like -129837297$
pawn Код:
if(InRangeOfIcon(playerid, 11) == 1)
{
if(GetPlayerVehicleID(playerid) > 0)
{
new vid = GetPlayerVehicleID(playerid);
if(meccanicionline > 0) return SendErrorMessage(playerid, "Ci sono dei meccanici online.");
new soldi;
new Float:danno;
new str[128];
GetVehicleHealth(vid, danno);
new danno1 = floatround(danno1, floatround_tozero);
soldi = 1000-danno1;
if(Character[playerid][Cash] >= soldi)
{
GivePlayerMoneyEx(playerid, -soldi);
RepairVehicle(vid);
Vehicles[vid][Broken] = 0;
if(IsPlayerVehicle(vid)) MYSQL_Update_Interger(Vehicles[vid][SQLID], "PlayerVehicles", "Broken", 0);
format(str, sizeof(str), "Hai riparato il tuo veicolo per $%d", soldi);
SendInfoMessage(playerid, str);
return 1;
}
else
{
SendErrorMessage(playerid, ERROR_MONEY);
}
}
}