[Ajuda] Valor nгo sendo getado na textdraw
#1

Oi, criei um simples mega basico sistema de velocimetro sу pra pegar a velocidade do carro mesmo, mas estб dando um erro. Quando eu entro no carro aparece a textdraw sу que quando eu aperto W(pra andar) no veiculo, somente um nъmero '1' й setado na textdraw, mas nгo atualiza para outros numeros de velocidade mesmo eu fazendo um timer.. Oquк pode ser?
pawn Код:
//Velocimetro:
new Text:TxdVelo;
forward AtualizarVelo(playerid);

//Textdraw Velocimetro
TxdVelo = TextDrawCreate(538.000000, 342.000000, "~W~H ~G~~H~KM/H");
TextDrawBackgroundColor(TxdVelo, 255);
TextDrawFont(TxdVelo, 1);
TextDrawLetterSize(TxdVelo, 0.480000, 1.799999);
TextDrawColor(TxdVelo, -1);
TextDrawSetOutline(TxdVelo, 1);
TextDrawSetProportional(TxdVelo, 1);

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    SetTimer("AtualizarVelo",1000,1);
    return 1;
}

//public
public AtualizarVelo(playerid)
{
    //Informaзхes Player - Velocimetro
    new txtVelocimetro[60], Float:Velocity[3];
    format(txtVelocimetro, sizeof(txtVelocimetro), "~W~%d ~G~~H~KM/H", GetVehicleVelocity(GetPlayerVehicleID(playerid), Velocity[0], Velocity[1], Velocity[2]));
    TextDrawSetString(TxdVelo, txtVelocimetro);
    TextDrawShowForPlayer(playerid, TxdVelo);
    return 1;
}
Reply
#2

Sua textdraw й global, no caso de velocнmetros vocк deve criar uma textdraw para cada jogador.

Tente estudar algum velocнmetro que tem aqui no fуrum.
Reply
#3

https://sampwiki.blast.hk/wiki/PlayerTextDrawSetString
https://sampwiki.blast.hk/wiki/CreatePlayerTextDraw

Acho que o certo seria assim...
Reply
#4

PHP код:
//Velocimetro:
new Text:TxdVelo[MAX_PLAYERS];
forward AtualizarVelo(playerid);
//Textdraw Velocimetro
for(new i=0i<MAX_PLAYERSi++)
{
    
TxdVelo[i] = TextDrawCreate(538.000000342.000000"~W~H ~G~~H~KM/H");
    
TextDrawBackgroundColor(TxdVelo[i], 255);
    
TextDrawFont(TxdVelo[i], 1);
    
TextDrawLetterSize(TxdVelo[i], 0.4800001.799999);
    
TextDrawColor(TxdVelo[i], -1);
    
TextDrawSetOutline(TxdVelo[i], 1);
    
TextDrawSetProportional(TxdVelo[i], 1);
}
public 
OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    
SetTimer("AtualizarVelo"1000true);
    return 
1;
}
//public
public AtualizarVelo(playerid)
{
    
//Informaзхes Player - Velocimetro
    
new txtVelocimetro[60], Float:Velocity[3];
    
format(txtVelocimetrosizeof(txtVelocimetro), "~W~%d ~G~~H~KM/H"GetVehicleVelocity(GetPlayerVehicleID(playerid), Velocity[0], Velocity[1], Velocity[2]));
    
TextDrawSetString(TxdVelo[playerid], txtVelocimetro);
    
TextDrawShowForPlayer(playeridTxdVelo[playerid]);
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)