[Error 010][Array] Invalid function or declaration
#1

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.
Reply
#2

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)