找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 487|回复: 1

有人要的no fall death

[复制链接]

该用户从未签到

发表于 2009-4-22 21:42:36 | 显示全部楼层 |阅读模式
#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;

该用户从未签到

发表于 2009-4-23 09:00:41 | 显示全部楼层
要实现这个功能很简单啊,我看prokreedz里只调用了一个fun模块的函数:
set_user_godmode(id, 1)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表