Raised This Month: $ Target: $400
 0% 

Command at a specific time or when the admin is online


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
theuser
Member
Join Date: Jul 2020
Old 09-28-2021 , 04:06   Command at a specific time or when the admin is online
Reply With Quote #1

A plugin that changes commands on the server at a specific time of day?
For example, at 12 o'clock at night == > mp_freezetime 0
And for 8 o'clock in the morning ==> mp_freezetime 5


Or when an admin is on the online server == > mp_freezetime 0
And when the admin is not on the online server ==> mp_freezetime 60
theuser is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 09-28-2021 , 09:04   Re: Command at a specific time or when the admin is online
Reply With Quote #2

Quote:
Or when an admin is on the online server == > mp_freezetime 0
And when the admin is not on the online server ==> mp_freezetime 60

Code:
#include <amxmodx>
#include <amxmisc>

new cv_mp_freezetime

public plugin_init()
{
	register_plugin("Plugin", "Version", "Author")
}

public plugin_cfg()
{
	cv_mp_freezetime = get_cvar_pointer("mp_freezetime")
}

public client_authorized(index)
{
	set_task(1.0, "CheckAdmin", index)
}

#if AMXX_VERSION_NUM < 183
public client_disconnect(index)
#else
public client_remove(index)
#endif
{
	new players[32], admin_count, count
	get_players(players, count, "ch")

	for (new i = 0, player; i < count; i++)
	{
		player = players[i]

		if (player == index || !is_user_admin(player))
			continue
			
		admin_count++
		break
	}

	if (admin_count == 0)
	{
		set_pcvar_float(cv_mp_freezetime, 60.0)
	}
}

public CheckAdmin(index)
{
	if (is_user_admin(index))
	{
		set_pcvar_float(cv_mp_freezetime, 0.0)
	}
}
__________________









Last edited by CrazY.; 09-28-2021 at 09:06.
CrazY. is offline
Reply



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 00:29.


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