[HELP] Use chat every 3 seconds
#4

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;
}
Reply


Messages In This Thread
[HELP] Use chat every 3 seconds - by kbalor - 02.08.2012, 06:05
Re: [HELP] Use chat every 3 seconds - by Gamer_007 - 02.08.2012, 06:06
Re: [HELP] Use chat every 3 seconds - by newbienoob - 02.08.2012, 06:12
Re: [HELP] Use chat every 3 seconds - by AmigaBlizzard - 02.08.2012, 06:46
Re: [HELP] Use chat every 3 seconds - by [MM]RoXoR[FS] - 02.08.2012, 06:57
Re: [HELP] Use chat every 3 seconds - by ReVo_ - 02.08.2012, 10:30
Re: [HELP] Use chat every 3 seconds - by [MM]RoXoR[FS] - 02.08.2012, 10:53
Re: [HELP] Use chat every 3 seconds - by Dan. - 02.08.2012, 10:55

Forum Jump:


Users browsing this thread: 1 Guest(s)