Quote:
Originally Posted by Jakku
pawn Код:
//Above Ongamemodeinit: new ChatDisabled;
public OnGameModeInit() { ChatDisabled = 0; //Chat enabled return 1; }
else if(strcmp(cmd, "/chat", true) == 0) { if (ChatDisabled == 0) { ChatDisabled = 1; //Chat off return 1; } if (ChatDisabled == 1) { ChatDisabled = 0; //Chat on return 1; } return 1; }
public OnPlayerText(playerid, text[]) { if(ChatDisabled == 1) { SendClientMessage(playerid, COLOR_YOURCOLOR, "The chat is currently disabled by an admin."); return 0; } return 1; }
Try this
|
You forgot a few things there
Here's my take:
You will need a placeholder for a boolean assignment for each player, in an array:
Now when the player types say for example: /tchat
Under public OnPlayerCommandText(playerid, cmdtext[])
Код:
if(strcmp(cmdtext, /tchat, true) == 0)
{
if(ChatToggle == false)
{
ChatToggle = true;
{
if(ChatToggle == true)
{
ChatToggle = false;
{
}
Under OnPlayerText(playerid, text[])
Код:
{
if(ChatToggle == true)
{
return 0;
}
if(ChatToggle == false)
{
return 1;
}
}
Don't forget to remove the return 1; under OnPlayerText first, or this won't work