AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Free-vip for all [EVENT] (https://forums.alliedmods.net/showthread.php?t=320877)

Shitty 01-13-2020 14:12

Free-vip for all [EVENT]
 
I have a plugin that's called free_vip.sma, it's plugin which give a free VIP for anyone connect server.. (flags "bn"), but i only want it to work from 8.30 PM to 8.30 AM, can someone make this for me?

Code:

#include <amxmodx> 

public plugin_init() 

    register_plugin( "Free VIP" , "1.0" , "Someone" ); 
}

public client_putinserver( id )
{
    if ( get_user_flags( id ) & ADMIN_USER ) 
    {
        remove_user_flags( id , ADMIN_USER ); 
        set_user_flags( id , read_flags( "bn" ) ); 
        set_task( 3.0, "task_adv", id ) 
    }
    else
        if ( get_user_flags( id ) & (1 << 22) ) 
    {
        remove_user_flags( id , (1 << 22) ); 
        set_user_flags( id , read_flags( "bn" ) ); 
        set_task( 3.0, "task_adv", id ) 
    }
    return PLUGIN_CONTINUE; 
}

public task_adv( id )
{
    client_chat( id , "!gHappy Time, you got free VIP !!" ) 
}

stock client_chat( const id , const input[] , any:... ) 

    new count = 1, players[ 32 ]; 
    static msg[ 191 ]; vformat( msg, 190, input, 3 ); 
   
    replace_all( msg, 190, "!g", "^4" ); 
    replace_all( msg, 190, "!y", "^1" ); 
    replace_all( msg, 190, "!t", "^3" ); 
   
    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( ); 
        } 
    } 
}


Shitty 01-15-2020 17:40

Re: Free-vip for all [EVENT]
 
is this so hard?

ZaX 01-16-2020 03:52

Re: Free-vip for all [EVENT]
 
Use this

PHP Code:

#include <amxmodx> 
#include <colorchat>

new const theCvar[] = "amx_default_access"

new cvar_hfh_start,cvar_hfh_endcvar_hfh_flag 
public plugin_init() { 
    
register_plugin("Happy Frag Hour""1.1""somedude"
    
    
cvar_hfh_start register_cvar("hfh_start","11"
    
cvar_hfh_end register_cvar("hfh_end","06")
    
cvar_hfh_flag register_cvar("hfh_flag""bn")
    
    
register_logevent("logevent_round_start"2"1=Round_Start"

public 
logevent_round_start()
{
    
CheckTime()
}
public 
CheckTime() 
{
    new 
get_startget_endszString[2]
    
get_start get_pcvar_num(cvar_hfh_start
    
get_end get_pcvar_num(cvar_hfh_end
    
get_pcvar_string(cvar_hfh_flagszStringcharsmax(szString)) 
    if(
is_happy_hour(get_startget_end))
    {
        
ColorChat(0,RED,"^4[HAPPY HOUR] ^1Free VIP is ^4ACTIVE.^3All players are VIPs now"
        
ColorChat(0,RED,"^4[HAPPY HOUR] ^1Free VIP is ^4ACTIVE.^3All players are VIPs now"
        
ColorChat(0,RED,"^4[HAPPY HOUR] ^1Free ^4V.I.P^1 --- START : ^3%i ^4| ^1END : ^3%i"get_startget_end)
        
set_cvar_string(theCvarszString)
        
server_cmd("amx_reloadadmins");
    }
    else {
        
set_cvar_string(theCvar"z")
        
server_cmd("amx_reloadadmins");
    }
}     

bool:is_happy_hour(const iStart, const iEnd) {
    new 
iHourtime(iHour)
    return 
bool:(iStart iEnd ? (iStart <= iHour iEnd) : (iStart <= iHour || iHour iEnd))



Shitty 01-16-2020 11:34

Re: Free-vip for all [EVENT]
 
why it gives only "b" flag ?

As the code say :
Quote:

cvar_hfh_flag = register_cvar("hfh_flag", "bn")

AmXDusT 01-16-2020 13:00

Re: Free-vip for all [EVENT]
 
In CheckTime() function, change szString[2] to szString[3]


All times are GMT -4. The time now is 13:52.

Powered by vBulletin®
Copyright ©2000 - 2020, vBulletin Solutions, Inc.