Page 1 of 1

Add Happy Hour some Flags etc Please

Posted: 07 Aug 2019, 20:07
by Infamous2017
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
| Afiseaza codul
#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 ) )
}

Re: Add Happy Hour some Flags etc Please

Posted: 08 Aug 2019, 12:30
by levin
what you want?? to give T+W+Y flags when is free vip on?
Z-is used for default(no cmds/no acc) players

Re: Add Happy Hour some Flags etc Please

Posted: 08 Aug 2019, 21:12
by Infamous2017
no. i am using an admin tag system where i added in this tag flag W for [Registered User] ... ignore this. i need only that users who have flag Z and Users who have flag Y that they get in vip time the flag T .

Re: Add Happy Hour some Flags etc Please

Posted: 08 Aug 2019, 21:16
by levin
is not working now?...the code it's ok

Re: Add Happy Hour some Flags etc Please

Posted: 08 Aug 2019, 21:59
by Infamous2017
mh? i dont see any of sma here.. or code. sure it cant work. it need to edit ... so i did an request to help me.

Re: Add Happy Hour some Flags etc Please

Posted: 08 Aug 2019, 22:16
by levin
sma is in your first post -_-

Re: Add Happy Hour some Flags etc Please

Posted: 08 Aug 2019, 22:23
by Infamous2017
i mean anyone who can add edit my sma...

Re: Add Happy Hour some Flags etc Please

Posted: 09 Aug 2019, 20:24
by Laurentiu P.
Mutat în "Modificări pluginuri".