Command is not working
#1

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;
}
Reply


Messages In This Thread
Command is not working - by Antoniohl - 15.04.2016, 15:46
Re: Command is not working - by SyS - 15.04.2016, 16:04
Re: Command is not working - by Konstantinos - 15.04.2016, 16:08
Re: Command is not working - by SyS - 15.04.2016, 16:10
Re: Command is not working - by Antoniohl - 15.04.2016, 19:52

Forum Jump:


Users browsing this thread: 1 Guest(s)