Happyhour plugin problem

В този раздел можете да подавате всякакви заявки за намиране, изработка или преработка на плъгини/модове.
Аватар
Niiicu
Извън линия
Потребител
Потребител
Мнения: 88
Регистриран на: 24 Апр 2020, 10:01
Се отблагодари: 1 път
Получена благодарност: 1 път

Happyhour plugin problem

Мнение от Niiicu » 02 Юли 2020, 07:41

Hi, i have this happy hour plugin, everything it seems to work very well except one problem, when te happy hour is on, some of my admins they don't have vip free or lose the vip that they have before the happy hour start. What problem it can be?

Код за потвърждение: Избери целия код

#include <amxmodx> 

new const theCvar[] = "amx_default_access"

new g_Start,g_End, g_iFlag , g_iStart, g_iEnd
public plugin_init() { 
    register_plugin("Happy VIP Hour", "1.0", "Just In Case") 
    
    g_Start = register_cvar("hfh_start","22")
    g_iStart = get_pcvar_num(g_Start)
    
    g_End = register_cvar("hfh_end","10")
    g_iEnd = get_pcvar_num(g_End)
    
    g_iFlag = register_cvar("hfh_flag", "t")
    
    register_logevent("logevent_round_start", 2, "1=Round_Start") 
} 
public logevent_round_start()
{
    CheckTime()
}
public CheckTime() 
{
    static szString[2]
    get_pcvar_string(g_iFlag, szString, charsmax(szString))
    if(is_happy_hour(g_iStart, g_iEnd))
    {
	set_cvar_string(theCvar, szString)
    }
    else {
        set_cvar_string(theCvar, "z")
    }
    server_cmd("amx_reloadadmins");
}     

bool:is_happy_hour(const iStart, const iEnd) {
    new iHour; time(iHour)
    return bool:(iStart < iEnd ? (iStart <= iHour < iEnd) : (iStart <= iHour || iHour < iEnd))
}
CS.AVENGERSCS.RO - Classic

Аватар
V.A.L.V.E
Извън линия
Потребител
Потребител
Мнения: 445
Регистриран на: 18 Дек 2016, 22:48
Се отблагодари: 110 пъти
Получена благодарност: 71 пъти
Обратна връзка:

Happyhour plugin problem

Мнение от V.A.L.V.E » 03 Юли 2020, 02:02

I think your admins have already this flags and when happy hour start, they are flags with vips are removed.
If that's true, just remove admins vip flags and problem is solved. I'm not sure do this is correct but try it.

Аватар
Orangegame14
Извън линия
Потребител
Потребител
Мнения: 87
Регистриран на: 02 Апр 2020, 22:48
Се отблагодари: 6 пъти
Получена благодарност: 24 пъти

Happyhour plugin problem

Мнение от Orangegame14 » 03 Юли 2020, 09:52

I think you can try this but im not quite sure it will work. Also replace the arguments of "flags of the admins/vips" and "b" to the flags they should be.

Код за потвърждение: Избери целия код

if(is_happy_hour(g_iStart, g_iEnd))
    {
	set_cvar_string(theCvar, szString)
    }
to this

Код за потвърждение: Избери целия код

if(is_happy_hour(g_iStart, g_iEnd))
{
	new players[32], num, player;
	get_players( players, num, "a" );
	
	for( new i = 0; i < num; i++ )
	if(get_user_flags(player) = "flags of the admins/vips")
	{
		return
	}
	if(get_user_flags(player) = "z")
	{
		new players[32], num, player;
		get_players( players, num, "a" );
	
		for( new i = 0; i < num; i++ )

		set_user_flags(player, "b", 0) //note that i dont know which is the flag you would want to put instead of "b"
	}
}
Just saying again - not sure, but it kinda makes sense to me. :D You might also have to remove something from the code if you try this way.

Аватар
atmax
Извън линия
Потребител
Потребител
Мнения: 492
Регистриран на: 22 Мар 2018, 15:06
Се отблагодари: 37 пъти
Получена благодарност: 43 пъти

Happyhour plugin problem

Мнение от atmax » 03 Юли 2020, 10:37

Why you are getting all players with "players" while using a loop for this, or maybe I'm missing something because I need sleep? And what is the point of this plugin? Maybe giving free flags when it's happy hour?
Rest in peace my friend I always will remember you! 🖤👊

Аватар
JackEyedJones
Извън линия
Потребител
Потребител
Мнения: 399
Регистриран на: 10 Сеп 2018, 17:26
Местоположение: Plovdiv, Bulgaria, Europe, Entire World
Се отблагодари: 4 пъти
Получена благодарност: 69 пъти
Обратна връзка:

Happyhour plugin problem

Мнение от JackEyedJones » 03 Юли 2020, 12:14

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <amxmisc>

#define VIP_FLAGS "acdeiu"

new g_Start, g_End, g_iStart, g_iEnd

public plugin_init() 
{ 
    	register_plugin("Happy VIP Hour", "1.0", "Just In Case") 
    
    	g_Start = register_cvar("hfh_start","22")
    	g_iStart = get_pcvar_num(g_Start)
    
    	g_End = register_cvar("hfh_end","10")
    	g_iEnd = get_pcvar_num(g_End)

    	register_logevent("logevent_round_start", 2, "1=Round_Start") 
} 

public logevent_round_start()
{
    	CheckTime()
}

public CheckTime() 
{
    	new players[32], num;
	get_players( players, num, "a" );
	
	for( new i = 0, iPlayer; i < num; i++ )
	{
		iPlayer = players[i];

		if(!is_user_connected(iPlayer))
			return;

		if(is_happy_hour(g_iStart, g_iEnd) && !is_user_admin(iPlayer))
			set_user_flags(iPlayer, read_flags(VIP_FLAGS))
	}
}     

bool:is_happy_hour(const iStart, const iEnd) 
{
    	new iHour; time(iHour)
    	return bool:(iStart < iEnd ? (iStart <= iHour < iEnd) : (iStart <= iHour || iHour < iEnd))
}
The whole principle of writing this plugin is wrong, at least at first look.
In order to bypass (or skip) the current vips or admins online and avoid affecting their flags, you have to check if they are already admins.

Код за потвърждение: Избери целия код

if(is_happy_hour(g_iStart, g_iEnd) && !is_user_admin(iPlayer))
No such thing in this.

Код за потвърждение: Избери целия код

if(get_user_flags(player) = "z")

Аватар
Niiicu
Извън линия
Потребител
Потребител
Мнения: 88
Регистриран на: 24 Апр 2020, 10:01
Се отблагодари: 1 път
Получена благодарност: 1 път

Happyhour plugin problem

Мнение от Niiicu » 04 Юли 2020, 07:43

JackEyedJones написа: 03 Юли 2020, 12:14

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <amxmisc>

#define VIP_FLAGS "acdeiu"

new g_Start, g_End, g_iStart, g_iEnd

public plugin_init() 
{ 
    	register_plugin("Happy VIP Hour", "1.0", "Just In Case") 
    
    	g_Start = register_cvar("hfh_start","22")
    	g_iStart = get_pcvar_num(g_Start)
    
    	g_End = register_cvar("hfh_end","10")
    	g_iEnd = get_pcvar_num(g_End)

    	register_logevent("logevent_round_start", 2, "1=Round_Start") 
} 

public logevent_round_start()
{
    	CheckTime()
}

public CheckTime() 
{
    	new players[32], num;
	get_players( players, num, "a" );
	
	for( new i = 0, iPlayer; i < num; i++ )
	{
		iPlayer = players[i];

		if(!is_user_connected(iPlayer))
			return;

		if(is_happy_hour(g_iStart, g_iEnd) && !is_user_admin(iPlayer))
			set_user_flags(iPlayer, read_flags(VIP_FLAGS))
	}
}     

bool:is_happy_hour(const iStart, const iEnd) 
{
    	new iHour; time(iHour)
    	return bool:(iStart < iEnd ? (iStart <= iHour < iEnd) : (iStart <= iHour || iHour < iEnd))
}
The whole principle of writing this plugin is wrong, at least at first look.
In order to bypass (or skip) the current vips or admins online and avoid affecting their flags, you have to check if they are already admins.

Код за потвърждение: Избери целия код

if(is_happy_hour(g_iStart, g_iEnd) && !is_user_admin(iPlayer))
No such thing in this.

Код за потвърждение: Избери целия код

if(get_user_flags(player) = "z")
Thank you, i will try it and replay here :)
CS.AVENGERSCS.RO - Classic

Публикувай отговор
  • Подобни теми
    Отговори
    Преглеждания
     Последно мнение

Обратно към “Заявки за плъгини”

Кой е на линия

Потребители разглеждащи този форум: 0 регистрирани и 21 госта