SA-MP Forums Archive
[Ajuda] Funзao - 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] Funзao (/showthread.php?tid=410560)



Funзao - Rodrigo_Avenged - 26.01.2013

Ola galera , vim tirar uam duvida com voces ... se poder , em dizer qual a funзao que faz para o veiculo Parar de vez , e nao poder andar de jeito nenhum ?



pois estou com meu sistema de gasolina , mas quando chega a 0/100 o veiculo nao para .. rsrs

dк uma olhadinha no code , pois derrepente tem e eu nao sei .. e ta bugado .. rs

pawn Код:
public FuelTimer()
{
    for(new c=0;c<MAX_VEHICLES;c++)
    {
        if(IsVehicleOccupied(c) == 1)
        {
            if(Fuel[c] >= 1) Fuel[c]--;
        }
    }
    foreach(Player, i)
    {
        if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
        {
            new ystring[128];
            format(ystring,sizeof(ystring),"~n~~n~~n~~w~Gasolina: %d/100", Fuel[GetPlayerVehicleID(i)]);
            GameTextForPlayer(i, ystring, 2000, 1);
        }
        if(EstaLogado[i] == 1)
        {
            if(ProgressaoInfo[i][AllowPay] < 6)
            {
                ProgressaoInfo[i][AllowPay] ++;
            }
        }
    }
    return 1;
}



Re: Funзao - ForT - 26.01.2013

pawn Код:
TogglePlayerControllable(playerid, false);
.. se tiver dentro de um veiculo, o veiculo para na hora.


Respuesta: Funзao - Rodrigo_Avenged - 26.01.2013

como colocaria esse code ?

assim ?

pawn Код:
if(Fuel == 0)
{TogglePlayerControllable = 1}
?


Re: Funзao - ForT - 26.01.2013

pode ser assim:

pawn Код:
public FuelTimer()
{
    for(new c=0;c<MAX_VEHICLES;c++)
    {
        if(IsVehicleOccupied(c) == 1)
        {
            if(Fuel[c] >= 1) Fuel[c]--;
        }
    }
    foreach(Player, i)
    {
        if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
        {
            if(Fuel[GetPlayerVehicleID(i)] <= 0)
            {
                TogglePlayerControllable(i, false);
                GameTextForPlayer(i, "~r~Acabou a gasolina", 2000, 1);
            }
            new ystring[128];
            format(ystring,sizeof(ystring),"~n~~n~~n~~w~Gasolina: %d/100", Fuel[GetPlayerVehicleID(i)]);
            GameTextForPlayer(i, ystring, 2000, 1);
        }
        if(EstaLogado[i] == 1)
        {
            if(ProgressaoInfo[i][AllowPay] < 6)
            {
                ProgressaoInfo[i][AllowPay] ++;
            }
        }
    }
    return 1;
}



Respuesta: Funзao - Rodrigo_Avenged - 26.01.2013

vlw ! , vou ver aqui .


Re: Funзao - arakuta - 26.01.2013

Lol... Usar TogglePlayerControllable pra quando acabar a gasolina?
Nao vai poder sair do carro. Nao vai poder mecher a camera.

https://sampwiki.blast.hk/wiki/ManualVehicleEngineAndLights
https://sampwiki.blast.hk/wiki/SetVehicleParamsEx
https://sampwiki.blast.hk/wiki/GetVehicleParamsEx


Respuesta: Funзao - Rodrigo_Avenged - 26.01.2013

vou tentar criar um comando /saircarro , ai sai dele rs