Riferimento: Playercash dentro FS
Se noti bene il codice, la textdraw richiama un altra procedura che sarebbe GetVehicleVelocity, invece l'arizona GetPlayerSpeed.
Incollami il codice del GetVehicleVelocity così posso valutarli entrambi
i primi due codici sono dell'arizona con tutti i calcoli per mostrare la velocità tramite textdraw, io vorrei editare uno dei due (penso sia il secondo che fa mostrare la velocità tramite texdraw) con i calcoli del terzo codice che a mio parere sono più reali.
Probabilmente ho copiato male il secondo codice (pawno a volte sbaglia con i copia incolla ora lo riposto)
public Speedometer(playerid)
{
new State = GetPlayerState(playerid);
if(State == PLAYER_STATE_DRIVER && IsPlayerInAnyVehicle(playerid))
{
if(Contachilometri[playerid][ShowSpeed] == 1)
{
new string[256], Float:health;
new vehicleid = GetPlayerVehicleID(playerid);
GetVehicleHealth(vehicleid, health);
new Float:svx[MAX_PLAYERS];
new Float:svy[MAX_PLAYERS];
new Float:svz[MAX_PLAYERS];
new Float:s1[MAX_PLAYERS];
new s2[MAX_PLAYERS];
GetVehicleVelocity(GetPlayerVehicleID(playerid), svx[playerid], svy[playerid], svz[playerid]);
s1[playerid] = floatsqroot(((svx[playerid]*svx[playerid])+(svy[playerid]*svy[playerid]))+(svz[playerid]*svz[playerid]))*100;
s2[playerid] = floatround(s1[playerid],floatround_round);
new Sspeed[15];
if( s2[playerid] == 0) {
format(Sspeed,sizeof(Sspeed),"~w~%d Km/h", s2[playerid]);
} else if( s2[playerid] >= 1 && s2[playerid] < 100 ){
format(Sspeed,sizeof(Sspeed),"~g~%d Km/h", s2[playerid]);
} else if( s2[playerid] >= 100 && s2[playerid] < 140 ){
format(Sspeed,sizeof(Sspeed),"~Y~%d Km/h", s2[playerid]);
} else {
format(Sspeed,sizeof(Sspeed),"~R~%d Km/h",s2[playerid]);
}
format(string,sizeof(string),"~p~Auto:~n~~w~%s~n~~p~Velocita: %s~n~~p~Benzina: ~w~%d~n~~p~Vita: ~W~%.1f~n~~p~Localita:~n~~w~%s" ,VehiclesName[GetVehicleModel(vehicleid)-400], Sspeed, Fuel[vehicleid], health/10, ReturnPlayerZone(playerid));
TextDrawSetString(Contachilometri[playerid][Speedom], string);
TextDrawShowForPlayer(playerid, Contachilometri[playerid][Speedom]);
} else { TextDrawHideForPlayer(playerid, Contachilometri[playerid][Speedom]); Contachilometri[playerid][ShowSpeed] = 0; }
}
return true;