01.09.2014, 04:48
pawn Код:
CMD:radar(playerid, params[])
{
if(IsPlayerPolice(playerid))
{
new v, Float: x, Float: y, Float: z;
while(++v < MAX_VEHICLES)
{
if(GetVehiclePos(v, x, y, z) && IsPlayerInRangeOfPoint(playerid, 30.0, x, y, z))
{
if(v != 0)
{
if(v == GetPlayerVehicleID(playerid)) continue;
new Float:speed_x, Float:speed_y, Float:speed_z, Float:final_speed, final_speed_int;
new str[64];
GetVehicleVelocity(v,speed_x,speed_y,speed_z);
final_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*90;
final_speed_int = floatround(final_speed,floatround_round);
if(final_speed_int > 0)
{
format(str, sizeof(str), "(RADAR) %s: %i mph", GetVehicleName(v), final_speed_int);
SendClientMessage(playerid, COLOR_YELLOW, str);
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, "(RADAR) No vehicles in range.");
print("final_speed_int > 0");
}
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, "(RADAR) No vehicles in range.");
}
}
}
}
return 1;
}