When vehicle is not moving, gas will fill up.(BUG)
#7

Fillup timer:

pawn Код:
public Fillup()
{
    //foreach(Player, i)
    for(new i; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            new VID;
            new FillUp;
            new string[128];
            VID = GetPlayerVehicleID(i);
            FillUp = 100 - Gas[VID];
            if(Refueling[i] == 1)
            {
                if(PlayerInfo[i][pCash] >= FillUp+4)
                {
                    Gas[VID] += FillUp;
                    FillUp = FillUp * 8;
                    format(string,sizeof(string),"* You filled your vehicle up for: $%d.",FillUp);
                    SendClientMessage(i,COLOR_LIGHTBLUE,string);
                    TogglePlayerControllable(i, 1);
                    PlayerInfo[i][pCash] = PlayerInfo[i][pCash]-FillUp;
                    GivePlayerMoney(i, - FillUp);
                    if(PointInfo[0][PointTaken] != 255) //fossil fuel
                    {
                        FamilyInfo[PointInfo[0][PointTaken]][FamilyBank] += FillUp;
                    }
                    Refueling[i] = 0;
                }
                else
                {
                    SendClientMessage(i,COLOR_GREY,"   You can't afford that !");
                }
            }
        }
    }
    return 1;
}
/fill:
pawn Код:
if(strcmp(cmd, "/fill", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsAtGasStation(playerid))
            {
                GameTextForPlayer(playerid,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~Filling Vehicle, please wait...",2000,3);
                SetTimer("Fillup",12000,0);
                SendClientMessage(playerid, COLOR_YELLOW, "Your vehicle is being filled with fuel.");
                SendClientMessage(playerid, COLOR_YELLOW, "You're frozen until the fuel percentage reaches to 100.");
                TogglePlayerControllable(playerid, 0);
                Refueling[playerid] = 1;
            }
            else
            {
                SendClientMessage(playerid,COLOR_GREY,"   You are not at a Gas Station !");
            }
        }
        return 1;
    }
Check gas timer:
pawn Код:
public CheckInfo()
{
    for(new i = 0;i < MAX_PLAYERS; i++)
    {
        if (IsPlayerInAnyVehicle(i) && IsPlayerConnected(i))
        {
        new vehicle = GetPlayerVehicleID(i);
        if(IsNonFuelVehicle(vehicle)) { return 1; }
        if(Gas[vehicle] >= 1)
        {
            if(Gas[vehicle] <= 10) { PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0); }
            if(gGas[i] == 1) {
            new speed = GetPlayerSpeed(i),string[138];
            format(string,sizeof(string)," %d%~n~ %d%",speed, Gas[vehicle]);
            TextDrawSetString(FSpeedRes[i],string);
        }
            if(Gas[vehicle] <= 1)
        {
                NoFuel[i] = 1;
                RemovePlayerFromVehicle(i);
                SendClientMessage(i, COLOR_RED, "Vehicle is out of fuel!");
                return 1;
                }
            }
        }
    }
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)