12/05/2024 20:17
O velocimetro n ta dando nenhum erro porém o velocimetro não roda ele só fica no 0
Código PHP:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if (newstate == PLAYER_STATE_DRIVER)
{
Timer_Velo = SetTimer("KMH", 10, true);
for (new i = 0; i < sizeof(velocimetro); i++) PlayerTextDrawShow(playerid, velocimetro[playerid][i]);
}
if (oldstate == PLAYER_STATE_DRIVER)
{
KillTimer(Timer_Velo);
for (new i = 0; i < sizeof(velocimetro); i++) PlayerTextDrawHide(playerid, velocimetro[playerid][i]);
}
return 1;
}
Código PHP:
stock GetPlayerSpeed(vehicleid)
{
new Float:x, Float:y, Float:z;
GetVehicleVelocity(vehicleid, x, y, z);
return floatround(floatsqroot(x * x + y * y + z * z) * 170);
}
forward KMH(playerid, vehicleid);
public KMH(playerid, vehicleid)
{
new Str[80];
format(Str, sizeof(Str), "%d", GetPlayerSpeed(vehicleid));
PlayerTextDrawSetString(playerid, velocimetro[playerid][1], Str);
}