Raised This Month: $12 Target: $400
 3% 

Free-vip for all [EVENT]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Shitty
Member
Join Date: Sep 2019
Old 01-13-2020 , 13:12   Free-vip for all [EVENT]
Reply With Quote #1

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( );  
        }  
    }  
}
__________________

Last edited by Shitty; 01-13-2020 at 13:16.
Shitty is offline
Shitty
Member
Join Date: Sep 2019
Old 01-15-2020 , 16:40   Re: Free-vip for all [EVENT]
Reply With Quote #2

is this so hard?
__________________
Shitty is offline
ZaX
Senior Member
Join Date: Jan 2015
Old 01-16-2020 , 02:52   Re: Free-vip for all [EVENT]
Reply With Quote #3

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))

ZaX is offline
Shitty
Member
Join Date: Sep 2019
Old 01-16-2020 , 10:34   Re: Free-vip for all [EVENT]
Reply With Quote #4

why it gives only "b" flag ?

As the code say :
Quote:
cvar_hfh_flag = register_cvar("hfh_flag", "bn")
__________________
Shitty is offline
AmXDusT
Member
Join Date: Feb 2019
Location: Italy / Albania
Old 01-16-2020 , 12:00   Re: Free-vip for all [EVENT]
Reply With Quote #5

In CheckTime() function, change szString[2] to szString[3]
AmXDusT is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:02.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode