[Ajuda] Bug no sistema de abasteceimento de gasolina
#1

Preciso de ajuda por que jб tentei de varias formas e nгo consegui.

O bug esta nesta parte do cod. Por quando completa o tanque de combustнvel sу cobra 60 de vez ser 120.
pawn Код:
else
                    {
                        quantia = MAX_GASOLINA_COMB - DOF2::GetInt(file, "Gasolina");
                        DOF2::SetInt(file, "Gasolina", MAX_GASOLINA_COMB);
                        format(string,60, "Tanque cheio, foram colocados %d Litros por %d$",pGasolinaZ,quantia);
                    }
EX: Tenho 40 litros ai vou e completo a gasolina colocando 20L. De vez cobrar 40 por ter completado cobra os 20.

Codigo completo.
pawn Код:
#include <a_samp>
#include <DOF2>

#define VALOR_GASOLINA_COMB                                                    2
#define MAX_GASOLINA_COMB                                                     60
#define DIALOG_PGASOLINA                                                       0



public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/abastecer", cmdtext, true, 10) == 0)
    {
        ShowPlayerDialog(playerid, DIALOG_PGASOLINA, DIALOG_STYLE_INPUT, "{C4C400}Gasolina", "Digite a Qunatia de gasolina \nO mбximo e 60 litros \nE custa 2$ o litro.", "Abastecer", "Cancelar");
        return 1;
    }
    return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_PGASOLINA)
    {
        new aname[MAX_PLAYER_NAME],file[123];
        GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
        format(file, sizeof(file), PASTA_CONTAS, aname);

        new pGasolinaZ = strval(inputtext),
        string[60],
        quantia = pGasolinaZ*floatround(VALOR_GASOLINA_COMB);

        if(DOF2::FileExists(file))
        {
            if(pGasolinaZ > MAX_GASOLINA_COMB || pGasolinaZ <= 0) return SendClientMessage(playerid, 0xFF0000AA, "Quantia Invбlida");
            {
                if(AreaPosto[playerid] == 1)
                {
                    if(pGasolinaZ + DOF2::GetInt(file, "Gasolina") < MAX_GASOLINA_COMB)
                    {
                        DOF2::SetInt(file, "Gasolina", DOF2::GetInt(file, "Gasolina") + pGasolinaZ);
                        format(string,60, "* Vocк abastaceu %d Litros por %d$",pGasolinaZ,quantia);
                    }
                    else
                    {
                        quantia = MAX_GASOLINA_COMB - DOF2::GetInt(file, "Gasolina");
                        DOF2::SetInt(file, "Gasolina", MAX_GASOLINA_COMB);
                        format(string,60, "Tanque cheio, foram colocados %d Litros por %d$",pGasolinaZ,quantia);
                    }
                    GivePlayerGrana(playerid, - quantia);
                    SendClientMessage(playerid,Amarelo, string);
                    DOF2::SaveFile();
                }
                else SendClientMessageErro(playerid,Vermelho,"Vocк nгo esta em um posto de combustнvel.");
            }
        }
        return 1;
    }
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 7 Guest(s)