Fuel System Help, Fast!
#1

hello there i am making my gamemode and i can't find problem in my fuel system
here is the part of script

pawn Код:
if (strcmp(cmd, "/fuelvehicle", true) ==0 )
        {
            if (PlayerToPoint(10.0, playerid,-1674.7214,414.8608,6.7380)  || PlayerToPoint(10.0, playerid,-1680.3044,420.9971,6.7356) || PlayerToPoint(10.0, playerid,-2416.8726,971.9842,44.8690))
            {
                if(IsPlayerInAnyVehicle(playerid))
                {
                    new fuel[MAX_PLAYERS], money[MAX_PLAYERS];
                    fuel[playerid] = 100 - strval(Fuel[vehicleid]);
                    money[playerid] = strval(fuel[playerid]) * 5;
                    money[playerid] = money[playerid] * (-1);
                    if(GetPlayerMoney(playerid) >= money[playerid])
                    {
                        if(engine[vehicleid] == 1)
                        {
                            SendClientMessage(playerid, COLOR_BLUE, "The vehicle's engine must be off.");
                            return 1;
                        }
                        Fuel[vehicleid] = 100;
                        SendClientMessage(playerid, COLOR_SPRINGGREEN, "Your car's gas is refueled");
                        GivePlayerMoney(playerid, money[playerid]);
                        return 1;
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_BLUE, "You don't have enough money");
                        return 1;
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_BLUE, "You're not at a gas station");
                return 1;
            }

        }
when i refuel vehicle it doesn't take my money.

please help.
Reply
#2

Actually .. WTf u are doing...
Here is the code
pawn Код:
if (strcmp(cmd, "/fuelvehicle", true) ==0 )
        {
            if (PlayerToPoint(10.0, playerid,-1674.7214,414.8608,6.7380)  || PlayerToPoint(10.0, playerid,-1680.3044,420.9971,6.7356) || PlayerToPoint(10.0, playerid,-2416.8726,971.9842,44.8690))
            {
                if(IsPlayerInAnyVehicle(playerid))
                {
                    new fuel[MAX_PLAYERS], money[MAX_PLAYERS];
                    fuel[playerid] = 100 - strval(Fuel[vehicleid]);
                    money[playerid] = strval(fuel[playerid]) * 5;
                    if(GetPlayerMoney(playerid) >= money[playerid])
                    {
                        if(engine[vehicleid] == 1)
                        {
                            SendClientMessage(playerid, COLOR_BLUE, "The vehicle's engine must be off.");
                            return 1;
                        }
                        Fuel[vehicleid] = 100;
                        SendClientMessage(playerid, COLOR_SPRINGGREEN, "Your car's gas is refueled");
                        GivePlayerMoney(playerid, -money[playerid]);
                        return 1;
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_BLUE, "You don't have enough money");
                        return 1;
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_BLUE, "You're not at a gas station");
                return 1;
            }

        }
Should work..
Reply
#3

sorry but it is not working :/
Reply
#4

pawn Код:
if(!strcmp("/fuelvehicle", cmd))
{
    if(!PlayerToPoint(10.0, playerid,-1674.7214,414.8608,6.7380) && !PlayerToPoint(10.0, playerid,-1680.3044,420.9971,6.7356) && !PlayerToPoint(10.0, playerid,-2416.8726,971.9842,44.8690)) return SendClientMessage(playerid, COLOR_BLUE, "You're not at a gas station");
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_BLUE, "You must be in a vehicle.");
    new fuelneeded, moneyneeded;
    fuelnedded = 100 - strval(Fuel[vehicleid]);
    moneynedded = strval(fuelneeded) * 5;
    if(GetPlayerMoney(playerid) < money[playerid]) return SendClientMessage(playerid, COLOR_BLUE, "You don't have enough money");
    if(!engine[vehicleid]) return SendClientMessage(playerid, COLOR_BLUE, "The vehicle's engine must be off.");
    Fuel[vehicleid] = 100;
    SendClientMessage(playerid, COLOR_SPRINGGREEN, "Your car's gas is refueled");
    GivePlayerMoney(playerid, -moneyneeded);
    return 1;
}
Reply
#5

EDIT: Nvm, use his ^^ xD
Reply
#6

Quote:
Originally Posted by PotH3Ad
Посмотреть сообщение
EDIT: Nvm, use his ^^ xD
Twice in one night, damn that's a new record!
Reply
#7

not working sorry, and you had few bugs, and by this code it check if engine is off it will say that engine must be off
Reply
#8

pawn Код:
if(!strcmp("/fuelvehicle", cmd))
{
    if(!PlayerToPoint(10.0, playerid,-1674.7214,414.8608,6.7380) && !PlayerToPoint(10.0, playerid,-1680.3044,420.9971,6.7356) && !PlayerToPoint(10.0, playerid,-2416.8726,971.9842,44.8690)) return SendClientMessage(playerid, COLOR_BLUE, "You're not at a gas station");
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_BLUE, "You must be in a vehicle.");
    new fuelneeded, moneyneeded;
    fuelneeded = 100 - strval(Fuel[vehicleid]);
    moneyneeded = strval(fuelneeded) * 5;
    if(GetPlayerMoney(playerid) < money[playerid]) return SendClientMessage(playerid, COLOR_BLUE, "You don't have enough money");
    if(engine[vehicleid] == 1) return SendClientMessage(playerid, COLOR_BLUE, "The vehicle's engine must be off.");
    Fuel[vehicleid] = 100;
    SendClientMessage(playerid, COLOR_SPRINGGREEN, "Your car's gas is refueled");
    GivePlayerMoney(playerid, -moneyneeded);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)