Getting "error 028 .."
#1

Hello,today i was trying to use this command on my script and i get the errors :
Код:
: error 028: invalid subscript (not an array or too many subscripts): "weapons"
 : warning 215: expression has no effect
 : error 001: expected token: ";", but found "]"
 : error 029: invalid expression, assumed zero
 : fatal error 107: too many error messages on one line
Here is the command :

Код:
 CMD:listguns(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 2)
	{
		new string[128], giveplayerid;
		if(sscanf(params, "i", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /listguns [playerid]");

		if(IsPlayerConnected(giveplayerid))
		{
			new weapons[13][2], weaponname[50];
			if(GetPVarInt(giveplayerid, "EventToken") != 0 || GetPVarInt(giveplayerid, "IsInArena") >= 0)
			{
				SendClientMessageEx(playerid, COLOR_GRAD2, "That player is at an event/paintball so the weapons may appear as non-server sided.");
			}
			SendClientMessageEx(playerid, COLOR_GREEN,"_______________________________________");
			format(string, sizeof(string), "Weapons on %s:", GetPlayerNameEx(giveplayerid));
			SendClientMessageEx(playerid, COLOR_WHITE, string);
			for (new i = 0; i < 13; i++)
			{
				GetPlayerWeaponData(giveplayerid, i, weapons[i][0], weapons[i][1]);
				if(weapons[i][0] > 0)
				{
					if(PlayerInfo[giveplayerid][pGuns][i] == weapons[i][0])
					{
						GetWeaponName(weapons[i][0], weaponname, sizeof(weaponname));
						format(string, sizeof(string), "Name: %s, Ammo: %d (ID %d).", weaponname, weapons[i][1], weapons[i][0]);
						SendClientMessageEx(playerid, COLOR_GRAD1, string);
					}
					else
					{
						GetWeaponName(weapons[i][0], weaponname, sizeof(weaponname));
						format(string, sizeof(string), "Name: %s, Ammo: %d (ID %d) (non server-side).", weaponname, weapons[i][1], weapons[i][0]);
						SendClientMessageEx(playerid, COLOR_GRAD1, string);
					}
				}
			}
			SendClientMessageEx(playerid, COLOR_GREEN,"_______________________________________");
		}
		else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
	}
	return 1;
}
Script is from Godfather i believe.
Thank you
Reply
#2

You don't have the "weapons" array defined. If you copied that snippet, copy the definition as well
Reply
#3

Quote:
Originally Posted by Misiur
Посмотреть сообщение
You don't have the "weapons" array defined. If you copied that snippet, copy the definition as well
I don't think there is other definition for this other than :

Код:
new weapons[13][2], weaponname[50];
Reply
#4

Oh, right, sorry. Hm, the code is correct and doesn't give me the warning. Anybody else any ideas?
Reply
#5

Bump
Reply
#6

Show the lines the errors coming from specifically.
Reply
#7

Quote:
Originally Posted by Arthur Kane
Посмотреть сообщение
Show the lines the errors coming from specifically.
This one:

Код:
GetPlayerWeaponData(giveplayerid, i, weapons[i][0], weapons[i][1]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)