Raised This Month: $32 Target: $400
 8% 

Vip free from 23:00 till 11:00


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Vinjak
New Member
Join Date: Jan 2017
Old 01-21-2017 , 19:51   Vip free from 23:00 till 11:00
Reply With Quote #1

Hello, I need help with VIP plugin.
Im using this plugin.
I want vip to be free from 23:00 till 11:00.
this vip is on"bit" flags.
Can someone make me plugin that give free vip or can someone teach me?
-Thanks
Vinjak is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 01-21-2017 , 20:35   Re: Vip free from 23:00 till 11:00
Reply With Quote #2

Use get_time() native and check with equal() to see if the hour is between 23:00 and 11:00.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 01-21-2017 , 23:21   Re: Vip free from 23:00 till 11:00
Reply With Quote #3

this post will help you
https://forums.alliedmods.net/showpo...71&postcount=8
__________________
My plugin:
Celena Luna is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 01-22-2017 , 08:08   Re: Vip free from 23:00 till 11:00
Reply With Quote #4

Use this stock

PHP Code:
// NOTE: You can change the value of these defines or you could replace them with cvars.
// start at 11:00 clock
#define START_TIME 11

// end at at 14:00 clock
#define END_TIME 14

bool:is_vip_time( )
{
    new 
iHour;

    
time( .hour iHour );

    if( 
iHour >= START_TIME && iHour END_TIME )
        return 
true;
    return 
false;


Usage:

PHP Code:
    if( is_vip_time() )
    {
        
client_printid print_chat"It is vip time!" );
    }

    else
    {
        
client_printid print_chat"It is not vip time!" );
    } 
__________________
Project: Among Us

Last edited by Craxor; 01-22-2017 at 08:18.
Craxor is offline
Send a message via ICQ to Craxor
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-22-2017 , 08:46   Re: Vip free from 23:00 till 11:00
Reply With Quote #5

The stock won't work from 23 to 11.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 01-22-2017 , 09:25   Re: Vip free from 23:00 till 11:00
Reply With Quote #6

PHP Code:
#include <amxmodx>
#include <hamsandwich>

#define PLUGIN "Free VIP"
#define VERSION "1.0"
#define AUTHOR "Chakalaka In You. Boom Boom"

new g_FreeVip[33];
new 
g_Time_1g_Time_2

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
g_Time_1 register_cvar("free_vip_time_from""23")
    
g_Time_2 register_cvar("free_vip_time_to""11")
    
    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1)
    
}

public 
fwHamPlayerSpawnPost(id)
{
    new 
szTime[3]
    
get_time("%H",szTime,2)
    
    new 
Time_1 get_pcvar_num(g_Time_1)
    new 
Time_2 get_pcvar_num(g_Time_2)
    
    new 
iTime str_to_num(szTime)
    if( 
23 <= iTime <= 11 )
    {
        if( !(
get_user_flags(id) & ADMIN_RESERVATION) )
        {
            
remove_user_flags(idADMIN_USER);
            
set_user_flags(idADMIN_LEVEL_H);
            
g_FreeVip[id] = true;
            
set_hudmessage255255255, -1.00.8700.012.00.10.2, -);
            
show_hudmessage id"You get FREE VIP from %d:00 to %d:00!"Time_1Time_2)
        }
    }
    else if( 
23 <= iTime <= 11 )
    {
        if( !(
get_user_flags(id) & ADMIN_RESERVATION) )
        {
            
remove_user_flags(idADMIN_USER);
            
set_user_flags(idADMIN_LEVEL_H);
            
g_FreeVip[id] = true;
            
set_hudmessage255255255, -1.00.8700.012.00.10.2, -);
            
show_hudmessage id"You get FREE VIP from %d:00 to %d:00!"Time_1Time_2)
        }
    }
    else if( 
g_FreeVip[id] )
    {
        
remove_user_flags(idADMIN_LEVEL_H);
        
set_user_flags(idADMIN_USER);
        
g_FreeVip[id] = false;
    }

__________________

Last edited by Relaxing; 01-22-2017 at 09:26.
Relaxing is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-22-2017 , 10:11   Re: Vip free from 23:00 till 11:00
Reply With Quote #7

PHP Code:
if( 23 <= iTime <= 11 )
...
else if( 
23 <= iTime <= 11 
?
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 01-22-2017 , 10:58   Re: Vip free from 23:00 till 11:00
Reply With Quote #8

yes i know , he can put a value a little bigger with one hour , something like:

from 00:00 to 11:00
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-22-2017 , 13:11   Re: Vip free from 23:00 till 11:00
Reply With Quote #9

Or you can edit the stock and make it work:

PHP Code:
bool:is_vip_hour(iStartiEnd)
{
    new 
iHourtime(iHour)
    return 
bool:(iStart iEnd ? (iStart <= iHour iEnd) : (iStart <= iHour || iHour iEnd))

PHP Code:
if(is_vip_hour(237))
{
    
// Let the magic happen!

__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
MaXs
Member
Join Date: Jan 2017
Old 01-24-2017 , 05:45   Re: Vip free from 23:00 till 11:00
Reply With Quote #10

Compile yourself or 23to11.amxx


CODE:
Quote:
#include <amxmodx>
#include <hamsandwich>

#define PLUGIN "Free VIP"
#define VERSION "0.1"
#define AUTHOR "XTCS"

new g_FreeVip[33];
new g_Time_1, g_Time_2

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)

g_Time_1 = register_cvar("free_vip_time_from", "23")
g_Time_2 = register_cvar("free_vip_time_to", "11")

RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)

}

public fwHamPlayerSpawnPost(id)
{
new szTime[3]
get_time("%H",szTime,2)

new Time_1 = get_pcvar_num(g_Time_1)
new Time_2 = get_pcvar_num(g_Time_2)

new iTime = str_to_num(szTime)
if( 20 <= iTime <= 24 )
{
if( !(get_user_flags(id) & ADMIN_RESERVATION) )
{
remove_user_flags(id, ADMIN_USER);
set_user_flags(id, ADMIN_LEVEL_H);
g_FreeVip[id] = true;
set_hudmessage( 255, 255, 255, -1.0, 0.87, 0, 0.0, 12.0, 0.1, 0.2, -1 );
show_hudmessage ( id, "You get FREE VIP from %d:00 to %d:00!", Time_1, Time_2)
}
}
else if( 00 <= iTime <= 09 )
{
if( !(get_user_flags(id) & ADMIN_RESERVATION) )
{
remove_user_flags(id, ADMIN_USER);
set_user_flags(id, ADMIN_LEVEL_H);
g_FreeVip[id] = true;
set_hudmessage( 255, 255, 255, -1.0, 0.87, 0, 0.0, 12.0, 0.1, 0.2, -1 );
show_hudmessage ( id, "You get FREE VIP from %d:00 to %d:00!", Time_1, Time_2)
}
}
else if( g_FreeVip[id] )
{
remove_user_flags(id, ADMIN_LEVEL_H);
set_user_flags(id, ADMIN_USER);
g_FreeVip[id] = false;
}
}
MaXs 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 08:53.


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