What causes array must be indexed (variable "")?
#1

So I'm currently learning how to use bool,

I'm now trying to disable commands while a player is in lobby, and also when the player receives the login dialog, (Because you can press f6 to avoid the dialog(any dialog) and you get the chat bar and you can type commands such as /arena and stuff.)

So what I've added at the top of the script

Код:
new bool:Spawned[MAX_PLAYERS];
And on some few call backs such as OnPlayerConnect(and more), I've added this
Код:
Spawned[playerid] = false;
.

Now on my lobby code for example I'm experiencing this error:

Код:
C:\Users\yan\Desktop\SA-MP Server\gamemodes\DBv1.pwn(620) : error 033: array must be indexed (variable "Spawned")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
and Here's the line:

Код:
  {
    if(Spawned == false) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) You can't use any commands while in lobby, Type /back.");
  }
Full code:

Код:
CMD:lobby(playerid,params[])
{
  PlayerTotalKills[playerid] = 0; // variable that setts the current player's killing spree to 0.
  AFK[playerid] = false;
  AFK[playerid] = 0;
  new interiorID = GetPlayerInterior(playerid);
  new Float:health;
  GetPlayerHealth(playerid, health);
  if(health  > 90)
  {
	 SetPlayerPos(playerid, -975.975708,1060.983032,1345.671875);
	 SetPlayerInterior(playerid,10);
	 SetPlayerVirtualWorld(playerid,10);
	 SetPlayerHealth(playerid, 9999);
	 ResetPlayerWeapons(playerid);
	 SendClientMessage(playerid, -1, "{EFB509}(INFO) You have teleported to the lobby! In order to go back use /back.");
	 AFKTime[playerid] = false;
  }
  else
  {
    if(interiorID == 0) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) Atleast 90hp is required in order to go to lobby.");
  }
  {
    if(interiorID == 10) return SendClientMessage(playerid, -1, "{c3c3c3}You are already in the lobby! Use /back to return playing.");
  }
  {
    if(Spawned == false) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) You can't use any commands while in lobby, Type /back.");
  }
  return 1;
}
Reply


Messages In This Thread
What causes array must be indexed (variable "")? - by ivndosos - 26.01.2018, 09:31
Re: What causes array must be indexed (variable "")? - by Misiur - 26.01.2018, 09:33
Re: What causes array must be indexed (variable "")? - by ivndosos - 26.01.2018, 09:58
Re: What causes array must be indexed (variable "")? - by Osamakurdi - 26.01.2018, 10:07
Re: What causes array must be indexed (variable "")? - by ivndosos - 26.01.2018, 10:10
Re: What causes array must be indexed (variable "")? - by BulletRaja - 26.01.2018, 10:22

Forum Jump:


Users browsing this thread: 3 Guest(s)