[Ajuda] Ajuda com velocнmetro
#1

@Resolvido

Fala galerinha.
Estou com uma nova dъvida :c
Tenho o meu velocimetro, e nele, tenho os textos, e preciso alterar o nome da linha se ele estiver em um tipo de carro diferente...

Exemplo:
Se entrar em um carro comum a gasolina > Velocнmetro muda para: "Gasolina:"
Se entrar em um caminhгo ou фnibus a diesel > Velocнmetro muda para: "Diesel:"


Porйm, esse texto aparece na OnPlayerConnect, onde nгo tem 'playerid'.
PHP код:
    textVelocimetro[4] = TextDrawCreate(531.000000387.000000"Veiculo~n~~n~Velocidade~n~~n~TipoCombustivel~n~~n~Lataria");
    
TextDrawAlignment(textVelocimetro[4], 3);
    
TextDrawBackgroundColor(textVelocimetro[4], 0);
    
TextDrawFont(textVelocimetro[4], 2);
    
TextDrawLetterSize(textVelocimetro[4], 0.2100000.799999);
    
TextDrawColor(textVelocimetro[4], -186);
    
TextDrawSetOutline(textVelocimetro[4], 0);
    
TextDrawSetProportional(textVelocimetro[4], 1);
    
TextDrawSetShadow(textVelocimetro[4], 1);
    
TextDrawSetSelectable(textVelocimetro[4], 0); 
Tenho uma stock chamada 'VeiculoDiesel' onde verifica se й um veiculo diesel.
Tentei fazer o seguinte:
PHP код:
new vehicleid GetPlayerVehicleID(playerid);
if(
VeiculoDiesel(vehicleid))
{
    
textVelocimetro[4] = TextDrawCreate(531.000000387.000000"Veiculo~n~~n~Velocidade~n~~n~Diesel~n~~n~Lataria");
    
TextDrawAlignment(textVelocimetro[4], 3);
    
TextDrawBackgroundColor(textVelocimetro[4], 0);
    
TextDrawFont(textVelocimetro[4], 2);
    
TextDrawLetterSize(textVelocimetro[4], 0.2100000.799999);
    
TextDrawColor(textVelocimetro[4], -186);
    
TextDrawSetOutline(textVelocimetro[4], 0);
    
TextDrawSetProportional(textVelocimetro[4], 1);
    
TextDrawSetShadow(textVelocimetro[4], 1);
    
TextDrawSetSelectable(textVelocimetro[4], 0);

Porйm, new vehicleid = GetPlayerVehicleID(playerid); nгo consegue retornar o 'PLAYERID'.

Onde serб mais adequado eu colocar a textdraw amigos?

PS. Desculpa pelo tamanho da 'Dъvida' rs. (Fiz isso para vocкs entenderem <3)

@Edit:
Uhuu х/ 69 posts ( ͡° ͜ʖ ͡°)


Atenciosamente,
TiiP

Reply
#2

Isso pode resolver.
pawn Код:
//New
new tTextVelocimetro[MAX_PLAYERS];

//GameModeInit
    for(new i; i < MAX_PLAYERS; i ++)
    {
        tTextVelocimetro[i] = TextDrawCreate(531.000000, 387.000000, "Veiculo~n~~n~Velocidade~n~~n~Diesel~n~~n~Lataria");
        TextDrawAlignment(tTextVelocimetro[i], 3);
        TextDrawBackgroundColor(tTextVelocimetro[i], 0);
        TextDrawFont(tTextVelocimetro[i], 2);
        TextDrawLetterSize(tTextVelocimetro[i], 0.210000, 0.799999);
        TextDrawColor(tTextVelocimetro[i], -186);
        TextDrawSetOutline(tTextVelocimetro[i], 0);
        TextDrawSetProportional(tTextVelocimetro[i], 1);
        TextDrawSetShadow(tTextVelocimetro[i], 1);
        TextDrawSetSelectable(tTextVelocimetro[i], 0);
    }

//Stock

new vehicleid = GetPlayerVehicleID(playerid);
if(VeiculoDiesel(vehicleid))
{
    TextDrawSetString(tTextVelocimetro[playerid],"Veiculo~n~~n~Velocidade~n~~n~Diesel~n~~n~Lataria");
}
Reply
#3

Quote:
Originally Posted by .Skool_.
Посмотреть сообщение
Isso pode resolver.
pawn Код:
//New
new tTextVelocimetro[MAX_PLAYERS];

//GameModeInit
    for(new i; i < MAX_PLAYERS; i ++)
    {
        tTextVelocimetro[i] = TextDrawCreate(531.000000, 387.000000, "Veiculo~n~~n~Velocidade~n~~n~Diesel~n~~n~Lataria");
        TextDrawAlignment(tTextVelocimetro[i], 3);
        TextDrawBackgroundColor(tTextVelocimetro[i], 0);
        TextDrawFont(tTextVelocimetro[i], 2);
        TextDrawLetterSize(tTextVelocimetro[i], 0.210000, 0.799999);
        TextDrawColor(tTextVelocimetro[i], -186);
        TextDrawSetOutline(tTextVelocimetro[i], 0);
        TextDrawSetProportional(tTextVelocimetro[i], 1);
        TextDrawSetShadow(tTextVelocimetro[i], 1);
        TextDrawSetSelectable(tTextVelocimetro[i], 0);
    }

//Stock

new vehicleid = GetPlayerVehicleID(playerid);
if(VeiculoDiesel(vehicleid))
{
    TextDrawSetString(tTextVelocimetro[playerid],"Veiculo~n~~n~Velocidade~n~~n~Diesel~n~~n~Lataria");
}
Opa, obrigado pela atenзгo.
Tentei de algumas formas...
Porйm nгo entendi essa // Stock ai.
Minha stock jб criada й:
PHP код:
stock VeiculoDiesel(vehicleid)
{
    switch(
GetVehicleModel(vehicleid))
    {
        case 
403,406,407,408,414,416,423,427,428,433,437,444,455,456,498,499,508,514,515,524,525,544,552,556,557,573,578,681,609: return 1;
    }
    return 
0;

@Edit:
PHP код:
for(new iMAX_PLAYERS++)
    {
        
tTextVelocimetro[i] = TextDrawCreate(531.000000387.000000"Veiculo~n~~n~Velocidade~n~~n~Diesel~n~~n~Lataria");
        
TextDrawAlignment(tTextVelocimetro[i], 3);
        
TextDrawBackgroundColor(tTextVelocimetro[i], 0);
        
TextDrawFont(tTextVelocimetro[i], 2);
        
TextDrawLetterSize(tTextVelocimetro[i], 0.2100000.799999);
        
TextDrawColor(tTextVelocimetro[i], -186);
        
TextDrawSetOutline(tTextVelocimetro[i], 0);
        
TextDrawSetProportional(tTextVelocimetro[i], 1);
        
TextDrawSetShadow(tTextVelocimetro[i], 1);
        
TextDrawSetSelectable(tTextVelocimetro[i], 0);
    } 
Este cуdigo apresenta o seguinte warning:
Код:
unico.pwn(290) : warning 213: tag mismatch
unico.pwn(291) : warning 213: tag mismatch
unico.pwn(292) : warning 213: tag mismatch
unico.pwn(293) : warning 213: tag mismatch
unico.pwn(294) : warning 213: tag mismatch
unico.pwn(295) : warning 213: tag mismatch
unico.pwn(296) : warning 213: tag mismatch
unico.pwn(297) : warning 213: tag mismatch
unico.pwn(298) : warning 213: tag mismatch
unico.pwn(299) : warning 213: tag mismatch

Atenciosamente,
TiiP
Reply
#4

Me desulpe, percebi o meu erro.. Use:

pawn Код:
new Text:tTextVelocimetro[MAX_PLAYERS];
A stock, creio eu que vocк utilizarб ela assim:
pawn Код:
if(VeiculoDiesel(vehicleid))
{
     TextDrawSetString(tTextVelocimetro[playerid],"Veiculo~n~~n~Velocidade~n~~n~Diesel~n~~n~Lataria");
}
Reply
#5

Quote:
Originally Posted by .Skool_.
Посмотреть сообщение
Me desulpe, percebi o meu erro.. Use:

pawn Код:
new Text:tTextVelocimetro[MAX_PLAYERS];
A stock, creio eu que vocк utilizarб ela assim:
pawn Код:
if(VeiculoDiesel(vehicleid))
{
     TextDrawSetString(tTextVelocimetro[playerid],"Veiculo~n~~n~Velocidade~n~~n~Diesel~n~~n~Lataria");
}
Entгo Skool, obrigado pela forзa e pela ajuda.
Nгo consegui fazer exatamente assim, porйm consegui me basseando no seu cуdigo

Atenciosamente,
TiiP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)