•  
     

[Plugin CSv1.6] 35HP Mode (Knife)

Estou desenvolvendo esse plugin para rodar em servidores 4Fun e Multi-Mod.
- Tanto em mapas de_ cs_ fy_ awp_ a sua vida fica em 35.
- Ele bloquea todos os BUYs e Autobuy, tirando o bug de alguns mapas 35hp que da para comprar armas.
Aqui o código caso vocês queiram editar no Amxx Studio:

Código: Selecionar todos

/*	Copyright © 2012, v1ngad0r - Megatopico.com

	Knife Mode 35HP
*/

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <hamsandwich>
#include <cstrike>
#include <fun>

new const VERSION[] = "1.0.0"

const NULLENT	= -1

new g_iHealer = NULLENT
new Float:g_flSpawnHealth = 0.0

new g_iImpulse
new Float:g_flPainFinished
new Float:g_flDmgTime
new Float:g_flDmg

new Float:g_flPeriod
new HamHook:g_iFwdHurtTouch
new HamHook:g_iFwdPlayerSpawn
new HamHook:g_iFwdTakeDamage

new Float:g_flFallDamageFactor

new g_iMaxPlayers
#define IsPlayer(%1)	( 1 <= %1 <= g_iMaxPlayers )

public plugin_init()
{
         register_plugin("35HP Mode - Knife", "1.0", "v1ngad0r")
         RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1) 
	register_concmd("amx_spawn_health", "Command_SpawnHealth", ADMIN_CFG, "(padrao 35)")

	g_iMaxPlayers = get_maxplayers()
	register_clcmd("rebuy","block")
register_clcmd("cl_setautobuy","block")
register_clcmd("cl_autobuy","block")
register_clcmd("cl_setrebuy","block")
register_clcmd("cl_rebuy","block")
register_clcmd("buy","block")
register_clcmd("autobuy","block")
register_clcmd("m4a1","block")
register_clcmd("ak47","block")
register_clcmd("famas","block")
register_clcmd("galil","block")
register_clcmd("p90","block")
register_clcmd("mp5","block")
register_clcmd("deagle","block")
register_clcmd("usp","block")
register_clcmd("primammo","block")
register_clcmd("secammo","block")
register_clcmd("defuser","block")
register_clcmd("vesthelm","block")
register_clcmd("vest","block")
register_clcmd("hegren","block")
register_clcmd("galil","block")
register_clcmd("defender","block")
register_clcmd("ak47","block")
register_clcmd("cv47","block")
register_clcmd("scout","block")
register_clcmd("sg552","block")
register_clcmd("krieg552","block")
register_clcmd("awp","block")
register_clcmd("magnum","block")
register_clcmd("g3sg1","block")
register_clcmd("d3au1","block")
register_clcmd("famas","block")
register_clcmd("clarion","block")
register_clcmd("m4a1","block")
register_clcmd("aug","block")
register_clcmd("bullpup","block")
register_clcmd("sg550","block")
register_clcmd("krieg550","block")
register_clcmd("glock","block")
register_clcmd("9x19mm","block")
register_clcmd("usp","block")
register_clcmd("km45","block")
register_clcmd("p228","block")
register_clcmd("228compact","block")
register_clcmd("deagle","block")
register_clcmd("nighthawk","block")
register_clcmd("elites","block")
register_clcmd("fn57","block")
register_clcmd("fiveseven","block")
register_clcmd("m3","block")
register_clcmd("12gauge","block")
register_clcmd("xm1014","block")
register_clcmd("autoshotgun","block")
register_clcmd("mac10","block")
register_clcmd("tmp","block")
register_clcmd("mp","block")
register_clcmd("mp5","block")
register_clcmd("smg","block")
register_clcmd("ump45","block")
register_clcmd("p90","block")
register_clcmd("c90","block")
register_clcmd("m249","block")
register_clcmd("primammo","block")
register_clcmd("secammo","block")
register_clcmd("vest","block")
register_clcmd("vesthelm","block")
register_clcmd("flash","block")
register_clcmd("hegren","block")
register_clcmd("sgren","block")
register_clcmd("nvgs","block")
register_clcmd("defuser","block")
register_clcmd("shield","block")
}

public pfn_keyvalue( iEntity )
{
    static szClassName[ 32 ], szKey[ 2 ], szValue[ 2 ];
    copy_keyvalue( szClassName, charsmax( szClassName ), szKey, charsmax( szKey ), szValue, charsmax( szValue ) );
    
    if( !strcmp( szClassName, "func_bomb_target" )
    ||  !strcmp( szClassName, "info_bomb_target" ) )
    {
        if( is_valid_ent( iEntity ) )
        {
            remove_entity( iEntity );
        }
    }
}


public block(id)
{
	ChatColor(id, "!g[35HP]!y AUTOBUY e BUY desabilitado.")
return PLUGIN_HANDLED
}

stock ChatColor(const id, const input[], any:...)
{
    new count = 1, players[32]
    static msg[191]
    vformat(msg, 190, input, 3)
    
    replace_all(msg, 190, "!g", "^4")  // Chat Verde
    replace_all(msg, 190, "!y", "^1")  // Chat Normal
    replace_all(msg, 190, "!t", "^3")  // Chat Do Time Tr=Vermelho Ct=Azul Spec=Branco
    replace_all(msg, 190, "!t2", "^0") // Chat Do Time Tr=Vermelho Ct=Azul Spec=Branco
    
    if (id) players[0] = id; else get_players(players, count, "ch")
    
    for (new i = 0; i < count; i++)
    {
        if (is_user_connected(players[i]))
        {
            message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
            write_byte(players[i]);
            write_string(msg);
            message_end();
        }
    }
}

public fwHamPlayerSpawnPost(iPlayer) {
        if (is_user_alive(iPlayer)) {
                // player spawned
	strip_user_weapons( iPlayer );
	give_item( iPlayer, "weapon_knife" );
        }
}  

public Command_MakeHealer(id, level, cid)
{
	if( cmd_access(id, level, cid, 2) )
	{
		new szAmount[8], Float:flPeriod
		read_argv(1, szAmount, charsmax(szAmount))

		if( read_argc() == 3 )
		{
			new szPeriod[8]
			read_argv(2, szPeriod, charsmax(szPeriod))
			flPeriod = str_to_float(szPeriod)
		}
		else
		{
			flPeriod = 0.0
		}

		if( !is_valid_ent(g_iHealer) )
		{
			g_iHealer = create_entity("trigger_hurt")
			DispatchSpawn(g_iHealer)
			entity_set_size(g_iHealer, Float:{-8192.0, -8192.0, -8192.0} , Float:{8192.0, 8192.0, 8192.0})
			entity_set_int(g_iHealer, EV_INT_spawnflags, SF_TRIGGER_HURT_CLIENTONLYTOUCH)	
		}

		new Float:flHpAmount = str_to_float(szAmount)
		entity_set_float(g_iHealer, EV_FL_dmg, -1.0 * flHpAmount)

		if( flPeriod < 0.1 )
		{
			DisableHamForward(g_iFwdHurtTouch)
			return PLUGIN_HANDLED
		}

		g_flPeriod = flPeriod
		g_flDmg = flHpAmount

		if( !g_iFwdHurtTouch )
		{
			g_iFwdHurtTouch = RegisterHam(Ham_Touch, "trigger_hurt", "HurtTouch")
		}
		else
		{
			EnableHamForward(g_iFwdHurtTouch)
		}
	}
	return PLUGIN_HANDLED
}

public Command_DestroyHealer(id, level, cid)
{
	if( cmd_access(id, level, cid, 1) )
	{
		if( is_valid_ent(g_iHealer) )
		{
			remove_entity(g_iHealer)
			g_iHealer = NULLENT
		}

		DisableHamForward(g_iFwdHurtTouch)
	}
	return PLUGIN_HANDLED
}

public Command_SpawnHealth(id, level, cid)
{
	if( cmd_access(id, level, cid, 2) )
	{
		new szAmount[8], Float:flAmount
		read_argv(1, szAmount, charsmax(szAmount))

		flAmount = str_to_float(szAmount)

		if( flAmount >= 1 )
		{
			g_flSpawnHealth = flAmount
			if( g_iFwdPlayerSpawn )
			{
				EnableHamForward(g_iFwdPlayerSpawn)
			}
			else
			{
				g_iFwdPlayerSpawn = RegisterHam(Ham_Spawn, "player", "Player_Spawn", 1)
			}
		}
		else
		{
			g_flSpawnHealth = 0.0
			DisableHamForward(g_iFwdPlayerSpawn)
		}
	}
	return PLUGIN_HANDLED
}

public Command_FallDamage(id, level, cid)
{
	if( cmd_access(id, level, cid, 2) )
	{
		new szFactor[12]
		read_argv(1, szFactor, charsmax(szFactor))
		g_flFallDamageFactor = str_to_float(szFactor)
		if( g_flFallDamageFactor < 0.0 )
		{
			g_flFallDamageFactor = 1.0
		}

		if( g_flFallDamageFactor != 1.0 )
		{
			if( !g_iFwdTakeDamage )
			{
				g_iFwdTakeDamage = RegisterHam(Ham_TakeDamage, "player", "Player_TakeDamage")
			}
			else
			{
				EnableHamForward( g_iFwdTakeDamage )
			}
		}
		else
		{
			DisableHamForward( g_iFwdTakeDamage )
		}
	}
	return PLUGIN_HANDLED
}

public Player_Spawn(id)
{
	if( is_user_alive(id) )
	{
		entity_set_float(id, EV_FL_health, g_flSpawnHealth )
		entity_set_float(id, EV_FL_max_health, g_flSpawnHealth )
	}
}

public HurtTouch(iEnt, id)
{
	if( iEnt != g_iHealer )
	{
		return HAM_IGNORED
	}

	if( !IsPlayer(id) )
	{
		return HAM_IGNORED
	}

	static Float:flTime
	flTime = get_gametime()
	if( g_flDmgTime > flTime )
	{
		if( flTime != g_flPainFinished )
		{
			if ( g_iImpulse & (1<<(id&31)) )
			{
				return HAM_SUPERCEDE
			}
			g_iImpulse |= (1<<(id&31))
		}
	}
	else
	{
		g_iImpulse = (1<<(id&31))
	}

	static Float:flHealth, Float:flMaxHealth

	flHealth = entity_get_float(id, EV_FL_health)
	flMaxHealth = entity_get_float(id, EV_FL_max_health)

	if( flMaxHealth < flHealth )
	{
		return HAM_SUPERCEDE
	}

	flHealth += g_flDmg

	if( flHealth > flMaxHealth )
	{
		flHealth = flMaxHealth
	}

	entity_set_float(id, EV_FL_health, flHealth)

	g_flPainFinished = flTime
	g_flDmgTime = flTime + g_flPeriod

	return HAM_SUPERCEDE
}

public Player_TakeDamage(id, iInflictor, iAttacker, Float:flDamage, bitsDamageType)
{
	if( bitsDamageType == DMG_FALL )
	{
		SetHamParamFloat(4, flDamage * g_flFallDamageFactor)
		return HAM_HANDLED
	}
	return HAM_IGNORED
}


DOWNLOAD .AMXX
http://www.amxmodx.org/webcompiler.cgi?go=dl&id=1378094