SA-MP Forums Archive
[Ajuda] Gas - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Gas (/showthread.php?tid=168600)



[Ajuda] Gas - Dr_Pawno - 16.08.2010

Aee pessoal tipo... eu fiz um sistema de gas + n pego... ajudem ae:

pawn Код:
new GasVeh[MAX_VEHICLES];
forward Gas();
forward GasAtualizar();
//OnGameModeInit
    for(new v; v <MAX_VEHICLES; v++)
    {
    GasVeh[v] = 100;
    }
    SetTimer("Gas",10000, 1);
    SetTimer("GasAtualizar",10000, 1);

//Publics

public GasAtualizar()
{
    for(new i; i <MAX_PLAYERS; i++)
    {
/*  for(new v; v <MAX_VEHICLES; v++)
    {*/

        new vehicleid = GetPlayerVehicleID(i);
        if(IsPlayerInVehicle(i,vehicleid))
        {
            if(GasVeh[vehicleid] >= 11)
            {
            new string[256];
            format(string,sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~n~~y~Gasolina: %d", GasVeh[vehicleid]);
            GameTextForPlayer(i, string, 9500, 5);
            }
            if(GasVeh[vehicleid] <= 10 && GasVeh[vehicleid] > 0)
            {
            new string[256];
            format(string,sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~n~~p~Gasolina esta acabando: %d", GasVeh[vehicleid]);
            GameTextForPlayer(i, string, 9500, 5);
            }
            if(GasVeh[vehicleid] == 0)
            {
            new string[256];
            format(string,sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~n~~r~Gasolina acabou.", GasVeh[vehicleid]);
            GameTextForPlayer(i, string, 9500, 5);
            }
        }
    }
//  }
    return 1;
}

public Gas()
{
    for(new i; i <MAX_PLAYERS; i++)
    {
/*  for(new v; v <MAX_VEHICLES; v++)
    {*/

        new vehicleid = GetPlayerVehicleID(i);
        if(IsPlayerInVehicle(i,vehicleid))
        {
            if(GasVeh[vehicleid] > 0)
            {
            GasVeh[vehicleid] --;
            }
            if(GasVeh[vehicleid] == 0)
            {
//          RemovePlayerFromVehicle(i);
            SendClientMessage(i, COLOR_GRAD2, "A Gasolina do veiculo acabou");
            TogglePlayerControllable(i, false);
            }
        }
    }
//  }
    return 1;
}
ajudem ae... O ERRO Й: O GAS NГO ABAIXA.


Re: [Ajuda] Gas - LeLeTe - 16.08.2010

Tenho 70% de certeza que vocк nгo fez esse sistema do 0, somente modificou alguns nomes.


Quanto ao erro... tente ao invйs de GasVeh[vehicleid] --; colocar GasVeh[vehicleid] =- 1;


Re: [Ajuda] Gas - Dr_Pawno - 19.08.2010

eu fiz isso do zero sim. e esse seu treco nгo deu serto. AJUDEM AEE...