public Velocimetro()
{
foreach(Player, i)
{
new aname[MAX_PLAYER_NAME];
GetPlayerName(i, aname, MAX_PLAYER_NAME);
if(IsPlayerInAnyVehicle(i)) {
new Float:X, Float:Y, Float:Z, Float:Speed;
GetVehicleVelocity(GetPlayerVehicleID(i), X, Y, Z);
Speed = floatmul(floatsqroot(floatadd(floatadd(floatpower(X, 2), floatpower(Y, 2)), floatpower(Z, 2))), 170.0);
new Float:vcarro;
GetVehicleHealth(GetPlayerVehicleID(i), vcarro);
new velocid;
velocid = floatround(Speed, floatround_floor);
new string[128];
new PlayerVehicleModelID = GetVehicleModel(GetPlayerVehicleID(i));
PlayerVehicleModelID -= 400;
new ncarro[30];
if(velocid == 300){
SetTimerEx("remove it", 1000, false, "i", i);
}
if(velocid == 350){
SetTimerEx("remove it", 1000, false, "i", i);
}
if(velocid == 380){
SetTimerEx("remove it", 1000, false, "i", i);
}
if(velocid > 385){
SetTimerEx("banspeed", 100, false, "i", i);
}
format(ncarro,30,PlayerVehicle[PlayerVehicleModelID]);
GetPlayer2DZone(i, zone, MAX_ZONE_NAME);
format(string, 128,"%i",velocid); //~y~Km/h
TextDrawSetString(velo[i],string);
// PLAYER VEHICLE
format(ncarro,30,PlayerVehicle[PlayerVehicleModelID]);
GetPlayer2DZone(i, zone, MAX_ZONE_NAME);
format(string,sizeof(string),"~b~%s",PlayerVehicle[PlayerVehicleModelID]);
TextDrawSetString(Veiculo[i], string);
// PLAYER VEHICLE
// LOCATION SPEEDOMETER
format(ncarro,30,PlayerVehicle[PlayerVehicleModelID]);
GetPlayer2DZone(i, zone, MAX_ZONE_NAME);
format(string,sizeof(string),"~w~%s", zone);
TextDrawSetString(Localidades[i], string);
// KM / H
format(ncarro,30,PlayerVehicle[PlayerVehicleModelID]);
GetPlayer2DZone(i, zone, MAX_ZONE_NAME);
format(string,sizeof(string),"~y~KM/H"); //~y~~i~/~y~
TextDrawSetString(Kmh, string);
Radar(i);
TextDrawShowForPlayer(i, velo[i]);
TextDrawShowForPlayer(i, Veiculo[i]);
TextDrawShowForPlayer(i, Localidades[i]);
TextDrawShowForPlayer(i, Kmh);
}else{
TextDrawHideForPlayer(i, velo[i]),TextDrawHideForPlayer(i, Veiculo[i]),TextDrawHideForPlayer(i, Kmh),TextDrawHideForPlayer(i, Localidades[i]);
}
}
return 1;
}
public Velocimetro()
{
foreach(Player, i)
{
new aname[MAX_PLAYER_NAME];
GetPlayerName(i, aname, MAX_PLAYER_NAME);
if(IsPlayerInAnyVehicle(i) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new Float:X, Float:Y, Float:Z, Float:Speed;
GetVehicleVelocity(GetPlayerVehicleID(i), X, Y, Z);
Speed = floatmul(floatsqroot(floatadd(floatadd(floatpower(X, 2), floatpower(Y, 2)), floatpower(Z, 2))), 170.0);
new Float:vcarro;
GetVehicleHealth(GetPlayerVehicleID(i), vcarro);
new velocid;
velocid = floatround(Speed, floatround_floor);
new string[128];
new PlayerVehicleModelID = GetVehicleModel(GetPlayerVehicleID(i));
PlayerVehicleModelID -= 400;
new ncarro[30];
if(velocid == 300)
{
SetTimerEx("remove it", 1000, false, "i", i);
}
if(velocid == 350)
{
SetTimerEx("remove it", 1000, false, "i", i);
}
if(velocid == 380)
{
SetTimerEx("remove it", 1000, false, "i", i);
}
if(velocid > 385)
{
SetTimerEx("banspeed", 100, false, "i", i);
}
format(ncarro,30,PlayerVehicle[PlayerVehicleModelID]);
GetPlayer2DZone(i, zone, MAX_ZONE_NAME);
format(string, 128,"%i",velocid); //~y~Km/h
TextDrawSetString(velo[i],string);
// PLAYER VEHICLE
format(ncarro,30,PlayerVehicle[PlayerVehicleModelID]);
GetPlayer2DZone(i, zone, MAX_ZONE_NAME);
format(string,sizeof(string),"~b~%s",PlayerVehicle[PlayerVehicleModelID]);
TextDrawSetString(Veiculo[i], string);
// PLAYER VEHICLE
// LOCATION SPEEDOMETER
format(ncarro,30,PlayerVehicle[PlayerVehicleModelID]);
GetPlayer2DZone(i, zone, MAX_ZONE_NAME);
format(string,sizeof(string),"~w~%s", zone);
TextDrawSetString(Localidades[i], string);
// KM / H
format(ncarro,30,PlayerVehicle[PlayerVehicleModelID]);
GetPlayer2DZone(i, zone, MAX_ZONE_NAME);
format(string,sizeof(string),"~y~KM/H"); //~y~~i~/~y~
TextDrawSetString(Kmh, string);
Radar(i);
TextDrawShowForPlayer(i, velo[i]);
TextDrawShowForPlayer(i, Veiculo[i]);
TextDrawShowForPlayer(i, Localidades[i]);
TextDrawShowForPlayer(i, Kmh);
}else{
TextDrawHideForPlayer(i, velo[i]),TextDrawHideForPlayer(i, Veiculo[i]),TextDrawHideForPlayer(i, Kmh),TextDrawHideForPlayer(i, Localidades[i]);
}
}
return 1;
}
PHP код:
|