09.06.2012, 13:29
Ok, here is my unban command.
I get these Errors
Can someone fix this code or create me a /unabn command?
Here is the /ban command
pawn Код:
CMD:unban(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 2)
{
new string[128];
if(isnull(params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /unban [playername]");
if( PlayerInfo[MAX_PLAYERS][pBan] >= 1 )
{
PlayerInfo[MAX_PLAYERS][pBan] = 0;
print("OnPlayerOfflineLogin: Variables saved properly");
format(string, 128, "[ADMIN] %s (IP:%s) was unbanned by %s.", params, PlayerInfo[MAX_PLAYERS][pIP], GetPlayerNameEx(playerid));
SendStaffMessage(COLOR_RED,string);
new year, month,day;
getdate(year, month, day);
new playa[MAX_PLAYER_NAME];
GetPlayerName(playerid, playa, MAX_PLAYER_NAME);
format(string, sizeof(string), "[ADMIN] %s : was unbanned by %s.", params, playa);
SendStaffMessage(COLOR_RED, string);
}
else
{
SendClientMessage( playerid, COLOR_WHITE, "Not a banned account or no such account was found!" );
}
}
return 1;
}
Код:
C:\Documents and Settings\User\Desktop\GTA SA server\gamemodes\server.pwn(1398) : error 032: array index out of bounds (variable "PlayerInfo") C:\Documents and Settings\User\Desktop\GTA SA server\gamemodes\server.pwn(1400) : error 032: array index out of bounds (variable "PlayerInfo") C:\Documents and Settings\User\Desktop\GTA SA server\gamemodes\server.pwn(1402) : error 032: array index out of bounds (variable "PlayerInfo") C:\Documents and Settings\User\Desktop\GTA SA server\gamemodes\server.pwn(1515) : error 032: array index out of bounds (variable "PlayerInfo") Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors.
Here is the /ban command
pawn Код:
CMD:ban(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 2)
{
new targetid, reason;
new VBName[MAX_PLAYER_NAME];
new VBName1[MAX_PLAYER_NAME];
GetPlayerName(playerid, VBName, MAX_PLAYER_NAME);
GetPlayerName(targetid, VBName1, MAX_PLAYER_NAME);
if(sscanf(params, "ri", targetid, reason)) return SendClientMessage(playerid, COLOR_RED,"Usage: /Ban [playerid] [reason]");
if(targetid == playerid) return SendClientMessage(playerid, COLOR_RED, "You Can't Ban Yourself!");
if(PlayerInfo[targetid][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_RED, "You Can't Kick Higher Administrators!");
else
{
new str[128];
format(str, sizeof(str), "Administrator %s Has Banned %s Reason: %d!", VBName, VBName1, reason);
SendClientMessageToAll(COLOR_RED,str);
PlayerInfo[playerid][pBan] = 1;
Ban(targetid);
}
}
else return SendClientMessage(playerid, COLOR_RED, "You Need To Be A Administrator!");
return 1;
}