OOC Disable command
#1

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;
 }
Reply
#2

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.
Reply
#3

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

But atleast thanks for this
Reply
#4

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)
Reply
#5

Код:
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)
Reply
#6

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

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

Big thanks to all who helped all works fine
Reply
#8

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 -.-
Reply
#9

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?
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)