It tells me Im not near a gas station
#2

How unclear is that?

pawn Код:
CMD:refuel(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You must be in a vehicle to do this!");
    if(isrefuelling[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are already refueling!");
    for(new h = 0; h < sizeof(BizzInfo); h++)
    {
        format(file6, sizeof(file6), "realityrp/bizzes/%d.ini", h);

        // Not sure what the following is for, so disabled. See the InRangeOfPoint check
        //BizzInfo[h][benx] = dini_Float(file6, "benx");
        //BizzInfo[h][beny] = dini_Float(file6, "beny");
        //BizzInfo[h][benz] = dini_Float(file6, "benz");

        if(!IsPlayerInRangeOfPoint(playerid, 15, BizzInfo[h][benx], BizzInfo[h][beny], BizzInfo[h][benz]) || BizzInfo[h][btype] != 7) continue;
        if(BizzInfo[h][bprods] < 5) return SendClientMessage(playerid, COLOR_GREY, "Gas station is empty! A petrol trucker is needed to refill!");
        if(GetPlayerMoney(playerid) < BizzInfo[h][bfee]) return SendClientMessage(playerid, COLOR_GREY, "Not enough money!");
        GivePlayerMinusCash(playerid, BizzInfo[h][bfee]);
        SetCameraBehindPlayer(playerid);
        TogglePlayerControllable(playerid, false);
        isrefuelling[playerid] = 1;
        TextDrawSetString(td_fuel[playerid], "Refuelling...");
        SetTimerEx("timer_refuel", 4500, false, "i", playerid);
        BizzInfo[h][bprods] -= 5;
        BizzInfo[h][bbank] += BizzInfo[h][bfee];
        BizzInfo[h][customers]++;
        return 1;
    }
    SendClientMessage(playerid, COLOR_GREY, "You are not at a gas station!");
    return 1;
}
Not tested. Let me know if there's a problem.
Look how cleaner it looks, without 50 else's.
Reply


Messages In This Thread
It tells me Im not near a gas station - by milanosie - 09.02.2012, 19:36
Re: It tells me Im not near a gas station - by MP2 - 09.02.2012, 20:12
Re: It tells me Im not near a gas station - by milanosie - 09.02.2012, 20:15
Re: It tells me Im not near a gas station - by MP2 - 09.02.2012, 20:17
Re: It tells me Im not near a gas station - by milanosie - 09.02.2012, 20:22
Re : It tells me Im not near a gas station - by ricardo178 - 09.02.2012, 21:04
Re: It tells me Im not near a gas station - by milanosie - 09.02.2012, 21:05
Re: It tells me Im not near a gas station - by MP2 - 09.02.2012, 21:09
Re: It tells me Im not near a gas station - by Vince - 09.02.2012, 22:25
Re : Re: It tells me Im not near a gas station - by ricardo178 - 09.02.2012, 22:52

Forum Jump:


Users browsing this thread: 1 Guest(s)