16.04.2016, 07:22
PHP код:
public Speedo()
{
for(new playerid=0;playerid<MAX_PLAYERS;playerid++)
{
if(IsPlayerConnected(playerid) && IsPlayerInAnyVehicle(playerid))
{
//CHECAR VELOCIDADE
new string[228];
format(string,sizeof(string),"%02d Km/H",GetVehicleSpeed(playervehicle));
TextDrawSetString(Text:Textdraw91, string);
TextDrawShowForPlayer(playerid, Textdraw91);
//CHECAR LATARIA
GetVehicleHealth(GetPlayerVehicleID(playerid), Lataria);
format(string,sizeof(string),"Lataria: %0.0f%%", Lataria);
TextDrawSetString(Textdraw131, string);
//CHECAR VEICULO
format(string,sizeof(string),"Veiculo: %s", Veiculos[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
TextDrawSetString(Textdraw141, string);
// Checar gasolina
format(string,sizeof(string),"Gasolina: %d%", Gas[GetPlayerVehicleID(playerid)]);
TextDrawSetString(Textdraw101, string);
}
}
}
stock GetVehicleSpeed(vehicleid)
{
new Float:xPos[3];
GetVehicleVelocity(vehicleid, xPos[0], xPos[1], xPos[2]);
return floatround(floatsqroot(xPos[0] * xPos[0] + xPos[1] * xPos[1] + xPos[2] * xPos[2]) * 170.00);
}