Hello, what's wrong here? When I am not a cop it's okay it says "You're not a cop" when you are not on duty it's also okay. But when you are on duty it says Undefined command
Код:
CMD:speedgun(playerid,params[])
{
if(!IsACop(playerid)) return SendClientMessage(playerid, COLOR_ERROR, "You are not a cop!");
if(copduty[playerid] == 0) return SendClientMessage(playerid, COLOR_ERROR, "You are not on duty!");
new string[256];
for(new i = 0; i < MAX_PLAYERS; i++)
{
new vehicleid,Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,final_speed_int;
vehicleid = GetPlayerVehicleID(i);
GetVehicleVelocity(vehicleid, speed_x, speed_y, speed_z);
final_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*86.4166672;
final_speed_int = floatround(final_speed, floatround_round);
format(string, sizeof(string), "%s\n%s - %d MPH\n", string, GetVehicleName(vehicleid), final_speed_int);
}
ShowPlayerDialog(playerid, DIALOG_SPEEDGUN, DIALOG_STYLE_LIST, "Speed Gun", string, "OK", "");
return 1;
}
Код:
if(PlayerInfo[pcopduty] == 0) return SendClientMessage(playerid, COLOR_ERROR, "You are not on duty!");
Or [copduty]
Try replacing "GetVehicleName(vehicleid)" with "GetVehicleName(GetVehicleModel(vehicleid))".