Skocz do zawartości

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie

No Fall Death


  • Zamknięty Temat jest zamknięty
1 odpowiedź w tym temacie

#1 ZBAGI

    Profesjonalista

  • Użytkownik

Reputacja: 15
Początkujący

  • Postów:150
  • Lokalizacja:Brak informacji ;)
Offline

Napisano 25.01.2009 20:03

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

// ------------------------------------
new const PLUGIN[] =  "No Fall Death"
#define VERSION		 "1.0"
// ------------------------------------

#define RANDOM_MIN_VALUE	1.0
#define REGENERATE_MIN_VALUE	1.0

new Float: Health[ 33 ];

new toggle_plugin, toggle_interval, toggle_amount;
new p_plugin, p_int, p_amount;
new g_msghealth;

public plugin_init() 
{
	register_plugin( PLUGIN, VERSION, "anakin_cstrike" );
	
	register_logevent( "roundstart", 2, "1=Round_Start" );
	RegisterHam( Ham_TakeDamage, "player", "ham_damage" );
	
	toggle_plugin = register_cvar( "nfd_plugin", "1" );
	toggle_interval = register_cvar( "nfd_interval", "5" );
	toggle_amount = register_cvar( "ndf_amount", "3" );
	
	g_msghealth = get_user_msgid( "Health" );
}
public roundstart()
{
	p_plugin = get_pcvar_num( toggle_plugin );
	p_int = get_pcvar_num( toggle_interval );
	p_amount = get_pcvar_num( toggle_amount );
}

public ham_damage( this, inflictor, attacker, Float:damage, damagebits )
{
	if( !p_plugin )
		return FMRES_IGNORED;
	if( !( damagebits & DMG_FALL ) )
		return HAM_IGNORED;
	
	if( task_exists( this+123 ) )
		remove_task( this+123 );	
	
	pev( this, pev_health, Health[ this ] );	
	
	switch( p_plugin )
	{
		case 1: return HAM_SUPERCEDE;
		case 2:
		{
			if( Check( damage, Health[ this ] ) )
			{
				SetHealth( this, random_float( RANDOM_MIN_VALUE, Health[ this ] ) );
				return HAM_SUPERCEDE;
			}
		}
		case 3:
		{
			if( Check( damage, Health[ this ] ) )
			{
				if( task_exists( this+123 ) )
					remove_task( this+123 );
		
				SetHealth( this, REGENERATE_MIN_VALUE );
				set_task( float( p_int ), "give", this+123, _, _, "b" );
		
				return HAM_SUPERCEDE;
			}
		}
	}
	
	return HAM_IGNORED;
}

public give( index )
{
	index -= 123;
	
	new Float: hp;
	pev( index, pev_health, hp );
	
	new Float: total = hp + float( p_amount );
	SetHealth( index, total );
		
	if( hp >= Health[ index ] )
	{
		SetHealth( index, Health[ index ] );
		remove_task( index );
		return 0;
	}
	
	return 0;
}

SetHealth( index, Float: hp )
{
	message_begin( MSG_ONE, g_msghealth, {0,0,0}, index );
	write_byte( floatround( hp ) );
	message_end();
	
	set_pev( index, pev_health, hp );
}

bool: Check( Float:value, Float:compare )
	return ( value >= compare ) ? true : false;

próbowałem na tysiące sposobów, ale nie mogę ustawić tak by plug działał tylko na TT :/
  • +
  • -
  • 0

#2 Miczu

    Godlike

  • Przyjaciel

Reputacja: 657
Wszechmogący

  • Postów:2 862
Offline

Napisano 25.01.2009 20:40

public ham_damage( this, inflictor, attacker, Float:damage, damagebits ) 

{ 

    if( !p_plugin ) 

        return FMRES_IGNORED; 

    if( !( damagebits & DMG_FALL ) ) 

        return HAM_IGNORED;

    if (pev(this,pev_team)!=1)

        return HAM_IGNORED;


  • +
  • -
  • 0




Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych