15.04.2016, 15:46
Can you tell me what's wrong with this command?, actually it only works with one vehicle, it's suppose to find a vehicle with their plate number.
Код:
CMD:trackcar(playerid, params[])
{
static
string[64];
if (GetFactionType(playerid) != FACTION_POLICE)
return SendErrorMessage(playerid, "You're not authorized to use this command.");
if (!IsPlayerInAnyVehicle(playerid))
return SendErrorMessage(playerid, "You're not in any vehicle.");
if (!IsACruiser(GetPlayerVehicleID(playerid)))
return SendErrorMessage(playerid, "This vehicle doesn't have a MDC.");
if (sscanf(params, "s[64]", string))
return SendSyntaxMessage(playerid, "/trackcar [platenumber]");
for (new id = 1; id < MAX_VEHICLES; id ++)
{
printf("%s", string);
if (IsValidVehicle(id))
{
if (!strcmp(CarData[id][carNumberPlate], string, true))
{
if (!strcmp(CarData[id][carNumberPlate], "Unregistered", true))
{
SendErrorMessage(playerid, "This vehicle is not registered.");
}
else
{
SendServerMessage(playerid, "The MDC Satellite System is now trying to track %s[%s]...", ReturnVehicleModelName(CarData[id][carModel]), string);
PlayerData[playerid][pMDCVehicle] = id;
PlayerData[playerid][pTrackTime] = 3;
}
printf("%s", CarData[id][carNumberPlate]);
return 1;
}
else
{
SendErrorMessage(playerid, "You have specified an invalid vehicle Number.");
return 1;
}
}
}
return 1;
}

