Raised This Month: $ Target: $400
 0% 

Another issue


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Racoon
Senior Member
Join Date: Mar 2008
Location: Ukraine
Old 12-22-2010 , 12:14   Another issue
Reply With Quote #1

Seems it doesn't work...
PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Night Admins"
#define VERSION "0.1"
#define AUTHOR "Racoon"

new pcvar_night_start_hour;
new 
pcvar_night_end_hour;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
pcvar_night_start_hour register_cvar("night_start_hour""2");
    
pcvar_night_end_hour register_cvar("night_end_hour""6");
}

public 
client_putinserver(id)
{
    
set_task(5.0,"GiveAdm")
}

public 
GiveAdm(id)
{
    new 
hourminutesecond;
    new 
flags read_flags("abfiju");
    
time(hourminutesecond);
    
    if (
hour >= get_pcvar_num(pcvar_night_start_hour) && 
        
hour get_pcvar_num(pcvar_night_end_hour))
    {
        if(!
is_user_admin(id))
            return 
PLUGIN_HANDLED
        
else
            
set_user_flags(id,flags);
        
server_cmd("amx_reloadadmins");
    }
    else
    {
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_HANDLED
}

public 
client_disconnect(id)
{
    
remove_task(id)

Racoon is offline
Send a message via ICQ to Racoon
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-22-2010 , 19:24   Re: Another issue
Reply With Quote #2

Try removing the amx_reloadadmins.
__________________
fysiks is offline
Racoon
Senior Member
Join Date: Mar 2008
Location: Ukraine
Old 12-24-2010 , 06:21   Re: Another issue
Reply With Quote #3

Thx for the advice, but it didn't help. After a while I've solved the problem:
PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Night Admins"
#define VERSION "0.1"
#define AUTHOR "Racoon"

new pcvar_night_start_hour
new pcvar_night_end_hour

new hourminutesecond

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
pcvar_night_start_hour register_cvar("night_start_hour""2");
    
pcvar_night_end_hour register_cvar("night_end_hour""6");
}

public 
client_putinserver(id)
{
    new 
iFlags get_user_flags(id)
    
time(hourminutesecond)
    if (
hour >= get_pcvar_num(pcvar_night_start_hour) && 
        
hour get_pcvar_num(pcvar_night_end_hour) && (iFlags ADMIN_ALL))
        { 
            new 
flags read_flags("abfiju")
            new 
name[32]
            
get_user_name(idname31)
            
set_user_flags(id,flags)
        }

Racoon is offline
Send a message via ICQ to Racoon
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 15:02.


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