View Single Post
ZaX
Member
Join Date: Jan 2015
Old 01-16-2020 , 03: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