Posts: 143
Threads: 40
Joined: Aug 2014
Hi guys,
So im trying to multiply a car cost by 0.9 (10% cheaper) if hes gasoline. however when i go ingame and i try it, i get a huge ammount of negative cash.
PHP код:
precoveiculo *= 0.9;
So could anyone tell me whats wrong or how it is suppost to be made? Because the number it multiplies by 0.9 is 60k that im currently testing and its suppost to get 54k no decimal numbers or anything.
Posts: 1,208
Threads: 36
Joined: Apr 2015
PHP код:
precoveiculo = floatround(precoveiculo*0.9);
Posts: 143
Threads: 40
Joined: Aug 2014
Ok i made that and now my script just spams the hell out of the messages like a loop.
Heres the script:
PHP код:
if(dialogid == 169)
{
if(response)
{
TogglePlayerControllable(playerid, 1);
new TCarModel = GetVehicleModel(carroapresentar[playerid]);
escolhacombustivel[playerid] = 1;
new valorveiculo = TCarModel-400;
new precoveiculo = VehiclePrices[valorveiculo][0];
if(listitem == 0)
{
tipocombustivel[playerid] = 1;
}
if(listitem == 1)
{
tipocombustivel[playerid] = 2;
precoveiculo = floatround(precoveiculo*0.9);
}
for(new c=0;c<MAX_VEHICLES;c++)
{
if(DynamicCars[c][comprado] != 0) continue;
if(DynamicCars[c][valor] != 0) continue;
if(DynamicCars[c][buy] != 1) continue;
if(DynamicCars[c][CarModel] != 481) continue;
if(!IsValidModel(TCarModel))
return SendClientMessage(playerid, COLOR_RED,"{FF0000}[Erro]: {FFFFFF}Modelo Invбlido.");
SendClientMessage(playerid, COLOR_GREY, "========================================================================================================");
SendClientMessage(playerid, COLOR_WHITE, "Compraste o veiculo com sucesso. Este aparecerб na marinha de Palomino Creek em 10 horas ingame");
SendClientMessage(playerid, COLOR_GREY, "========================================================================================================");
SetTimerEx("buyvehtime", 2000, false, "iii", playerid, TCarModel, c);
if(PlayerInfo[playerid][pVipActive] != 0)
{
GivePlayerEuros(playerid, -precoveiculo/2);
Businesses[1][Products]=Businesses[1][Products]-(precoveiculo/2/100);
Businesses[1][Till]+=precoveiculo;
OnPlayerDataSave(playerid);
}
else
{
GivePlayerEuros(playerid, -precoveiculo);
Businesses[1][Products]=Businesses[1][Products]-(precoveiculo/100);
Businesses[1][Till]+=precoveiculo;
}
if(PlayerInfo[playerid][pChave1] == 255)
{
PlayerInfo[playerid][pChave1] = c+1;
return 1;
}
else if(PlayerInfo[playerid][pChave2] == 255)
{
PlayerInfo[playerid][pChave2] = c+1;
return 1;
}
else if(PlayerInfo[playerid][pChave3] == 255)
{
PlayerInfo[playerid][pChave3] = c+1;
return 1;
}
else if(PlayerInfo[playerid][pChave4] == 255)
{
PlayerInfo[playerid][pChave4] = c+1;
return 1;
}
else if(PlayerInfo[playerid][pChave5] == 255)
{
PlayerInfo[playerid][pChave5] = c+1;
return 1;
}
else if(PlayerInfo[playerid][pChave6] == 255)
{
PlayerInfo[playerid][pChave6] = c+1;
return 1;
}
}
return 1;
}
}