Add Happy Hour some Flags etc Please

Сообщения
63
Реакции
39
Hello, can anyone add multiple Flags? I have Users who registered with Flag W. But i know there is nothing about flag W. SO i want add them w+y

This Users have an Register Tag. Can anyone add that Users with flag Z and Users with Flag wy got Free VIP in this Time ? After expired Happy Hour they should get here original Flags back. It would be cool.

The VIP FLags should be Admin_level_h (T)

#define ADMIN_ADMIN (1<<24) /* flag "y" */
#define ADMIN_USER (1<<24) /* flag "z" */

And the VIP TIME should be avaible from 15 O Clock to 22 O Clock

Код:
#include < amxmodx >
#include < amxmisc > 
#include < engine >
#include < hamsandwich >

#define VIP_FLAG ADMIN_LEVEL_H

#define DEFAULT_FLAG ADMIN_USER

#define HUD_POSITION_X        -1.0
#define HUD_POSITION_Y        0.0

#define HUD_COLOR_RED        0
#define HUD_COLOR_GREEN        200
#define HUD_COLOR_BLUE        0

new g_iCvars[ 3 ];

new bool:g_bFreeVipTime;

public plugin_init( )
{
    register_plugin( "Free VIP", "1.0", "DoNii" );

    register_event( "HLTV", "OnNewRound", "a", "1=0", "2=0" );

    RegisterHam( Ham_Spawn, "player", "fw_HamSpawnPost", 1 );
    
    g_iCvars[ 0 ] = register_cvar( "free_vip_on", "1" );
    g_iCvars[ 1 ] = register_cvar( "free_vip_start_time", "10" );
    g_iCvars[ 2 ] = register_cvar( "free_vip_end_time", "23" );
    
    set_task(1.0, "show_hud", _, .flags = "b");
}

public plugin_natives( )
{
    register_library( "free_vip" );
    register_native( "is_free_vip_time", "native_is_free_vip_time", 0 );
}

public client_PostThink( id )
{
    if(!is_user_alive(id) || is_user_bot(id))
        return;
    
    set_user_flags( id, g_bFreeVipTime ? VIP_FLAG : DEFAULT_FLAG );
}

public OnNewRound( )
{
    if( ! get_pcvar_num( g_iCvars[ 0 ] ) )
        return PLUGIN_CONTINUE;

    new g_iCondition = IsVipHour( get_pcvar_num( g_iCvars[ 1 ] ), get_pcvar_num( g_iCvars[ 2 ] ) );

    g_bFreeVipTime = g_iCondition ? true : false;
    
    new szPlayers[ 32 ], iNum, iTempID;
    get_players( szPlayers, iNum );
        
    for( new i; i < iNum; i++ )
    {
        iTempID = szPlayers[ i ];
            
        if(!is_user_bot( iTempID ))
            set_user_flags( iTempID, g_bFreeVipTime ? VIP_FLAG : DEFAULT_FLAG);
    }
    
    return PLUGIN_CONTINUE;
}

public show_hud()
{
    if(!g_bFreeVipTime)
        return;
    
    set_hudmessage(HUD_COLOR_RED, HUD_COLOR_GREEN, HUD_COLOR_BLUE, HUD_POSITION_X, HUD_POSITION_Y, 0, 6.0, 1.1);
    show_hudmessage(0, "Happy Hour > Free VIP Start: %dh^n\Happy Hour > Free VIP End: %dh", get_pcvar_num(g_iCvars[ 1 ]), get_pcvar_num(g_iCvars[ 2 ]));
}

public fw_HamSpawnPost( id )
{
    if(!is_user_alive(id) || is_user_bot(id))
        return;
    
    set_user_flags( id, g_bFreeVipTime ? VIP_FLAG : DEFAULT_FLAG);
}

public native_is_free_vip_time( iPlugin, iParams )
{
    return bool:g_bFreeVipTime;
}

bool:IsVipHour( iStart, iEnd )
{
    new iHour; time( iHour );
    return bool:( iStart < iEnd ? ( iStart <= iHour < iEnd ) : ( iStart <= iHour || iHour < iEnd ) )
}
 

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу