error 033: array must be indexed (variable "choice")
#1

Код:
CMD:pointedit(playerid, params[])
{
    if(PlayerInfo[playerid][pAdminDuty] == 0) return SendClientMessage(playerid, -1, "You must be ( /aduty ) to use this Command!");
	if(PlayerInfo[playerid][pAdmin] < 1336)
	{
		SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use this command!!");
		return 1;
	}
	new string[128], choice[32], amount;
	if(sscanf(params, "s[32]d", choice, amount))
	{
		SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /pointedit [choice] [amount]");
		SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: hours, pot, crack, materials");
		SendClientMessageEx(playerid, COLOR_GREY, "HINT: Stand close to a point to set the hours.");
		return 1;
	}
	if(strcmp(choice,"hours",true) == 0)
	{
			for(new h = 0; h < sizeof(Points); h++)
			{
				if(IsPlayerInRangeOfPoint(playerid, 3.0, Points[h][Pointx], Points[h][Pointy], Points[h][Pointz]))
				{
					if(choice < 1|| choice > 24)
					{
						SendClientMessageEx(playerid, COLOR_GREY, "You can not set the point time lower than 1 or higher than 24!");
					}
					else if(choice >= 1|| choice <= 24)
					{
						format(string, sizeof(string), "You have set this point's time to %d hours !", choice);
						Points[h][Vulnerable] = choice;
						SendClientMessageEx(playerid, COLOR_WHITE, string);
						UpdatePoints();
					}
				}
				else
      			{
				SendClientMessageEx(playerid, COLOR_WHITE, "You are not near a point");
				}
			}
		}
		else if(strcmp(choice,"pot",true) == 0)
	    {
			for(new h = 0; h < sizeof(Points); h++)
			{
			    if(IsPlayerInRangeOfPoint(playerid, 3.0, Points[h][Pointx], Points[h][Pointy], Points[h][Pointz]))
				{
					if(Points[h][Type] == 3)
					{
						Points[h][Stock] = amount;
						format(string, sizeof(string), "%s\n Owned by: %s\n Available: %d hours\nPOT AVAILABLE: %d", Points[h][Name], Points[h][Owner], Points[h][Vulnerable], Points[h][Stock]);
						UpdateDynamic3DTextLabelText(Points[h][TextLabel], COLOR_YELLOW, string);
						SendClientMessageEx(playerid, COLOR_WHITE, " You have successfully changed the Point available pot!");
						UpdatePoints();
					}
				}
				else
				{
					SendClientMessageEx(playerid, COLOR_WHITE, "You are not near a point");
				}
			}
		}
		else if(strcmp(choice,"crack",true) == 0)
		{
			for(new h = 0; h < sizeof(Points); h++)
			{
			    if(IsPlayerInRangeOfPoint(playerid, 3.0, Points[h][Pointx], Points[h][Pointy], Points[h][Pointz]))
				{
					if(Points[h][Type] == 4)
					{
						Points[h][Stock] = amount;
						format(string, sizeof(string), "%s\n Owned by: %s\n Available: %d hours\nCRACK AVAILABLE: %d", Points[h][Name], Points[h][Owner], Points[h][Vulnerable], Points[h][Stock]);
						UpdateDynamic3DTextLabelText(Points[h][TextLabel], COLOR_YELLOW, string);
						SendClientMessageEx(playerid, COLOR_WHITE, " You have successfully changed the Point available crack!");
						UpdatePoints();
					}
				}
				else
				{
					SendClientMessageEx(playerid, COLOR_WHITE, "You are not near a point");
				}
			}
		}
		else if(strcmp(choice,"materials",true) == 0)
		{
			for(new h = 0; h < sizeof(Points); h++)
			{
			    if(IsPlayerInRangeOfPoint(playerid, 3.0, Points[h][Pointx], Points[h][Pointy], Points[h][Pointz]))
				{
					if(Points[h][Type] == 1)
					{
						Points[h][Stock] = amount;
						format(string, sizeof(string), "%s\n Owned by: %s\n Available: %d hours\nMATERIALS AVAILABLE: %d", Points[h][Name], Points[h][Owner], Points[h][Vulnerable], Points[h][Stock]);
						UpdateDynamic3DTextLabelText(Points[h][TextLabel], COLOR_YELLOW, string);
						SendClientMessageEx(playerid, COLOR_WHITE, " You have successfully changed the Point available crack!");
					}
				}
				else
				{
					SendClientMessageEx(playerid, COLOR_WHITE, "You are not near a point");
				}
			}
		}
	return 1;
}
LINES THAT HAVE THIS ERROR:
Код:
if(choice < 1|| choice > 24)
Код:
else if(choice >= 1|| choice <= 24)
ANOTHER ERROR: error 006: must be assigned to an array
Код:
Points[h][Vulnerable] = choice;
Reply
#2

nvm fixed XD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)