19.02.2015, 21:45
pawn Код:
CMD:speed(playerid, params[])
{
if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
new vehicles = 0, vehicid;
if(Faction[playerid] != 1) return SendClientMessage(playerid, COLOUR_GREY, "You are not a member of the police.");
new string1[256], string2[512];
for(new vehicleid =0; vehicleid<MAX_VEHICLES; vehicleid++)
{
new Float: vPosX, Float: vPosY, Float: vPosZ;
GetVehiclePos(vehicleid, vPosX, vPosY, vPosZ);
if(IsPlayerInRangeOfPoint(playerid, 50,vPosX, vPosY, vPosZ))
{
new Float: x, Float: y, Float: z;
GetVehicleVelocity(vehicleid, x, y, z);
if(floatround(floatsqroot(((x*x)+(y*y))+(z*z))*156.666667*0.641371192) > 0)
{
Vehicles[vehicleid][vid] = vehicleid;
Vehicles[vehicleid][vmod] = GetVehicleModel(vehicleid) - 400;
Vehicles[vehicleid][vspeed] = floatround(floatsqroot(((x*x)+(y*y))+(z*z))*156.666667*0.641371192);
printf("1 vehicle");
format(string1, sizeof(string1),""COL_WHITE"%s "COL_RED"%d MPH "COL_WHITE"("COL_GREEN"%s"COL_WHITE")", VehicleNames[Vehicles[vehicleid][vmod]],Vehicles[vehicid][vspeed], VehPlate[Vehicles[vehicid][vid]]);
/*else if(vehicles > 1)
{
format(string2, sizeof(string2),"%s\nVEHICLE: "COL_GREEN"%s "COL_WHITE"SPEED: "COL_GREEN"%d MPH "COL_WHITE"LICENSE: "COL_GREEN"%s",string1, VehicleNames[Vehicles[vehicleid][vmod]],Vehicles[vehicled][vspeed], VehPlate[Vehicles[vehicleid][vid]]);
printf("format");
}
vehicles++;
*/
}
}
}
ShowPlayerDialog(playerid, DIALOG_SPEEDCHECK, DIALOG_STYLE_LIST, "VEHICLE SPEED RADAR", string1, "Close","");
return 1;
}