Formula Issue
#1

Basically I was working on a /fuel script and none of the mathematics seem to be working properly:

pawn Код:
command(fuel, playerid, vehicleid, params[])
{
    new fuelamount;
    new neededfuel = MAX_FUEL - Vehicles[vehicleid][Fuel];
    if(sscanf(params, "d", fuelamount))
    {
        SendClientMessage(playerid, ERROR, "SYNTAX: /fuel [amount]");
    }
    else
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            new calculation = REFUEL_COST / fuelamount;
            if(fuelamount > neededfuel)
            {
                SendClientMessage(playerid, ERROR, "Your vehicle cannot hold that much fuel!");
            }
            else
            {
                if(Player[playerid][Money] < calculation)
                {
                    SendClientMessage(playerid, ERROR, "You do not have enough money to refuel your vehicle.");
                }
                else
                {
                    new calculation2 = Player[playerid][Money] -= calculation;
                    new timertime = fuelamount * 1000;
                    SetPlayerMoney(playerid, calculation2);
                    TogglePlayerControllable(playerid, false);
                    SetTimerEx("Fueling", timertime, false, "i", playerid);
                    new ifuel = Vehicles[vehicleid][Fuel] + fuelamount;
                    Vehicles[vehicleid][Fuel] = ifuel;
                }
            }
        }
    }
    return 1;
}
I am completely clueless on what I am doing wrong. ??
Reply


Messages In This Thread
Formula Issue - by nmader - 08.09.2012, 16:58
AW: Formula Issue - by Nero_3D - 08.09.2012, 17:31
Re: Formula Issue - by nmader - 08.09.2012, 17:57
AW: Formula Issue - by Nero_3D - 08.09.2012, 17:59
Re: Formula Issue - by nmader - 08.09.2012, 18:03
AW: Formula Issue - by Nero_3D - 08.09.2012, 20:02
Re: Formula Issue - by SuperViper - 08.09.2012, 20:04

Forum Jump:


Users browsing this thread: 1 Guest(s)