31.07.2018, 14:20
I just getting an error for trying to check if player got banned's or not.. when connected but always I got this error
Error is: error 033: array must be indexed (variable "params")
FULL COMMAND:
PHP код:
if(!isnull(params)) BannedFromServer[params] = true;
FULL COMMAND:
PHP код:
CMD:ban(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 2)
return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error: {FFFFFF}Wrong command!! {FF0000}Check availables commands from here `{FFFFFF}/cmds{FF0000}`.");
new
pName[MAX_PLAYER_NAME],
tName[MAX_PLAYER_NAME],
targetid,
string[128],
reason[80]
;
if(!aDuty[playerid])
return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error: {FFFFFF}You must be ADMIN ON DUTY to kick someone.");
if(sscanf(params, "us[80]", targetid, reason))
return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ban [playerid] [reason]");
if(!IsPlayerConnected(targetid))
return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error: {FFFFFF}INVAILD PLAYER ID / NAME.");
if(PlayerInfo[playerid][pAdmin] < PlayerInfo[targetid][pAdmin])
return SendClientMessage(playerid, COLOR_GREY, "{FF0000}Error: {FFFFFF}Player has a higher admin level than you. [CAN'T BANNED]!");
if(!isnull(params)) BannedFromServer[params] = true;
GetPlayerName(playerid,pName,sizeof(pName));
GetPlayerName(targetid,tName,sizeof(tName));
format(string, sizeof(string), "{FB00FF}[BANNED]: PLAYER %s(%d) has been BANNED by Admin %s(%d), REASON: %s.", tName,targetid, pName,playerid, reason);
SendClientMessageToAll(-1, string);
GameTextForPlayer(targetid, "~P~BANNED", 10000, 3);
SetTimerEx("Banned",5200,false,"i",targetid);
return 1;
}