SA-MP Forums Archive
ooc help - 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)
+--- Thread: ooc help (/showthread.php?tid=567383)



ooc help - Hybris - 13.03.2015

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.


Re: ooc help - ATGOggy - 13.03.2015

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;




Re: ooc help - Hybris - 13.03.2015

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


Re: ooc help - ReD_HunTeR - 13.03.2015

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;
}



Re: ooc help - TheLegend1 - 13.03.2015

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;




Re: ooc help - CalvinC - 13.03.2015

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


Re: ooc help - Hybris - 13.03.2015

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?


Re: ooc help - Hybris - 13.03.2015

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


Re: ooc help - ATGOggy - 13.03.2015

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.