/mute problem
#1

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?

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.
Heres the enum
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
The CMD
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;
}
Any help would be greatly appreciated, thanks!
Reply
#2

You are using it wrong sir.
Its PlayerStat[playerid][pMuted], not pMuted[playerid].
PHP код:
forward unmuteTimer(playerid);
public 
unmuteTimer(playerid)
{
     
PlayerStat[playerid][pMuted] = 0; return SendClientMessage(playerid, -1"You are no longer muted!"); 
Change for the rest too.. Have a good day sir.

This tutorial taught me better use of Enumerators, this will help you too. https://sampforum.blast.hk/showthread.php?tid=318307
Reply
#3

Quote:
Originally Posted by Mic_H
Посмотреть сообщение
You are using it wrong sir.
Its PlayerStat[playerid][pMuted], not pMuted[playerid].
PHP код:
forward unmuteTimer(playerid);
public 
unmuteTimer(playerid)
{
     
PlayerStat[playerid][pMuted] = 0; return SendClientMessage(playerid, -1"You are no longer muted!"); 
Change for the rest too.. Have a good day sir.

This tutorial taught me better use of Enumerators, this will help you too. https://sampforum.blast.hk/showthread.php?tid=318307
Of course sir, thank you... But now I'm getting an argument type mismatch on these lines
pawn Код:
if(id == playerid) return SendClientMessage(playerid, RED,"You cannot use this command on yourself!");
    if(id == INVALID_PLAYER_ID) SendClientMessage(playerid,RED,"Player not found!");
Код:
C:\Documents and Settings\Vicki\Desktop\josh\SCRIPTING\TDM\gamemodes\LSGW.pwn(382) : error 035: argument type mismatch (argument 2)
C:\Documents and Settings\Vicki\Desktop\josh\SCRIPTING\TDM\gamemodes\LSGW.pwn(383) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#4

It has something to do with your:
PHP код:
#define RED 
Its most prolly defined as
PHP код:
#define RED "0xFF0000"//Or w/e :P 
It should be
PHP код:
#define RED 0xFF0000//Simila 
Reply
#5

Cheers man there was a problem with all the colours and it was causing me a lot of errors, but I've fixed it now. Rep+
Reply
#6

Have a good day..
Reply


Forum Jump:


Users browsing this thread: