Правила форума Гаранты форума
Размещение рекламы AMX-X компилятор

Здравствуйте, гость Вход | Регистрация

Наши новости:

14-дек
24-апр
10-апр
11-апр

Нужна помощь с плагином.

Статус пользователя Andris1446
сообщение 5.1.2013, 11:51
Сообщение #1
Стаж: 13 лет

Сообщений: 164
Благодарностей: 4
Полезность: < 0

Пытался поставить флаг доступа в плагин "С" , но ничего не вышло.
Плагин скомпилировался, но работает и у админа и у обычного игрока.
Помогите исправить
Код
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

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

#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;
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   Цитировать сообщение
  Тема закрытаНачать новую тему
 
0 пользователей и 1 гостей читают эту тему: