26.01.2018, 09:31
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
And on some few call backs such as OnPlayerConnect(and more), I've added this
.
Now on my lobby code for example I'm experiencing this error:
and Here's the line:
Full code:
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];
Код:
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.
Код:
{ if(Spawned == false) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) You can't use any commands while in lobby, Type /back."); }
Код:
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; }