Fuel being set to an absurd amount instead of 100
#1

PHP код:
case 0:
            {
                if(
GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
                {
                    
ShowErrorDialog(playerid"You are not driving a vehicle.");
                    return 
1;
                }
                new 
vehicleid GetPlayerVehicleID(playerid);
                if(
IsBicycle(vehicleid))
                {
                    
ShowErrorDialog(playerid"Your vehicle doesn't have a fuel tank!");
                    return 
1;
                }
                if(
Fuel[vehicleid] >= 100.0)
                {
                    
ShowErrorDialog(playerid"Your vehicle fuel tank is full.");
                    
isrefuelling[playerid] = 0;
                    return 
1;
                }
                if(
GetPlayerMoney(playerid) < FUEL_PRICE)
                {
                    
ShowErrorDialog(playerid"You don't have enough money.");
                    return 
1;
                }
                
RefuelTime[playerid] = 5;
                
SetPVarFloat(playerid"Fuel"Fuel[vehicleid]);
                
GameTextForPlayer(playerid"~g~refueling..."20003);
                
isrefuelling[playerid] = 1;
            } 
PHP код:
if(RefuelTime[i] > && GetPVarInt(i"FuelStation"))
            {
                new 
vehicleid GetPlayerVehicleID(i);
                
RefuelTime[i]--;
                if(
RefuelTime[i] == 0)
                {
                    new 
stationid GetPVarInt(i"FuelStation");
                    new    
cost 100 Fuel[vehicleid] * 3;
                    new 
vid GetPlayerVehicleID(i);
                    
Fuel[vid] = 100.0;
                    if(
GetPlayerState(i) != PLAYER_STATE_DRIVER    || !IsPlayerInRangeOfPoint(i10.0FuelStationPos[stationid][0], FuelStationPos[stationid][1], FuelStationPos[stationid][2]))
                    {
                        
GivePlayerMoney(i, -cost);
                        
format(stringsizeof(string), "~r~-$%d"cost);
                        
GameTextForPlayer(istring20003);
                        
format(stringsizeof(string), "You have paid $%d for the fuel."cost);
                        
isrefuelling[i] = 0;
                        
Fuel[vid] = 100.0;
                        
SendClientMessage(iCOLOR_WHITEstring);
                        
SetPVarInt(i"FuelStation"0);
                        
SetTimer("SpeedoUpdate",100,1);
                    }
                }
            } 
I have it where you refuel your car with the /refuel command. That command brings up a dialog and the first option(case 0) is to buy gas. Everything works now except for the fuel being set to 100. It gets set to some number in the 100,000 thousand range. I can't figure out why.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)