Cmd Is not charging money
#1

when you do /refuel when u have a ticket it refuels and fixes that's not a problem but when u do /refuel and u have no tickets it charges you $0.
here is the cmd /refuel - /fuel
pawn Код:
if(strcmp(cmd, "/refuel", true) == 0 || strcmp(cmd, "/fuel", true) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(PInfo[playerid][Tickets] > 0)
            {
                new id = GetPlayerVehicleID(playerid);
                vfuel[id] = 100;
                new engine, lights, alarm, doors, bonnet, boot, objective;
                GetVehicleParamsEx(id, engine, lights, alarm, doors, bonnet, boot, objective);
                SetVehicleParamsEx(id, 1, lights, alarm, doors, bonnet, boot, objective);
                PInfo[playerid][Tickets]=PInfo[playerid][Tickets]-1;
                format(string,sizeof(string),"You have used a ticket and refueled your vehicle for free! [{FF9900}%d {FFFFFF}tickets remaining]",PInfo[playerid][Tickets]);
                GameTextForPlayer(playerid, "~w~Ticket Spent", 4000, 3);
                SendClientMessage(playerid, COLOR_WHITE, string);
                return 1;
            }
            if(IsAtGasStation(playerid))
            {
                new id = GetPlayerVehicleID(playerid);
                new Fuel = vfuel[id];
                if(Fuel == 100)
                {
                    SendClientMessage(playerid, COLOR_ERROR, "Your vehicle already has a full tank of fuel!");
                    GameTextForPlayer(playerid, "~w~Vehicle Full Refueled.", 4000, 3);
                    return 1;
                }
                new Total;
                Total = 100-Fuel;
                Total = Total*55;
                if(PInfo[playerid][Vip] == 1) { Total=Total/100; Total=Total*75; }
                if(PInfo[playerid][AdminLevel] != 0) { Total=Total/100; Total=Total*0; }
                if(PInfo[playerid][Money] < Total)
                {
                    SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to refuel your vehicle!");
                    return 1;
                }
                PInfo[playerid][Money] = PInfo[playerid][Money]-Total;
                GivePlayerMoney(playerid, -Total);
                format(string,sizeof(string),"You have refueled your vehicle for a total of {FF9900}$%d.", Total);
                SendClientMessage(playerid, COLOR_WHITE, string);
                new amtearn[24];
                format(amtearn,sizeof(amtearn),"-$%d", Total);
                GameTextCostumeForPlayer(playerid,amtearn,3,2,COLOR_ERROR); //style 2, 3 seconds, $1,250 (text)!
                vfuel[id] = 100;
                new engine, lights, alarm, doors, bonnet, boot, objective;
                GetVehicleParamsEx(id, engine, lights, alarm, doors, bonnet, boot, objective);
                SetVehicleParamsEx(id, 1, lights, alarm, doors, bonnet, boot, objective);
                PayLog(PlayerName(playerid), Total, "Refueled Vehicle", "Server", "N/A");
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_ERROR, "You are not at a refueling zone! (Refueling zones are at a few main airports)");
                return 1;
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_ERROR, "You are not in a vehicle !");
            return 1;
        }
    }
Thanks
Reply
#2

pawn Код:
if(PInfo[playerid][Tickets] > 0)
            {
                new id = GetPlayerVehicleID(playerid);
                vfuel[id] = 100;
                new engine, lights, alarm, doors, bonnet, boot, objective;
                GetVehicleParamsEx(id, engine, lights, alarm, doors, bonnet, boot, objective);
                SetVehicleParamsEx(id, 1, lights, alarm, doors, bonnet, boot, objective);
                PInfo[playerid][Tickets]=PInfo[playerid][Tickets]-1;
                format(string,sizeof(string),"You have used a ticket and refueled your vehicle for free! [{FF9900}%d {FFFFFF}tickets remaining]",PInfo[playerid][Tickets]);
                GameTextForPlayer(playerid, "~w~Ticket Spent", 4000, 3);
                SendClientMessage(playerid, COLOR_WHITE, string);
                return 1;
            }
          else // if he dont have a ticket
           {
               new id = GetPlayerVehicleID(playerid);
                vfuel[id] = 100;
                new engine, lights, alarm, doors, bonnet, boot, objective;
                GetVehicleParamsEx(id, engine, lights, alarm, doors, bonnet, boot, objective);
                SetVehicleParamsEx(id, 1, lights, alarm, doors, bonnet, boot, objective);
                format(string,sizeof(string),"You have  refueled your vehicle for  10000$ ");
                GivePlayerMoney(playerid,10000);
                SendClientMessage(playerid, COLOR_WHITE, string);
          }
Reply
#3

hmm what is that can you please explain?
Reply
#4

Quote:
Originally Posted by Geeboi_Mehdi
Посмотреть сообщение
hmm what is that can you please explain?
i already explained in a comment
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)