[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=561663)
Velocimetro -
StrondaXxT - 04.02.2015
To fazendo esse velocнmetro e to com o problema de quando saio do carro nгo desaparece o textdraw
PHP код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
Velo[playerid] = SetTimer("TimeVelocimetro", 100,true);//time que vai atualizar o velocimetro
return 1;
}
PHP код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
PlayerTextDrawHide(playerid,TextoVelocimetro[playerid]);
return 1;
}
PHP код:
public TimeVelocimetro(playerid)
{
if(IsPlayerInVehicle(playerid,GetPlayerVehicleID(playerid)))
{
new str[128];
TextoVelocimetro[playerid] = CreatePlayerTextDraw(playerid,200.0, 433.0, " ");
format(str, sizeof(str), "Velocidade: %d", VelocidadeDoVeiculo(playerid));
PlayerTextDrawSetString(playerid,TextoVelocimetro[playerid], str);
PlayerTextDrawShow(playerid,TextoVelocimetro[playerid]);
}
//else{PlayerTextDrawHide(playerid,TextoVelocimetro[playerid]);}
return 1;
}
Re: Velocimetro -
PT - 04.02.2015
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(oldstate == PLAYER_STATE_DRIVER)
{
PlayerTextDrawHide(playerid,TextoVelocimetro[playerid]);
KillTimer(Velo[playerid]);
}
if(newstate == PLAYER_STATE_DRIVER)
{
TextoVelocimetro[playerid] = CreatePlayerTextDraw(playerid,200.0, 433.0, "_");
Velo[playerid] = SetTimer("TimeVelocimetro", 100, true);//time que vai atualizar o velocimetro
}
return 1;
}
public TimeVelocimetro(playerid)
{
new str[50];
format(str, sizeof(str), "Velocidade: %i", VelocidadeDoVeiculo(playerid));
PlayerTextDrawSetString(playerid, TextoVelocimetro[playerid], str);
PlayerTextDrawShow(playerid, TextoVelocimetro[playerid]);
return 1;
}
serio tu й de 2012?
Se tu tem um timer tem de o "matar" ou ele continuara ativo.
Re: Velocimetro -
StrondaXxT - 04.02.2015
Quote:
Originally Posted by PT
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate) { if(oldstate == PLAYER_STATE_DRIVER) { PlayerTextDrawHide(playerid,TextoVelocimetro[playerid]); KillTimer(Velo[playerid]); } if(newstate == PLAYER_STATE_DRIVER) { TextoVelocimetro[playerid] = CreatePlayerTextDraw(playerid,200.0, 433.0, "_"); Velo[playerid] = SetTimer("TimeVelocimetro", 100, true);//time que vai atualizar o velocimetro } return 1; }
public TimeVelocimetro(playerid) { new str[50]; format(str, sizeof(str), "Velocidade: %i", VelocidadeDoVeiculo(playerid)); PlayerTextDrawSetString(playerid, TextoVelocimetro[playerid], str); PlayerTextDrawShow(playerid, TextoVelocimetro[playerid]); return 1; }
serio tu й de 2012?
Se tu tem um timer tem de o "matar" ou ele continuara ativo.
|
Sim sou mais nгo sou bem ativo "sу observo!"
Tentei com o seu exemplo mais deu na mesma o textdraw fica visivel da mesma forma.
Re: Velocimetro -
PT - 04.02.2015
pawn Код:
public OnPlayerConnect(playerid)
{
TextoVelocimetro[playerid] = CreatePlayerTextDraw(playerid,200.0, 433.0, "_");
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(oldstate == PLAYER_STATE_DRIVER)
{
KillTimer(Velo[playerid]);
PlayerTextDrawHide(playerid,TextoVelocimetro[playerid]);
}
if(newstate == PLAYER_STATE_DRIVER)
{
Velo[playerid] = SetTimer("TimeVelocimetro", 100, true);//time que vai atualizar o velocimetro
}
return 1;
}
public TimeVelocimetro(playerid)
{
new str[50];
format(str, sizeof(str), "Velocidade: %i", VelocidadeDoVeiculo(playerid));
PlayerTextDrawSetString(playerid, TextoVelocimetro[playerid], str);
PlayerTextDrawShow(playerid, TextoVelocimetro[playerid]);
return 1;
}
a pouco me enganei, tem de 1є matar o timer so depois esconder a textdraw
Re: Velocimetro -
StrondaXxT - 04.02.2015
Quote:
Originally Posted by PT
pawn Код:
public OnPlayerConnect(playerid) { TextoVelocimetro[playerid] = CreatePlayerTextDraw(playerid,200.0, 433.0, "_"); return 1; }
public OnPlayerStateChange(playerid, newstate, oldstate) { if(oldstate == PLAYER_STATE_DRIVER) { KillTimer(Velo[playerid]); PlayerTextDrawHide(playerid,TextoVelocimetro[playerid]); } if(newstate == PLAYER_STATE_DRIVER) { Velo[playerid] = SetTimer("TimeVelocimetro", 100, true);//time que vai atualizar o velocimetro } return 1; }
public TimeVelocimetro(playerid) { new str[50]; format(str, sizeof(str), "Velocidade: %i", VelocidadeDoVeiculo(playerid)); PlayerTextDrawSetString(playerid, TextoVelocimetro[playerid], str); PlayerTextDrawShow(playerid, TextoVelocimetro[playerid]); return 1; }
a pouco me enganei, tem de 1є matar o timer so depois esconder a textdraw
|
kk correto! Nгo tinha me ligado nisso, desculpa a vergonha kkk Deu certinho agora!