24.11.2013, 15:59
The id you typed was an invalid player (INVALID_PLAYER_ID = 65535).
Basically, before you pass values such as players' ID in array make sure that the player is valid first. You do but after accessing the invalid index.
Basically, before you pass values such as players' ID in array make sure that the player is valid first. You do but after accessing the invalid index.
pawn Код:
COMMAND:report(playerid,params[]) //level0
{
new player, reason[128];
if(sscanf(params, "rs[128]", player, reason)) return GameTextForPlayer(playerid, "~g~/report ~w~<id/name> <reason>", 3000, 3);
if(player == INVALID_PLAYER_ID || player == playerid || PlayerInfo[player][AdminLevel] != 0) return GameTextForPlayer(playerid, "~r~Player is unavailable", 3000, 3);
if(strlen(reason) < 2) return GameTextForPlayer(playerid, "~r~Write a valid reason", 3000, 3);
PlayerInfo[player][ReportCount]++;
new hour,minute,second, string[128];
gettime(hour,minute,second);
format(string, sizeof(string), "[REPORT]: %s(%d) has reported %s(%d) (Reason: %s) |@%d:%d:%d|", GetName(playerid), playerid, GetName(player), player, reason, hour, minute, second);
AdminMSG(RED,string);
format(string, sizeof(string), "Report(%d:%d:%d): %s(%d) reported %s(%d) Reason: %s", hour, minute, second, GetName(playerid), playerid, GetName(player), player, reason);
for(new i = 1; i < MAX_REPORTS-1; i++) Reports[i] = Reports[i+1];
Reports[MAX_REPORTS-1] = string;
GameTextForPlayer(playerid, "~g~Report has been sent", 3000, 3);
return 1;
}