Multiplying costs.
#1

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.
Reply
#2

PHP код:
precoveiculo floatround(precoveiculo*0.9); 
Reply
#3

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(playerid1);
        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(playeridCOLOR_RED,"{FF0000}[Erro]: {FFFFFF}Modelo Invбlido.");
                
SendClientMessage(playeridCOLOR_GREY"========================================================================================================");
                
SendClientMessage(playeridCOLOR_WHITE"Compraste o veiculo com sucesso. Este aparecerб na marinha de Palomino Creek em 10 horas ingame");
                
SendClientMessage(playeridCOLOR_GREY"========================================================================================================");
                
SetTimerEx("buyvehtime"2000false"iii"playeridTCarModelc);
                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;
    }

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)