03/06/2022 20:29
(Esta mensagem foi modificada pela última vez a: 03/06/2022 22:51 por White_Blue.)
Código PHP:
new PlayerText:KmRodado[MAX_PLAYERS][1];
static Float:Velocity[3];
stock GetPlayerSpeed(vehicleid) {
GetVehicleVelocity(vehicleid, Velocity[0], Velocity[1], Velocity[2]);
return floatround(floatsqroot(Velocity[0] * Velocity[0] + Velocity[1] * Velocity[1] + Velocity[2] * Velocity[2]));
}
forward AtualizarKM(playerid);
public AtualizarKM(playerid) {
new vid = GetPlayerVehicleID(playerid), string[128];
format(string, sizeof(string), "~y~%.1f KM Rodado", GetPlayerSpeed(vid));
PlayerTextDrawSetString(playerid, KmRodado[playerid][0], string);
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate) {
new Timer[MAX_PLAYERS];
if(newstate == PLAYER_STATE_DRIVER) {
PlayerTextDrawShow(playerid, KmRodado[playerid][0]);
Timer[playerid] = SetTimerEx("AtualizarKM", 1000, true, "d", playerid);
}
else if(oldstate == PLAYER_STATE_DRIVER) {
PlayerTextDrawHide(playerid, KmRodado[playerid][0]);
KillTimer(Timer[playerid]);
}
return 1;
}
public OnPlayerConnect(playerid) {
KmRodado[playerid][0] = CreatePlayerTextDraw(playerid, 522.470458, 339.916717, "~n~");
PlayerTextDrawLetterSize(playerid, KmRodado[playerid][0], 0.400000, 1.600000);
PlayerTextDrawAlignment(playerid, KmRodado[playerid][0], 1);
PlayerTextDrawColor(playerid, KmRodado[playerid][0], 16777215);
PlayerTextDrawSetShadow(playerid, KmRodado[playerid][0], 0);
PlayerTextDrawSetOutline(playerid, KmRodado[playerid][0], 1);
PlayerTextDrawBackgroundColor(playerid, KmRodado[playerid][0], 255);
PlayerTextDrawFont(playerid, KmRodado[playerid][0], 1);
PlayerTextDrawSetProportional(playerid, KmRodado[playerid][0], 1);
return 1;
}
Não estou disponível para realizar serviços relacionados ao SA-MP e não costumo responder a mensagens privadas, a menos que estejam relacionadas à moderação do fórum.