SA-MP Forums Archive
[Error 010][Array] Invalid function or declaration - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Error 010][Array] Invalid function or declaration (/showthread.php?tid=111276)



[Error 010][Array] Invalid function or declaration - FoxtrotZulu - 30.11.2009

Hey everyone. I'm a new Pawn scripter here. Can someone please tell me what's wrong with this code:

Код:
new aClassTeam[288];
aClassTeam[163] = 0;
aClassTeam[164] = 0;
aClassTeam[165] = 0;
aClassTeam[166] = 0;
aClassTeam[280] = 0;
aClassTeam[281] = 0;
aClassTeam[282] = 0;
aClassTeam[283] = 0;
aClassTeam[284] = 0;
aClassTeam[285] = 0;
aClassTeam[286] = 0;
aClassTeam[287] = 0;
It returns this error upon attempting to compile:
Quote:

error 010: invalid function or declaration

Thank you.


Re: [Error 010][Array] Invalid function or declaration - dice7 - 30.11.2009

You can only perform function/variable declarations outside functions
Just do
pawn Код:
new aClassTeam[288];
public OnGameModeInit()
{
  aClassTeam[163] = 0;
  aClassTeam[164] = 0;
  aClassTeam[165] = 0;
  aClassTeam[166] = 0;
  aClassTeam[280] = 0;
  aClassTeam[281] = 0;
  aClassTeam[282] = 0;
  aClassTeam[283] = 0;
  aClassTeam[284] = 0;
  aClassTeam[285] = 0;
  aClassTeam[286] = 0;
  aClassTeam[287] = 0;
  return 1;
}



Re: [Error 010][Array] Invalid function or declaration - KingHual - 20.07.2010

Yeah I have the same problem how can I fix it ?

Код:
if (GetPlayerSkin(playerid) == 164)
  {
    if(pickupid == bomb)
	{
	SendClientMessage(playerid, 0xFFFFFFAA, "You have returned the bomb!");
	DestroyPickup(bomb);
 	for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
	if(GetPlayerTeam(i) == 1)
	{
	SendClientMessage(playerid, 0xC2A2DAAA, "The Bomb has been returned. You have won $10 000!");
	GivePlayerMoney(playerid, 10000);
	}
	if(GetPlayerTeam(i) == 3)
	{
	SendClientMessage(playerid, 0xC2A2DAAA, "The Bomb has been returned. You have lost $5 000!");
	GivePlayerMoney(playerid, -5000);
	}
	}
	}
	return 0;
	}
	}
 }