Problem with /fill command
#1

So. I have the problem with command /fill. It supposed to refuel my vehicle with certain amount of fuel.

If i write example /fill 12, it isn't refuel my vehicle properly and the fuel meter don't increase about 12. Sometimes if i refuel my vehicle, it says, that, "Your car is full of fuel" or sth, but it isn't.

Here is the command, what may help you to understand, whats the problem. I can't figure it out.
pawn Код:
command(fill, playerid, params[])
{
    new vehicleid = GetPlayerVehicleID(playerid), fuel;
    if(PetrolStations(playerid))
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(Engine[vehicleid] == 0)
            {
                if(sscanf(params, "i", fuel)) return SendClientMessage(playerid, WHITE, "Kasutus: /fill [amount(1-100)]");
                {
                    new amount = VehicleFuel[vehicleid] + fuel;
                    if(amount < 100)
                    {
                        KillTimer(FuelTimer[playerid]);
                        VehicleFuel[vehicleid] += fuel;
                        new value = fuel * 2;
                        GivePlayerMoney(playerid, value);
                        if(VehicleFuel[playerid] > 100)
                        {
                            VehicleFuel[vehicleid] = 100;
                        }
                        FuelLowerTimer(playerid, vehicleid);
                    }
                    else return SendClientMessage(playerid, WHITE, "Your vehicle is full of fuel. (/einfo)");
                }
            }
            else return SendClientMessage(playerid, WHITE, "You have to turn engine off first.");
        }
        else return SendClientMessage(playerid, WHITE, "You have to be in vehicle.");
    }
    else return SendClientMessage(playerid, WHITE, "You are not nere any gas stations.");
    return 1;
}
Reply
#2

Are u using ZCMD? if u do here:

pawn Код:
CMD:fill(playerid, params[])
{
    if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        new engine,lights,alarm,doors,bonnet,boot,objective;
        GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
        if(engine == VEHICLE_PARAMS_ON) return SendClientMessageEx(playerid, COLOR_RED, "You need to shut off the engine before filling up (/car engine).");
        if(!IsAtFuelStation(playerid)) return SendClientMessageEx(playerid, COLOR_RED, "You're not at a fuel station.");
        if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessageEx(playerid,COLOR_RED,"This vehicle doesn't need fuel.");
        if(VehicleFuel[vehicleid] >= 100.0) return SendClientMessageEx(playerid, COLOR_RED, "This vehicle's tank is already full.");
        if(RefuelingVehicle[playerid] == 1) return SendClientMessageEx(playerid, COLOR_RED, "You are refilling your vehicle's tank.");
        SendClientMessageEx(playerid, COLOR_WHITE, "Refueling your vehicle's tank, please wait.");
        RefuelingVehicle[playerid] = 1;
        RefuelingVehicleTimer[playerid] = SetTimerEx("ReFill", 1000, true, "i", playerid);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)