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



Velocimetro - FernandoSS - 21.07.2014

Criei um FS agora pouco de um Velocimetro com marcador de combustivel, mostra o modelo do carro, mostra a cidade que vc esta, design muito bunito.

Entao, tipo se eu sou o motorista ele mostra todo o velocimetro e tals, se eu ir como passageiro tbm mostra, Como eu tiro/desabilito isso.

Se me ajudar, quando eu postar esse FS eu coloco seus creditos tbm.

vlw




Re: Velocimetro - Ts3 - 21.07.2014

Bem, й sу vocк verificar se ele e passageiro e se for, й sу desabilitar/Esconder o textdraw para ele..

Veja isso.

https://sampwiki.blast.hk/wiki/TextDrawHideForPlayer (Esconder TextDraw)


https://sampwiki.blast.hk/wiki/OnPlayerStateChange (checar estado do player)

Espero ter ajudado. ^^


Re: Velocimetro - MultiKill - 21.07.2014

Use a funзгo GetPlayerState, para verificar se ele nгo й o motorista.


Re: Velocimetro - Chefгo - 21.07.2014

vc pode tentar isso

pawn Код:
if(GetPlayerState(playerid) == 2)
{
//aki fica as funзхes do velocimetro
}



Re: Velocimetro - FernandoSS - 21.07.2014


Assim esta certo?


pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_PASSENGER && newstate == PLAYER_STATE_PASSENGER)
    {
        TextDrawHideForPlayer(playerid, Combust);
        TextDrawHideForPlayer(playerid, Velo);
        TextDrawHideForPlayer(playerid, Kmh);
        TextDrawHideForPlayer(playerid, Veiculo);
        TextDrawHideForPlayer(playerid, Localidades);
    }
    return 1;
}



Re: Velocimetro - n0minal - 21.07.2014

Nгo, bota apenas if(newstate == PLAYER_STATE_PASSENGER)

...


Re: Velocimetro - FernandoSS - 21.07.2014

Quote:
Originally Posted by n0minal
Посмотреть сообщение
Nгo, bota apenas if(newstate == PLAYER_STATE_PASSENGER)

...
Fiz isto, mas continuou aparecendo para o passageiro.


Re: Velocimetro - n0minal - 21.07.2014

@Edit usa isso:

Quote:

if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
//aqui vc atualiza a velocidade e as textdraws
}
else
{
//aqui vc da hide nas textdraws
}




Re: Velocimetro - FernandoSS - 21.07.2014

Quote:
Originally Posted by n0minal
Посмотреть сообщение
Entгo bota assim: if(oldstate == PLLAYER_STATE_PASSENGER || newstate == PLAYER_STATE_PASSENGER)

@Edit cara isso nгo vai funcionar apenas aswim, vc precisa criar uma variavel ou funcгo para saber se o player й motorista ou nгo, caso seja vc mostra as textdraws na callback q atualiza as textdraws, caso n seja vc faz hide pra ele...
Fiz isto, mas continuou aparecendo para o passageiro.
Isto que eu fiz aqui, de verificar se o player esta conectado e se lele esta dentro do veiculo esta certo?

pawn Код:
public Speedo()
{
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid ++)
    {
        if(IsPlayerConnected(playerid) && IsPlayerInAnyVehicle(playerid))
        {
            TextDrawHideForPlayer(playerid, Velo);
            format(string,sizeof(string),"~w~%d", VelocidadeKM(playerid));
            TextDrawSetString(Velo, string);
            TextDrawShowForPlayer(playerid, Velo);

            format(string,sizeof(string),"~p~%s", Veiculos[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
            TextDrawSetString(Veiculo, string);
            TextDrawShowForPlayer(playerid, Veiculo);

            GetPlayer2DZone(playerid, zone, MAX_ZONE_NAME);
            format(string,sizeof(string),"~w~%s", zone);
            TextDrawSetString(Localidades, string);
            TextDrawShowForPlayer(playerid, Localidades);

            format(string,sizeof(string),"~g~Combustivel  ~r~%d% ~w~ L", Gas[GetPlayerVehicleID(playerid)]);
            TextDrawSetString(Combust, string);
            TextDrawShowForPlayer(playerid, Combust);
           
            format(string,sizeof(string),"  ~y~KM~i~/~y~H", Gas[GetPlayerVehicleID(playerid)]);
            TextDrawSetString(Kmh, string);
            TextDrawShowForPlayer(playerid, Kmh);
        }
        else
        {
            TextDrawHideForPlayer(playerid, Combust);
            TextDrawHideForPlayer(playerid, Velo);
            TextDrawHideForPlayer(playerid, Kmh);
            TextDrawHideForPlayer(playerid, Veiculo);
            TextDrawHideForPlayer(playerid, Localidades);
        }
    }
}



Re: Velocimetro - n0minal - 21.07.2014

Sim, estб certo, olha o edit q fiz na postagem anterior... Usa aquilo dentro da public speedo...