Код:
public Velocimetro()
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
AtualizarInfos(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))), 200.0);
new velocid;
velocid = floatround(Speed, floatround_floor);
new string[256];
new PlayerVehicleModelID = GetVehicleModel(GetPlayerVehicleID(i));
PlayerVehicleModelID -= 400;
GetPlayer2DZone(i, zone, MAX_ZONE_NAME);
format(string, 256, "~n~ ~b~ ~h~ ~h~Velocidade~n~ ~w~ %i ~b~ ~h~ ~h~Km/H ~n~~n~ ~y~ ~h~ ~h~Combustivel~n~ ~w~ ~h~ ~h~ %d Litros", velocid, dini_Int(file, "Combustivel"));
TextDrawSetString(velo[i], string);
Radar(i);
TextDrawShowForPlayer(i, velo[i]);
}
else TextDrawHideForPlayer(i, velo[i]);
}
else
{
TextDrawHideForPlayer(i, velo[i]);
}
}
}
public Radar(playerid)
{
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
new Float: X,
Float: Y,
Float: Z,
Float: Speed;
GetVehicleVelocity(GetPlayerVehicleID(playerid), X, Y, Z);
Speed = floatmul(floatsqroot(floatadd(floatadd(floatpower(X, 2), floatpower(Y, 2)), floatpower(Z, 2))), 200.0);
new velocid;
velocid = floatround(Speed, floatround_floor);
if (IsPlayerInCircle(playerid, 1554.0999755859, -1732.3000488281, 20) || IsPlayerInCircle(playerid, 1237.0999755859, -1852.3000488281, 20) || IsPlayerInCircle(playerid, 632.40002441406, -1554.5999755859, 20)
|| IsPlayerInCircle(playerid, 981.40002441406, -1400.4000244141, 20) || IsPlayerInCircle(playerid, 1147.8000488281, -1144.8000488281, 20) || IsPlayerInCircle(playerid, 1350, -1241.0999755859, 20) || IsPlayerInCircle(playerid, 1706.8000488281, -513, 20)
|| IsPlayerInCircle(playerid, 2830.3999023438, -2032.5, 20) || IsPlayerInCircle(playerid, 2077.1000976563, -1752.4000244141, 20) || IsPlayerInCircle(playerid, 2195.1000976563, -1559.1999511719, 20))
{
new string2[256];
if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if (velocid > 120)
{
if (aradar[playerid] == 0)
{
GameTextForPlayer(playerid, "~r~Radar" , 3000, 4);
format(string2, 256, "{FFFFFF}• %s, vocк exedeu o limite de velocidade permitido neste local. Seguem os dados:", aname,playerid);
SendClientMessage(playerid, 0xF47A00AA, string2);
SendClientMessage(playerid, verdel, "{FFFFFF}x Velocidade mбxima permitida: {FF0000}120 KM/H{FFFFFF}.");
format(string2, 256, "{FFFFFF}x Velocidade detectada:{FF0000} %i KM/H", velocid);
SendClientMessage(playerid, 0xF47A00AA, string2);
SendClientMessage(playerid, 0xFFFFFFAA, "{FFFFFF}x Valor da multa:{33ff33} $ 100{FFFFFF} Para pagala vб ate a DP!");
format(string2, 256, "{FF0000}(INFO){FFFFFF} No total, vocк foi pego(a) {FF0000}%d{FFFFFF} vezes.", dini_Int(file, "Multas") + 1);
SendClientMessage(playerid, 0xFFFFFFAA, string2);
SendClientMessage(playerid, 0xFFFFFFAA, "{FF0000}(INFO){FFFFFF} Ao completar {FF0000}6{FFFFFF} multas vocк perdera sua habilitaзгo");
dini_IntSet(filena(playerid), "Multas", dini_Int(file, "Multas") + 1);
if (dini_Int(filena(playerid), "Multas") >= 6)
{
dini_IntSet(filena(playerid), "HabTerrestre", 0);
dini_IntSet(filena(playerid), "SaldoBancario", dini_Int(file, "SaldoBancario") - 1000);
dini_IntSet(filena(playerid), "Multas", 0);
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
SendClientMessage(playerid, 0xFFFFFFAA, "{FF0000}(Aviso){FFFFFF} Vocк completou{FF0000} 6{FFFFFF} multas sem pagar, e perdeu sua habilitaзгo e pagou {33ff33}$ 1.000");
}
aradar[playerid] = 1;
}
}
else
{
if (aradar[playerid] == 0)
{
GameTextForPlayer(playerid, "~y~Radar" , 3000, 4);
format(string2, 256, "{FFFF99}( RADAR ) x Velocidade atual detectada:{FF0000} %iKM/H", velocid);
SendClientMessage(playerid, 0xF47A00AA, string2);
aradar[playerid] = 1;
}
}
}
}
else aradar[playerid] = 0;
}
IsPlayerInCircle(playerid, Float: x,Float: y,radius)
{
if (GetPlayerDistanceToPoint2(playerid, Float: x,Float: y) < radius)
{
return 1;
}
return 0;
}
public Hide(target)
{
return TextDrawHideForPlayer(target, MsgBox);
}
public tempo()
{
new Hour, Minute, Second;
gettime(Hour, Minute, Second);
if (Hour >= 06 && Hour <= 18)
{
SetWorldTime(12);
SetWeather(12);
}
else
{
SetWorldTime(24);
SetWeather(24);
}
}
public AllSZeroChange()
{
for (new sz = 0; sz < MAX_PLAYERS; sz++)
{
if (!IsPlayerConnected(sz)) return 0;
if (GetPlayerWeapon(sz) != SubNowWeapon[sz])
{
SubZeroOwna(sz);
}
}
return 1;
}
public HospitalRegressao(playerid)
{
new string[64];
format(string, sizeof(string), "~w~Hospital~g~ voce esta sendo tratado~w~ aguarde...%d", Contagem[playerid]);
GameTextForPlayer(playerid, string, 1500, 3);
hospital[playerid] = 0;
if(Contagem[playerid] == 0)
{
KillTimer(Contagem2[playerid]);
SpawnPlayer(playerid);
SetPlayerHealth(playerid, 100.00);
GivePlayerGrana(playerid, -100);
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, 1);
SendClientMessage(playerid, fuckercor,"{FF6600}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[ Hospital ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
SendClientMessage(playerid, Branco,"{FFFFFF}* Foi retirado de sua conta bancбria R$100,00 para pagar os tratamentos mйdicos.");
SendClientMessage(playerid, fuckercor,"{FF6600}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[ Hospital ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
}
Contagem[playerid]--;
}