ooc help
#1

Hello I have this /ooc command but I dont know how to make a /disableooc if anyone would be kind enough to help me out thanks in advance.
Код:
CMD:ooc(playerid, params[])
{
	new sendername[MAX_PLAYER_NAME], string[56];
	GetPlayerName(playerid, sendername, sizeof(sendername));
	if(isnull(params)) return SendClientMessage(playerid,-1, "*"COL_WHITE" /ooc [text] or /o [text]");
	format(string, sizeof(string), "[GLOBAL CHAT]%s: %s", sendername, params);
	SendClientMessageToAll(-1, string);
	return 1;
}
+rep to whoever fulfills my request.
Reply
#2

Add this on top:
PHP код:
new bool:OOCDisabled
/disableooc command
PHP код:
CMD:disableooc(playeridparams[])
{
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playeridCOL_WHITE"You are not an admin.");
    
OOCDisabled=true;
    return 
1;

/enableooc command
PHP код:
CMD:enableooc(playeridparams[])
{
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playeridCOL_WHITE"You are not an admin.");
    
OOCDisabled=false;
    return 
1;

/ooc command
PHP код:
CMD:ooc(playeridparams[])
{
    if(
OOCDisabled) return SendClientMessage(playeridCOL_WHITE"OOC Chat is currently disabled.");
    new 
sendername[MAX_PLAYER_NAME], string[56];
    
GetPlayerName(playeridsendernamesizeof(sendername));
    if(
isnull(params)) return SendClientMessage(playerid,-1"*"COL_WHITE" /ooc [text] or /o [text]");
    
format(stringsizeof(string), "[GLOBAL CHAT]%s: %s"sendernameparams);
    
SendClientMessageToAll(-1string);
    return 
1;

Reply
#3

It doesn't work I've followed everything you put but it doesn't close the chat nor does it open it it just stays neutral by not getting affected at all
Reply
#4

pawn Код:
new ooc = 0;

CMD:ooc(playerid, params[])
{
   new string[128], sendername[MAX_PLAYER_NAME];
   if(ooc == 1)
   {
      GetPlayerName(playerid, sendername, sizeof(sendername));
      if(isnull(params)) return SendClientMessage(playerid,-1, "* /ooc [text] or /o [text]");
      format(string, sizeof(string), "[GLOBAL CHAT]%s: %s",sendername,params);
      SendClientMessageToAll(-1, string);
   }
   else if(ooc == 0) return SendClientMessage(playerid, -1, "OOC Chat is Currently Disabled");
   return 1;
}

CMD:togooc(playerid, params[])
{
   if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COL_WHITE, "You are not an admin.");
   if(ooc == 0)
   {
      ooc = 1;
      SendClientMessageToAll(-1, "OOC Chat Enabled");
   }
   else if(ooc == 1)
   {
      ooc = 0;
      SendClientMessageToAll(-1, "OOC Chat Disabled");
   }
   return 1;
}
Reply
#5

PHP код:
COMMAND:ooc(playerid)
{
if(
oocenableSendClientInfo(playerid"OOC is on!");
    new 
tmp[4];
    if(
sscanf(params"s"tmp)) return SCP(playerid"[on/off]");
    if(
strcmp(tmp,"on",true)==0)
    {
        
oocenable=1;
        
SendClientMessageToAll(COLOR_GREENYELLOW,"[SERVER] OOC Chat enabled");
        
format(iStrsizeof(iStr), "3..: Global OOC enabled by %s :.."PlayerName(playerid));
        
iEcho(iStr);
    }
    else if(
strcmp(tmp,"off",true)==0)
    {
        
oocenable=0;
        
SendClientMessageToAll(COLOR_GREENYELLOW,"[SERVER] OOC Chat disabled");
        
format(iStrsizeof(iStr), "3..: Global OOC disabled by %s :.."PlayerName(playerid));
        
iEcho(iStr);
    }
    else return 
SCP(playerid"[on/off]");
    return 
1;

Reply
#6

Did you use /disableooc successfully ingame?
Looks fine to me.
Reply
#7

Quote:
Originally Posted by ReD_HunTeR
Посмотреть сообщение
pawn Код:
new ooc = 0;

CMD:ooc(playerid, params[])
{
   new string[128], sendername[MAX_PLAYER_NAME];
   if(ooc == 1)
   {
      GetPlayerName(playerid, sendername, sizeof(sendername));
      if(isnull(params)) return SendClientMessage(playerid,-1, "* /ooc [text] or /o [text]");
      format(string, sizeof(string), "[GLOBAL CHAT]%s: %s",sendername,params);
      SendClientMessageToAll(-1, string);
   }
   else if(ooc == 0) return SendClientMessage(playerid, -1, "OOC Chat is Currently Disabled");
   return 1;
}

CMD:togooc(playerid, params[])
{
   if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COL_WHITE, "You are not an admin.");
   if(ooc == 0)
   {
      ooc = 1;
      SendClientMessageToAll(-1, "OOC Chat Enabled");
   }
   else if(ooc == 1)
   {
      ooc = 0;
      SendClientMessageToAll(-1, "OOC Chat Disabled");
   }
   return 1;
}
Yours just keeps the ooc chat closed all the time I added instead of IsPlayerAdmin
Код:
(pInfo[playerid][pAdminLevel] >= 2)
admin rank
Could that be the problem?
Reply
#8

thx mate I solved it it was this bit that stopped it from working
Код:
return SendClientMessage(playerid, COL_WHITE, "You are not an admin.");
You have to use else { or it wont work
Reply
#9

Quote:
Originally Posted by Hybris
Посмотреть сообщение
thx mate I solved it it was this bit that stopped it from working
Код:
return SendClientMessage(playerid, COL_WHITE, "You are not an admin.");
You have to use else { or it wont work
The problem is that we don't know variable you used to get the admin level of players in your script.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)