[AJUDA] Transformar velocidade em ProgressBar - 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] Transformar velocidade em ProgressBar (
/showthread.php?tid=268839)
[AJUDA] Transformar velocidade em ProgressBar -
GuikBretas - 13.07.2011
Pessoal esses dias eu baixei o include de ProgressBar por Flбvio Torнbio, eu consegui usar numa "parada", mais como eu transformo a velocidade em progressbar? tipo, quando o veнculo acelerar a barra vai aumentando.
__ edit
pawn Код:
//Topo
new Bar:Velocidade[MAX_PLAYERS];
//OnGameModeInit
Velocidade[i] = CreateProgressBar(142.00, 437.00, 55.50, 3.20, -1, 100.0);
//OnPlayerConnect
ShowProgressBarForPlayer(playerid, Velocidade[playerid]);
//e eu tentei nisso no OnPlayerEnterVehicle
new Float:Xz;
new Float:Yz;
new Float:Zz;
//GetVehicleVelocity(GetPlayerVehicleID(playerid), PosX, PosY, PosZ);
SetProgressBarValue(Velocidade[playerid], GetVehicleVelocity(GetPlayerVehicleID(playerid), Xz, Yz, Zz));
UpdateProgressBar(Velocidade[playerid], playerid);
Eu tava 1/2 expert em pawn mais esqueci pq eu tinha parado de mexer ¬¬
Re: [AJUDA] Transformar velocidade em ProgressBar - [BEP]AcerPilot - 13.07.2011
Tenta:
pawn Код:
forward AtualizarVelocidade(playerid);
new Bar:Velocidade[MAX_PLAYERS];
new AtualizarVelocidadeTimer[MAX_PLAYERS];
public OnGameModeInit()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
Velocidade[i] = CreateProgressBar(142.00, 437.00, 55.50, 3.20, -1, 100.0);
}
return 1;
}
public OnPlayerStateChange(playerid, oldstate, newstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
AtualizarVelocidadeTimer[playerid] = SetTimerEx("AtualizarVelocidade", 1000, 1, "i", playerid);
ShowProgressBar(Velocidade[playerid]); //se esse for o nome da funзгo que faz a progressbar ser mostrada
return 1;
}
else if(newstate == PLAYER_STATE_ONFOOT)
{
HideProgressBar(Velocidade[playerid], playerid); //se esse for o nome da funзгo que faz a progressbar parar de ser mostrada
KillTimer(AtualizarVelocidadeTimer[playerid]);
return 1;
}
return 1;
}
public AtualizarVelocidade(playerid)
{
new Float:X, Float:Y, Float:Z;
GetVehicleVelocity(GetPlayerVehicleID(playerid), X, Y, Z);
SetProgressBarValue(Velocidade[playerid], X);
UpdateProgressBar(Velocidade[playerid], playerid);
}
Nunca mexi com a include ProgressBar, portanto deve ter alguns erros.
Re: [AJUDA] Transformar velocidade em ProgressBar -
GuikBretas - 13.07.2011
Eu criei um forward e deu certo, :P resolvido