SA-MP Forums Archive
OOC Disable command - 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: OOC Disable command (/showthread.php?tid=269211)



OOC Disable command - Compton - 15.07.2011

Hello, well im making a RPG script(all from start)

I just need to add 3 more things to get the server up for Roleplay, and here is one of them things, I really need a OOC Disable command but I dont understand how to add it, maybe someone could help me?

OOC:

Код:
// OOC
    if(!strcmp(cmdtext, "/ooc", true,4)){
    if(!strlen(cmdtext[4])) SendClientMessage(playerid, 0xffffffff, "USAGE: /ooc [text]");
    else {
        new tmp[192];
        GetPlayerName(playerid,tmp,24);
        format(tmp,192,"((OOC - %s: %s))",tmp,cmdtext[5]);
        SendClientMessageToAll(0xFFFFFFAA,tmp);
        print(tmp);
    }
    return 1;
 }



Re: OOC Disable command - Yakushi Icefox - 15.07.2011

At the top of the GM, below the "#endif" line, add this:

pawn Код:
new bool:OOCenable = true;
This is a simples flag (boolean) to determine if the OOC is enabled or not.

Then, at the "/ooc" command, add this line:

pawn Код:
if(!OOCenable) return SendClientMessage(playerid, 0xffffffff, "ERROR: OOC disabled by Admin.");
Then, you make you command to disable / enable the OOC, with strcmp, sscanf, or what are you using, the important is:

pawn Код:
OOCenable = true; //Will enable OOC.
OOCenable = false; //Will turn off OOC.
Sorry for my bad english, pal.


Re: OOC Disable command - Compton - 15.07.2011

If only I was such a good scripter to make the command, I doubt i will sucseed xD

But atleast thanks for this


Re: OOC Disable command - Adil - 15.07.2011

pawn Код:
if(!strcmp(cmdtext, "/toggleooc", true,10))
{
    if(!IsPlayerAdmin(playerid))//or whatever your admin variable is
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "You are not an admin");
        return 1;
    }
    if(ToggleOOC == 1)
    {
        ToggleOOC = 0;
        SendClientMessageToAll(playerid, 0xFFFFFFFF, "Global OOC chat has been disabled");
    }
    else
    {
        ToggleOOC = 1;
        SendClientMessageToAll(playerid, 0xFFFFFFFF, "Global OOC chat has been enabled");
    }
    return 1;
}
pawn Код:
if(!strcmp(cmdtext, "/ooc", true,4)){
    if(ToggleOOC == 0)
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "Global OOC chat has been disabled");
        return 1;
    }
    if(!strlen(cmdtext[4])) SendClientMessage(playerid, 0xffffffff, "USAGE: /ooc [text]");
    else {
        new tmp[192];
        GetPlayerName(playerid,tmp,24);
        format(tmp,192,"((OOC - %s: %s))",tmp,cmdtext[5]);
        SendClientMessageToAll(0xFFFFFFAA,tmp);
        print(tmp);
    }
    return 1;
 }
(Late reply)


Re: OOC Disable command - Compton - 15.07.2011

Код:
D:\Compton City Roleplay\gamemodes\CPT.pwn(1155) : error 035: argument type mismatch (argument 2)
D:\Compton City Roleplay\gamemodes\CPT.pwn(1160) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Here are the lines:


Код:
ToggleOOC = 0;
        SendClientMessageToAll(playerid, 0xFFFFFFFF, "Global OOC chat has been disabled");
    }
    else
    {
        ToggleOOC = 1;
    	SendClientMessageToAll(playerid, 0xFFFFFFFF, "Global OOC chat has been enabled");
I dont really understand whats the Prob. (soz im a nab in this still)


Re: OOC Disable command - Yakushi Icefox - 15.07.2011

Take off the "playerid". If the SendClientMessage is to all, why would it require a playerid? LOL.


Re: OOC Disable command - Compton - 15.07.2011

You know guys, this might sound strange and wrong but... I LOVE YALL xD

Big thanks to all who helped all works fine


Re: OOC Disable command - [MG]Dimi - 15.07.2011

Quote:
Originally Posted by Yakushi Icefox
Посмотреть сообщение
Take off the "playerid". If the SendClientMessage is to all, why would it require a playerid? LOL.
Coz it's sending message to player who has typed /ooc -.-


Re: OOC Disable command - Yakushi Icefox - 15.07.2011

Quote:
Originally Posted by [MG]Dimi
Посмотреть сообщение
Coz it's sending message to player who has typed /ooc -.-
I don't think you got it right.

pawn Код:
SendClientMessageToAll(playerid, 0xFFFFFFFF, "Global OOC chat has been enabled");
SendClientMessageToAll. You are sending a Message to ALL the players on the server. Why the hell would it require a ID?


Re: OOC Disable command - Adil - 15.07.2011

Quote:
Originally Posted by Yakushi Icefox
Посмотреть сообщение
Take off the "playerid". If the SendClientMessage is to all, why would it require a playerid? LOL.
I changed SendClientMessage() to SendClientMessageToAll but, forgot to remove the playerid.