SA-MP Forums Archive
Turn On/Off - Public - 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: Turn On/Off - Public (/showthread.php?tid=80739)



Turn On/Off - Public - shark - 06.06.2009

Hey Guyz, wazup?

So, I wanna know if I can do cmd to turn on/off a public statement?

Here is my public:

Код:
public OnPlayerPrivmsg(playerid, recieverid, text[])
{
	static lastmsg[MAX_PLAYERS][128];
	if(strfind(lastmsg[playerid], text, false) != -1)
	{
		SendClientMessage(playerid, 0xFF0000FF, "Stop repeat your messages!");
 		Kick(playerid);
 		return 0;
	}
	strmid(lastmsg[playerid],text,0,strlen(text),sizeof(lastmsg[]));
	return 1;
}
Thank you guyz!


Re: Turn On/Off - Public - lavamike - 06.06.2009

Quote:
Originally Posted by shark
Hey Guyz, wazup?

So, I wanna know if I can do cmd to turn on/off a public statement?

Here is my public:

Код:
public OnPlayerPrivmsg(playerid, recieverid, text[])
{
	static lastmsg[MAX_PLAYERS][128];
	if(strfind(lastmsg[playerid], text, false) != -1)
	{
		SendClientMessage(playerid, 0xFF0000FF, "Stop repeat your messages!");
 		Kick(playerid);
 		return 0;
	}
	strmid(lastmsg[playerid],text,0,strlen(text),sizeof(lastmsg[]));
	return 1;
}
Thank you guyz!
if you mean something like you type a cmd and it won't call that public?
if you do, something like this:

Top of your script:
pawn Код:
new PublicPrivMsgOn = 1;

replace code with this:

pawn Код:
public OnPlayerPrivmsg(playerid, recieverid, text[])
{
  if(PublicPrivMsgOn == 1)
  {
    static lastmsg[MAX_PLAYERS][128];
    if(strfind(lastmsg[playerid], text, false) != -1)
    {
      SendClientMessage(playerid, 0xFF0000FF, "Stop repeat your messages!");
      Kick(playerid);
      return 0;
    }
    strmid(lastmsg[playerid],text,0,strlen(text),sizeof(lastmsg[]));
  }
  return 1;
}
Then just make a command that sets PublicPrivMsgOn = 0


Re: Turn On/Off - Public - shark - 06.06.2009

I got your idea.

But, how do I will set PublicPrivMsgOn = 0?

Thanks anyway!


EDITED:

Forget, It's already done.
Thanks.