09.02.2012, 20:12
How unclear is that?
Not tested. Let me know if there's a problem.
Look how cleaner it looks, without 50 else's.
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;
}
Look how cleaner it looks, without 50 else's.