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



Uber - GuiKommander - 19.01.2019

Queria saber porque quando o jogador sai do veнculo com o ValordaTarifa maior do que 1, nгo acontece nada.

CУDIGO:

PHP код:
        if(oldstate == PLAYER_STATE_PASSENGER && ValorTarifa[playerid] > 0)
        {
            if(
PlayerAtendidoPeloUber[playerid] != INVALID_PLAYER_ID)
            {
                new 
atendendoid PlayerAtendidoPeloUber[playerid];
                
MensagemFormatada(atendendoid, -1"| UBER | Jogador(a) %s saiu do seu Uber, vocк recebe {80FF80}%s {FFFFFF}pela tarifa Dele."PlayerName(playerid), formatReal(ValorTarifa[playerid]));
                for(new 
t5t++) { PlayerTextDrawHide(playeridTextUber[playerid][t]); PlayerTextDrawHide(atendendoidTextUber[atendendoid][t]); }
                
                
sGivePlayerCash(atendendoidValorTarifa[playerid]);
                   
UberPlayer[atendendoid] = INVALID_PLAYER_ID;
                
PlayerAtendidoPeloUber[playerid] = INVALID_PLAYER_ID;
                
Tarifa[playerid] = 0;
                
ValorTarifa[playerid] = 0;
            }
        } 



Re: Uber - GabrielCOP - 19.01.2019

Seu cуdigo:

pawn Код:
if(oldstate == PLAYER_STATE_PASSENGER && ValorTarifa[playerid] > 0)
        {
            if(PlayerAtendidoPeloUber[playerid] != INVALID_PLAYER_ID)
            {
                new atendendoid = PlayerAtendidoPeloUber[playerid];
                MensagemFormatada(atendendoid, -1, "| UBER | Jogador(a) %s saiu do seu Uber, vocк recebe {80FF80}%s {FFFFFF}pela tarifa Dele.", PlayerName(playerid), formatReal(ValorTarifa[playerid]));
                for(new t; t < 5; t++) { PlayerTextDrawHide(playerid, TextUber[playerid][t]); PlayerTextDrawHide(atendendoid, TextUber[atendendoid][t]); }
                 
                sGivePlayerCash(atendendoid, ValorTarifa[playerid]);
                   UberPlayer[atendendoid] = INVALID_PLAYER_ID;
                PlayerAtendidoPeloUber[playerid] = INVALID_PLAYER_ID;
                Tarifa[playerid] = 0;
                ValorTarifa[playerid] = 0;
            }
        }
Cуdigo correto:

pawn Код:
if(oldstate == PLAYER_STATE_PASSENGER)
        {
            if(PlayerAtendidoPeloUber[playerid] != INVALID_PLAYER_ID)
            {
                new atendendoid = PlayerAtendidoPeloUber[playerid];
                MensagemFormatada(atendendoid, -1, "| UBER | Jogador(a) %s saiu do seu Uber, vocк recebe {80FF80}%s {FFFFFF}pela tarifa Dele.", PlayerName(playerid), formatReal(ValorTarifa[playerid]));
                for(new t; t < 5; t++) { PlayerTextDrawHide(playerid, TextUber[playerid][t]); PlayerTextDrawHide(atendendoid, TextUber[atendendoid][t]); }
                 
                sGivePlayerCash(atendendoid, ValorTarifa[playerid]);
                   UberPlayer[atendendoid] = INVALID_PLAYER_ID;
                PlayerAtendidoPeloUber[playerid] = INVALID_PLAYER_ID;
                Tarifa[playerid] = 0;
                ValorTarifa[playerid] = 0;
            }
        }
A mudanзa й simples e sucinta: na primeira linha, existe um check do ValorTarifa, impedindo que aconteзa algo se o valor for maior que 0.


Re: Uber - GuiKommander - 19.01.2019

Quote:
Originally Posted by GabrielCOP
Посмотреть сообщение
Seu cуdigo:

pawn Код:
if(oldstate == PLAYER_STATE_PASSENGER && ValorTarifa[playerid] > 0)
        {
            if(PlayerAtendidoPeloUber[playerid] != INVALID_PLAYER_ID)
            {
                new atendendoid = PlayerAtendidoPeloUber[playerid];
                MensagemFormatada(atendendoid, -1, "| UBER | Jogador(a) %s saiu do seu Uber, vocк recebe {80FF80}%s {FFFFFF}pela tarifa Dele.", PlayerName(playerid), formatReal(ValorTarifa[playerid]));
                for(new t; t < 5; t++) { PlayerTextDrawHide(playerid, TextUber[playerid][t]); PlayerTextDrawHide(atendendoid, TextUber[atendendoid][t]); }
                 
                sGivePlayerCash(atendendoid, ValorTarifa[playerid]);
                   UberPlayer[atendendoid] = INVALID_PLAYER_ID;
                PlayerAtendidoPeloUber[playerid] = INVALID_PLAYER_ID;
                Tarifa[playerid] = 0;
                ValorTarifa[playerid] = 0;
            }
        }
Cуdigo correto:

pawn Код:
if(oldstate == PLAYER_STATE_PASSENGER)
        {
            if(PlayerAtendidoPeloUber[playerid] != INVALID_PLAYER_ID)
            {
                new atendendoid = PlayerAtendidoPeloUber[playerid];
                MensagemFormatada(atendendoid, -1, "| UBER | Jogador(a) %s saiu do seu Uber, vocк recebe {80FF80}%s {FFFFFF}pela tarifa Dele.", PlayerName(playerid), formatReal(ValorTarifa[playerid]));
                for(new t; t < 5; t++) { PlayerTextDrawHide(playerid, TextUber[playerid][t]); PlayerTextDrawHide(atendendoid, TextUber[atendendoid][t]); }
                 
                sGivePlayerCash(atendendoid, ValorTarifa[playerid]);
                   UberPlayer[atendendoid] = INVALID_PLAYER_ID;
                PlayerAtendidoPeloUber[playerid] = INVALID_PLAYER_ID;
                Tarifa[playerid] = 0;
                ValorTarifa[playerid] = 0;
            }
        }
A mudanзa й simples e sucinta: na primeira linha, existe um check do ValorTarifa, impedindo que aconteзa algo se o valor for maior que 0.
Mas como que eu vou verificar se a tarifa dele tб maior que 1? O resto do sistema tб tudo normal


Re: Uber - ipsLuan - 20.01.2019

PHP код:
if(ValorTarifa[playerid] > 1) { 
    
//ValorTarifaPlayer > 1
}
else {
    
//ValorTarifaPlayer < 1