10.03.2019, 23:21
Tem PC nгo?
Tem esse [Tutorial] de 2013 que o cara nгo sabia usar TextDraws e fez por GameTextForPlayer, Mais tem coisas erradas:
https://sampforum.blast.hk/showthread.php?tid=432077
Ainda sim acho melhor fazer na public OnPlayerUpdate pra n pesar o servidor.
PHP Code:
new VelocimetroTimer[MAX_PLAYERS];
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
VelocimetroTimer[playerid] = SetTimerEx("UpdatePlayerVelocimetro", 100, true, "i", playerid);
}
else
{
KillTimer(VelocimetroTimer[playerid]);
}
return 1;
}
public UpdatePlayerVelocimetro(playerid)
{
if(GetPlayerVehicleID(playerid) != INVALID_VEHICLE_ID)
{
new string[35];
format(string, sizeof(string), "~r~Velocidade: ~w~%d ~b~KM/h", GetVehicleSpeed(GetPlayerVehicleID(playerid)));
GameTextForPlayer(playerid, string, false, 2);
}
return 1;
}
GetVehicleSpeed(vehicleid)
{
new Float:Pos[3];
GetVehicleVelocity(vehicleid, Pos[0], Pos[1], Pos[2]);
return floatround(floatsqroot(Pos[0] * Pos[0] + Pos[1] * Pos[1] + Pos[2] * Pos[2]) * 180.0);
}
https://sampforum.blast.hk/showthread.php?tid=432077
Ainda sim acho melhor fazer na public OnPlayerUpdate pra n pesar o servidor.