Block Chat -Script
#1

Hi
I'm searching some scrpit who can block chat - normal players cant write in chat only admins can write

Please help

//Sorry i cant good english
Reply
#2

make a if(admincheck) at onplayertext.
Reply
#3

.... i'm noob.... i dont know what should i do

//i was starting learn pawno two days ago
please help!!
Reply
#4

in OnPlayerText return 0 to hide text and return 1 to show..
check if playerid is admin if true return 1
else
return 0
Reply
#5

//Top of script:
Код:
new bool:ChatBlocked;
//OnPlayerText:
Код:
public OnPlayerText(playerid, text[])
{
  if(ChatBlocked == true && !IsPlayerAdmin(playerid))
  {
    SendClientMessage(playerid, 0xFF0000AA, "Sorry, the admins blocked the chat");
    return 0;
  }
  return 1;
}
//OnPlayerCommandText:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(strcmp(cmdtext, "/blockchat", true)==0 && IsPlayerAdmin(playerid))
  {
    if(ChatBlocked == false)
    {
      ChatBlocked = true;
      SendClientMessageToAll(0xFF0000AA, "The Admins blocked the chat!");
    }
    else
    {
      ChatBlocked = false;
      SendClientMessageToAll(0x00FF00AA, "The Admins unblocked the chat!");
    }
    return 1;
  }
  return 0;
}
Reply
#6

Thx
but i have some errors

Код:
C:\Documents and Settings\Kacxper\Pulpit\All.pwn(141) : error 010: invalid function or declaration
C:\Documents and Settings\Kacxper\Pulpit\All.pwn(143) : error 010: invalid function or declaration
C:\Documents and Settings\Kacxper\Pulpit\All.pwn(148) : error 010: invalid function or declaration
C:\Documents and Settings\Kacxper\Pulpit\All.pwn(153) : error 010: invalid function or declaration
C:\Documents and Settings\Kacxper\Pulpit\All.pwn(155) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
form 141 to 155
Код:
  if(strcmp(cmdtext, "/blockchat", true)==0 && IsPlayerAdmin(playerid))
  {
    if(ChatBlocked == false)
    {
      ChatBlocked = true;
      SendClientMessageToAll(0xFF0000AA, "The Admins blocked the chat!");
    }
    else
    {
      ChatBlocked = false;
      SendClientMessageToAll(0x00FF00AA, "The Admins unblocked the chat!");
    }
    return 1;
  }
  return 0;
Reply
#7

Did you put that command in your OnPlayerCommandText-callback along with your other commands?
Reply
#8

Yes

// i made new FilterScript and now its ok!


Код:
#pragma tabsize 0
#include <a_samp>
#include <core>
#include <float>

new bool:ChatBlocked;

public OnFilterScriptInit()
{
}

public OnPlayerText(playerid, text[])
{
  if(ChatBlocked == true && !IsPlayerAdmin(playerid))
  {
    SendClientMessage(playerid, 0xFF0000AA, "Sorry, the admins blocked the chat");
    return 0;
  }
  return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
  if(strcmp(cmdtext, "/blockchat", true)==0 && IsPlayerAdmin(playerid))
  {
    if(ChatBlocked == false)
    {
      ChatBlocked = true;
      SendClientMessageToAll(0xFF0000AA, "The Admins blocked the chat!");
    }
    else
    {
      ChatBlocked = false;
      SendClientMessageToAll(0x00FF00AA, "The Admins unblocked the chat!");
    }
    return 1;
  }
  return 0;
}
Thanks very much =>Sandra<=
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)