AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Command at a specific time or when the admin is online (https://forums.alliedmods.net/showthread.php?t=334488)

theuser 09-28-2021 04:06

Command at a specific time or when the admin is online
 
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

CrazY. 09-28-2021 09:04

Re: Command at a specific time or when the admin is online
 
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)
        }
}



All times are GMT -4. The time now is 20:39.

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