SA-MP Forums Archive
How to Fix this small Bug? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to Fix this small Bug? (/showthread.php?tid=272857)



How to Fix this small Bug? - Harry_Sandhu - 30.07.2011

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.


Re: How to Fix this small Bug? - PGTips - 30.07.2011

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


Re: How to Fix this small Bug? - Harry_Sandhu - 30.07.2011

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

NO ERRORS & NO WARNINGS ARE THERE.


Re: How to Fix this small Bug? - Lorenc_ - 30.07.2011

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


Re: How to Fix this small Bug? - Harry_Sandhu - 30.07.2011

Can you tell me with the pwn Code.


Re: How to Fix this small Bug? - [L3th4l] - 30.07.2011

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.");
}



Re: How to Fix this small Bug? - PGTips - 30.07.2011

pre solved by Leathal


Re: How to Fix this small Bug? - Harry_Sandhu - 30.07.2011

Not working it dont send the message to all


Re: How to Fix this small Bug? - Calgon - 30.07.2011

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)



Re: How to Fix this small Bug? - Harry_Sandhu - 30.07.2011

Thanks a lots its working now.