11.12.2014, 03:07
Creating a /mute command, everything is fine so far but for some reason it keeps telling me it's not an array or too many subscripts. Not sure what I'm doing wrong, could someone please help me?
Heres the enum
The CMD
Any help would be greatly appreciated, thanks!
pawn Код:
C:\Documents and Settings\Vicki\Desktop\josh\SCRIPTING\TDM\gamemodes\LSGW.pwn(336) : error 028: invalid subscript (not an array or too many subscripts): "pMuted"
C:\Documents and Settings\Vicki\Desktop\josh\SCRIPTING\TDM\gamemodes\LSGW.pwn(336) : warning 215: expression has no effect
C:\Documents and Settings\Vicki\Desktop\josh\SCRIPTING\TDM\gamemodes\LSGW.pwn(336) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Vicki\Desktop\josh\SCRIPTING\TDM\gamemodes\LSGW.pwn(336) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Vicki\Desktop\josh\SCRIPTING\TDM\gamemodes\LSGW.pwn(336) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
4 Errors.
pawn Код:
enum PlayerInfo
{
pPass,
pCash,
pAdmin,
pKills,
pDeaths,
pTeam,
Banned,
TimesBanned,
pMuted,
}
new PlayerStat[MAX_PLAYERS][PlayerInfo];
pawn Код:
forward unmuteTimer(playerid);
public unmuteTimer(playerid)
{
pMuted[playerid] = 0; return SendClientMessage(playerid, -1, "You are no longer muted!"); //this is where the error occurs... It's happening for every stat I try to create for the player, whether it's [TimesBanned] or anything.. same problem
pawn Код:
CMD:mute(playerid, params[])
{
new id, reason[80], minutes, string[128];
if(IsPlayerAdmin(playerid < 1 ))
if(sscanf(params, "uis[80]", id, minutes, reason)) SendClientMessage(playerid,0xFFFF0000,"Usage: /mute [playerid/name] [time] [reason]");
if(id == playerid) SendClientMessage(playerid,RED,"You cannot use this command on yourself!");
if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) SendClientMessage(playerid,RED,"Player not found!");
if(time == 0) //perm mute
{
format(string, sizeof(string), "~ %s has been muted. Reason: '%s' ", GetICName(id), minutes, reason);
pMuted[id] = 1; //if I delete the timer, I get the same error
}
else
{
format(string, sizeof(string), "~ %s has been muted for %i minutes. Reason: '%s' ", GetICName(id), minutes, reason);
pMuted[id] = 1; //if I get rid of "pMuted" above, I get the error here instead
SetTimerEx("unmuteTimer", 60*1000*minutes, false, "i", id);
}
SendClientMessageToAll(YELLOW, string);
print(string);
return 1;
}