How to Fix this small Bug?
#1

PWN Code.

pawn Код:
//--------------------
new OOCSTAT = 0;
//--------------------

CMD:ooc(playerid, params[])
{
    if(isnull(params))
    {
        if(OOCSTAT == 1 && PlayerInfo[playerid][pAdmin] < 1)
        {
            new name[MAX_PLAYER_NAME], string[128];
            GetPlayerName(playerid, name, sizeof(name));
            format(string, sizeof(string),"(( [OOC] %s: %s ))", name, params);
            SendClientMessageToAll(0xD4FFFF89, string);
        }
        else SendClientMessage(playerid, ERROR,"OOC chat is Disabled");
    }
    else SendClientMessage(playerid, ERROR,"Usage: /[o]oc [Message]");
    return 1;
}
CMD:noooc(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 3 && (!OOCSTAT))
    {
        OOCSTAT = 1;
        SendClientMessageToAll(ERROR,"OOC chat channel has been enabled by an admin.");
    }
    else if(PlayerInfo[playerid][pAdmin] >= 3 && (OOCSTAT))
    {
        OOCSTAT = 0;
        SendClientMessageToAll(ERROR,"OOC chat channel has been disabled by an admin.");
    }
    else SendClientMessage(playerid, ERROR,"You are not authorized to use that command.");
    return 1;
}

Its not Working properly i cant Speak there.

Sorry for the BBCODE in it.
Reply
#2

Ok heres a couple of Tips

Put Pawn code in [pawn] so we an read it

and explain your problem otherwise we cannot help also look inside your Compiler send us any warnings
Reply
#3

The problem is that when we do /ooc [message] it says that OOC chat is Disabled.

NO ERRORS & NO WARNINGS ARE THERE.
Reply
#4

Doubtfully, I doubt it will do much but try replacing '(!OOCSTAT)' with OCCSTAT = 0, since it's not a boolean (Not sure if that piece of code converts an INT to BOOL
Reply
#5

Can you tell me with the pwn Code.
Reply
#6

Try this:
pawn Код:
CMD:occ(playerid, params[])
{
    if(isnull(params)) return SendClientMessage(playerid, ERROR, "Usage: /[o]oc [Message]");
    if(!OOCSTAT) return SendClientMessage(playerid, ERROR, "OOC chat is Disabled");

    if(PlayerInfo[playerid][pAdmin] < 1)
    {
        new
            iName[MAX_PLAYER_NAME],
            iStr[128];

        GetPlayerName(playerid, iName, sizeof(iName));

        format(iStr, sizeof(iStr), "(( [OOC] %s: %s ))", iName, params);
        SendClientMessageToAll(0xD4FFFF89, iStr);
    }
    return 1;
}

CMD:noooc(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 3)
    {
        if(OOCSTAT)
        {
            OOCSTAT = 0;
            SendClientMessageToAll(ERROR, "OOC chat channel has been disabled by an admin.");
        }
        else
        {
            OOCSTAT = 1;
            SendClientMessageToAll(ERROR, "OOC chat channel has been enabled by an admin.");
        }
    }
    else return SendClientMessage(playerid, ERROR, "You are not authorized to use that command.");
}
Reply
#7

pre solved by Leathal
Reply
#8

Not working it dont send the message to all
Reply
#9

If you can use /noooc, then you can't use /ooc.

If you look at your logic:

pawn Код:
if(OOCSTAT == 1 && PlayerInfo[playerid][pAdmin] < 1)
You're checking if the "OOCSTAT" is 1, but if the player is lower than level 1 admin, but you're also checking in /noooc if the player has an admin level of 3 or higher.

You can fix this by changing your code in /ooc to:

pawn Код:
if(OOCSTAT == 1)
Reply
#10

Thanks a lots its working now.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)