#2

Quote;

Код:
new
	bool: IsPlayerPausedx[MAX_PLAYERS],
	PlayerPausedCount[MAX_PLAYERS],
	Paused_Timer,
    AFkMi[MAX_PLAYERS]
;

public OnGameModeInit()
{
	Paused_Timer = SetTimer("OnPlayersPaused", 1000, true);
	return 1;
}

public OnGameModeExit()
{
	KillTimer(Paused_Timer);
	return 1;
}

public OnPlayerConnect(playerid)
{
	IsPlayerPausedx[playerid] = false;
	PlayerPausedCount[playerid] = 0;
	return 1;
}

public OnPlayerUpdate(playerid)
{
	PlayerPausedCount[playerid] = 0;
    if(IsPlayerPausedx[playerid])
	{
		CallLocalFunction("OnPlayerUnpaused", "i", playerid);
		IsPlayerPausedx[playerid] = false;
	}
	return 1;
}

forward OnPlayerPaused(playerid);
public OnPlayerPaused(playerid)
{
	AFkMi[playerid] = 1;
	// If the player is AFK.
	// AFK operations.
}

forward OnPlayerUnpaused(playerid);
public OnPlayerUnpaused(playerid)
{
	AFkMi[playerid] = 0;
	// Afk player leaves.
	// AFK operations.
}

forward OnPlayersPaused();
public OnPlayersPaused()
{
	foreach(new playerid : Player)
	{
		if(PlayerPausedCount[playerid] < 2 ) PlayerPausedCount[playerid]++;
		else
		{
			CallLocalFunction("OnPlayerPaused", "i", playerid);
			IsPlayerPausedx[playerid] = true;
		}
	}
}
The rest is yours.
Reply


Messages In This Thread
Idea - by Shaheen - 20.11.2016, 19:14
Re: Idea - by sampkinq - 20.11.2016, 19:27
Re: Idea - by Kaliber - 20.11.2016, 19:34
Re: Idea - by TwinkiDaBoss - 20.11.2016, 21:11
Re: Idea - by iamjems - 21.11.2016, 09:06
Re: Idea - by IceBilizard - 21.11.2016, 09:17
Re: Idea - by Shaheen - 26.11.2016, 19:05

Forum Jump:


Users browsing this thread: 1 Guest(s)