Cmd bugged
#1

when i /refuel when i have a ticket its fine but if i dont i pay with cash and i get charged 0$ whats wrong with it?
here is the full cmd
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;
        }
    }
Reply
#2

where verifies that the amount of money is greater than or equal to the required?
Reply
#3

pawn Код:
public UpdateTextdraw()
{
    for(new i; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PreviewingSkin[i] == 1) { if(PreviewingSkinTime[i] == 0) { SetPlayerSkin(i, PreviewingSkinOld[i]); PreviewingSkin[i] = 0; } else { PreviewingSkinTime[i]=PreviewingSkinTime[i]-1; } }
            if(WantsRecording[i] == 1)
            {
                if(TimeTakenHrs[i] == 4 && TimeTakenMins[i] == 59) { PlayerPlaySound(i, 29631, 0, 0, 0); } //Hey, how's the flying coming along?
                if(TimeTakenMins[i] == 59) { TimeTakenMins[i] = 0; TimeTakenHrs[i] += 1; }
                else
                {
                    TimeTakenMins[i] += 1;
                }
            }
            if(IsPlayerInAnyVehicle(i) && GetPlayerVehicleSeat(i) == 0)
            {
                new vid = GetPlayerVehicleID(i);
                switch(GetVehicleModel(vid))
                {
                    case 520 , 577 , 511 , 592 , 512 , 513 , 519 , 593 , 553 , 476, 417 , 425, 447, 469, 487, 488, 497, 548, 563, 460:
                    {
                        new szString[128];
                        format(szString, 40, "%d Percent", vfuel[vid]);
                        TextDrawSetString(Textdraw4[i], szString);
                        TextDrawShowForPlayer(i, Textdraw4[i]);
                        TextDrawShowForPlayer(i, Textdraw5[i]);
                        if(vfuel[vid] < 21) //20 or under fuel
                        {
                            if(vfuel[vid] == 20 && FuelWarned[i] == 0) { FuelWarned[i] = 1; SendClientMessage(i, COLOR_ERROR, "[Instrument Panel] The vehicles fuel is running low ! Please refuel immediately! (/refuel)"); }
                            PlayerPlaySound(i, 1057, 0,0,0);
                        }
                        /*if(vfuel[vid] < 16) //20 or under fuel
                        {
                            if(vfuel[vid] == 20 && FuelWarned[i] == 0) { FuelWarned[i] = 1; SendClientMessage(i, COLOR_ERROR, "[Instrument Panel] The vehicles fuel is running low ! Please refuel immediately! (/refuel)"); }
                            ShowPlayerDialog(playerid, 10, DIALOG_STYLE_MSGBOX, "{FF0000}FUEL EMERGENCY", "{FF0000}Refuel the Plane INMEDIATELLY to avoid Crash!!", "Ok", "");

                            //PlayerPlaySound(i, 1057, 0,0,0);
                        }*/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)