Thread: [Solved] End round protect player
View Single Post
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 12-21-2017 , 07:34   Re: End round protect player
Reply With Quote #15

Try this:

Code:
#include <amxmodx>
#include <fun>

new bool:g_bExplode

public plugin_init() 
{
	register_plugin("End Round Protect", "0.1", "zmd94")
	
	register_logevent("RoundStart", 2, "1=Round_Start")
	register_logevent("Bomb_Explode", 6, "3=Target_Bombed")
	register_logevent("RoundEnd", 2, "1=Round_End") 
}

public RoundStart()
{
	g_bExplode = false
	
	new iPlayers[32], iPlayerCount, i, iId
	get_players(iPlayers, iPlayerCount, "a") 
	for(i = 0; i < iPlayerCount; i++)
	{
		iId = iPlayers[i]
		set_user_godmode(iId, 0)
	}
}

public RoundEnd()
{
	if(!g_bExplode)
	{
		new iPlayers[32], iPlayerCount, i, iId
		get_players(iPlayers, iPlayerCount, "a") 
		for(i = 0; i < iPlayerCount; i++)
		{
			iId = iPlayers[i]
			set_user_godmode(iId, 1)
		}
	}
}

public Bomb_Explode()
{
	g_bExplode = true
}
zmd94 is offline