02.08.2012, 06:46
When a player sends text to the chatbox, store a variable to block his next chattext unless the minimum time has been passed.
Код:
new BlockChat[MAX_PLAYERS]; public OnPlayerText(playerid, text[]) { // Check if the chatting for this player is blocked if (BlockChat[playerid] == 1) { // Inform the player about his chat-block SendClientMessage(playerid, 0xFF0000FF, "You're not allowed to chat so soon, please wait a few seconds"); // Disallow the chat to be sent to the chatbox return 0; } else { // Set this player to be blocked the next time he chats Blockchat[playerid] = 1; // Set a timer to unblock his chatting after 3 seconds SetTimer(BlockChatTimer, 3000, false); // Allow his current chat-text to be sent to the chatbox return 1; } } forward BlockChatTimer(playerid); public BlockChatTimer(playerid) { // Unblock the chatbox for the given player Blockchat[playerid] = 0; return 1; }