Chat Lock Command
#2

Try this, untested, but compiles with no warnings/errors;
pawn Код:
new ChatLocked = 0; //Top of your script.

public OnPlayerCommandText(playerid, cmdtext[])
{
        new str[128], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    if(!strcmp(cmdtext, "/lockchat", true)) {
        if(ChatLocked == 1) return SendClientMessage(playerid, COLOR, "The chat is already locked!");
    ChatLocked = 1;
    format(str, sizeof(str), "%s has locked the chat.", name);
    SendClientMessageToAll(COLOR, str);
    }
    if(!strcmp(cmdtext, "/unlockchat", true)) {
        if(ChatLocked == 0) return SendClientMessage(playerid, COLOR, "The chat isn't already locked!");
    ChatLocked = 0;
    format(str, sizeof(str), "%s has unlocked the chat.", name);
    SendClientMessageToAll(COLOR, str);
    }
    return 0;
}
public OnPlayerText(playerid, text[])
{
        //Not sure it makes a difference, but put your team chat here.
    if(ChatLocked == 1) {
    SendClientMessage(playerid, COLOR, "The chat is locked.");
    return 0; //return 0, so the chat won't send.
    }
    return 1; //if the above doesn't apply, return 1, send the message.
}
Hope I helped, Aston.
Reply


Messages In This Thread
Chat Lock Command - by (_AcE_) - 23.12.2011, 05:58
Re: Chat Lock Command - by AstonDA-G - 23.12.2011, 08:30

Forum Jump:


Users browsing this thread: 1 Guest(s)