Need help with fuel
#4

Simplifying it a bit...moving some stuff around. Does this do the same thing?
pawn Код:
CMD:stealfuel(playerid, params[])
{
    if(PlayerInfo[playerid][pCan] == 1 && PlayerInfo[playerid][pSiphon] == 1)
    {
        if(PlayerInfo[playerid][pCanFuel] >= 20) return SendClientMessage(playerid, COLOR_YELLOW,"Your gascan is full.");
       
        new closestcar = GetClosestCar(playerid);
        new string[128];
        if(IsPlayerInRangeOfVehicle(playerid, closestcar, 7.0))
        {
            if(Fuel[closestcar] <= 0)
            {
                format(string,sizeof(string),"* %s opens the bottom of the vehicles gas tank, uses their siphon to drain the gasoline into the gascan, but extracts nothing from the empty gastank.",RPN(playerid));
                ProxDetector(30.0, playerid, string, COLOR_PURPLE);
            }
            else
            {
                new Float:FillAmount = 20 - PlayerInfo[playerid][pCanFuel];

                PlayerInfo[playerid][pCanFuel] += FillAmount;
                Fuel[closestcar] -= FillAmount;
                format(string,sizeof(string),"* %s opens the bottom of the vehicles gas tank, uses their siphon to drain the gasoline into the gascan.",RPN(playerid));
                ProxDetector(30.0, playerid, string, COLOR_PURPLE);
               
                if(Fuel[closestcar] < 0) Fuel[closestcar] = 0.0;
                if(PlayerInfo[playerid][pCanFuel] > 20) PlayerInfo[playerid][pCanFuel]=20;

            }
        }
        else SendClientMessage(playerid, COLOR_DARKRED,"[SERVER] {FFFFFF}You aren't near any vehicle.");
    }
    else SendClientMessage(playerid, COLOR_DARKRED,"[SERVER] {FFFFFF}Make sure you got a gascan and a siphon in order to steal fuel.");
    return 1;
}
Reply


Messages In This Thread
Need help with fuel - by RALL0 - 05.07.2013, 14:30
Re: Need help with fuel - by ToiletDuck - 05.07.2013, 16:53
Re: Need help with fuel - by RALL0 - 05.07.2013, 22:06
Re: Need help with fuel - by [ABK]Antonio - 05.07.2013, 22:28
Re: Need help with fuel - by RALL0 - 06.07.2013, 01:00
Re: Need help with fuel - by RALL0 - 06.07.2013, 23:38
Re: Need help with fuel - by Pottus - 07.07.2013, 01:00
Re: Need help with fuel - by RALL0 - 07.07.2013, 01:32
Re: Need help with fuel - by RALL0 - 07.07.2013, 19:37

Forum Jump:


Users browsing this thread: 2 Guest(s)