Jump to content
  • 0

(576) : warning 219: local variable "rows" shadows a variable at a preceding level


star69

Question

Salut!

Am adaugat un sistem de masini personale in gamemode

imi da acest warning:

 

(576) : warning 219: local variable "rows" shadows a variable at a preceding level

la linia 576 este :

new rows = cache_num_rows(handle), count = 0, tempString[16];
public OnPlayerLoadVehicles(playerid)
{
	new rows = cache_num_rows(handle), count = 0, tempString[16];
	if(rows > 0)
	{
		new tempInt;
		for(new z = 0; z < rows; z++)
		{
			for(new i = 0; i < MAX_VEH; i++)
			{
				if(Vehicles[i][vehStatus]) continue;

				Vehicles[i][vehStatus]		= true;
				Vehicles[i][vehID]			= cache_get_field_content_int(z, "id");
				Vehicles[i][vehModel]		= cache_get_field_content_int(z, "model");
				cache_get_field_content(z, "owner", tempString);
				format(Vehicles[i][vehOwner], MAX_PLAYER_NAME, "%s", tempString);
				Vehicles[i][vehPos][0]		= cache_get_field_content_float(z, "posX");
				Vehicles[i][vehPos][1]		= cache_get_field_content_float(z, "posY");
				Vehicles[i][vehPos][2]		= cache_get_field_content_float(z, "posZ");
				Vehicles[i][vehPos][3]		= cache_get_field_content_float(z, "posA");
				Vehicles[i][vehColor][0]	= cache_get_field_content_int(z, "color1");
				Vehicles[i][vehColor][1]	= cache_get_field_content_int(z, "color2");
				Vehicles[i][vehInt]			= cache_get_field_content_int(z, "int");
				Vehicles[i][vehVW]			= cache_get_field_content_int(z, "vw");
				new a = 1;
				for(new w = 0; w < 14; w++)
				{
					format(tempString, sizeof(tempString), "mod%d", a);
					Vehicles[i][vehMods][w] = cache_get_field_content_int(z, tempString);
					a++;
				}
				tempInt	= cache_get_field_content_int(z, "locked");
				if(tempInt == 1)
					Vehicles[i][vehLock]		= true;
				else
					Vehicles[i][vehLock]		= false;
				tempInt	= cache_get_field_content_int(z, "alarm");
				if(tempInt == 1)
					Vehicles[i][vehAlarm]		= true;
				else
					Vehicles[i][vehAlarm]		= false;
				cache_get_field_content(z, "plate", tempString);
				format(Vehicles[i][vehPlate], 16, "%s", tempString);
				createVehicle(i);
				count++;
				break;
			}
		}
	}
	printf("Loaded %d vehicles from %s", count, GetName(playerid));
	return 1;
}

 

Ma poate ajuta cineva?

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Incearca asa:

public OnPlayerLoadVehicles(playerid)
{
	new raws = cache_num_rows(handle), count = 0, tempString[16];
	if(raws > 0)
	{
		new tempInt;
		for(new z = 0; z < raws; z++)
		{
			for(new i = 0; i < MAX_VEH; i++)
			{
				if(Vehicles[i][vehStatus]) continue;

				Vehicles[i][vehStatus]		= true;
				Vehicles[i][vehID]			= cache_get_field_content_int(z, "id");
				Vehicles[i][vehModel]		= cache_get_field_content_int(z, "model");
				cache_get_field_content(z, "owner", tempString);
				format(Vehicles[i][vehOwner], MAX_PLAYER_NAME, "%s", tempString);
				Vehicles[i][vehPos][0]		= cache_get_field_content_float(z, "posX");
				Vehicles[i][vehPos][1]		= cache_get_field_content_float(z, "posY");
				Vehicles[i][vehPos][2]		= cache_get_field_content_float(z, "posZ");
				Vehicles[i][vehPos][3]		= cache_get_field_content_float(z, "posA");
				Vehicles[i][vehColor][0]	= cache_get_field_content_int(z, "color1");
				Vehicles[i][vehColor][1]	= cache_get_field_content_int(z, "color2");
				Vehicles[i][vehInt]			= cache_get_field_content_int(z, "int");
				Vehicles[i][vehVW]			= cache_get_field_content_int(z, "vw");
				new a = 1;
				for(new w = 0; w < 14; w++)
				{
					format(tempString, sizeof(tempString), "mod%d", a);
					Vehicles[i][vehMods][w] = cache_get_field_content_int(z, tempString);
					a++;
				}
				tempInt	= cache_get_field_content_int(z, "locked");
				if(tempInt == 1)
					Vehicles[i][vehLock]		= true;
				else
					Vehicles[i][vehLock]		= false;
				tempInt	= cache_get_field_content_int(z, "alarm");
				if(tempInt == 1)
					Vehicles[i][vehAlarm]		= true;
				else
					Vehicles[i][vehAlarm]		= false;
				cache_get_field_content(z, "plate", tempString);
				format(Vehicles[i][vehPlate], 16, "%s", tempString);
				createVehicle(i);
				count++;
				break;
			}
		}
	}
	printf("Loaded %d vehicles from %s", count, GetName(playerid));
	return 1;
}

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.