Raised This Month: $ Target: $400
 0% 

what´s wrong in this code (admin_check with delay cvar)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bugg
Senior Member
Join Date: Jan 2012
Old 08-17-2012 , 10:38   what´s wrong in this code (admin_check with delay cvar)
Reply With Quote #1

Hi.

I modified this pluggin --> http://forums.alliedmods.net/showthread.php?p=230189

This pluggins works with a clcmd /say admin

But i try to modified with a task with cvar.

what´s wrong??

PHP Code:
#include <amxmodx>

/*---------------EDIT ME------------------*/
#define ADMIN_CHECK ADMIN_KICK
#define TASKID_ANNOUNCE 219348092123573721

static const COLOR[] = "^x04" //green
static const CONTACT[] = ""
/*----------------------------------------*/
new cvar_delay
new maxplayers
new gmsgSayText

public plugin_init() {
    
register_plugin("Admin Check""1.51""OneEyed")
    
maxplayers get_maxplayers()
    
gmsgSayText get_user_msgid("SayText")
    
    
register_cvar("amx_contactinfo"CONTACTFCVAR_SERVER)
    
cvar_delay register_cvar("admins_delay""30.0")
    
}

public 
plugin_postinit()
{
if (
get_pcvar_float(cvar_delay) > 0.0)
        if (!
task_exists(TASKID_ANNOUNCE))
            
set_task(get_pcvar_float(cvar_delay), "print_adminlist"TASKID_ANNOUNCE""0"b")
    
return 
PLUGIN_CONTINUE
}    


public 
print_adminlist(user
{
    new 
adminnames[33][32]
    new 
message[256]
    new 
contactinfo[256], contact[112]
    new 
idcountxlen
    
    
for(id id <= maxplayers id++)
        if(
is_user_connected(id))
            if(
get_user_flags(id) & ADMIN_CHECK)
                
get_user_name(idadminnames[count++], 31)

    
len format(message255"%s ADMINS ONLINE: ",COLOR)
    if(
count 0) {
        for(
count x++) {
            
len += format(message[len], 255-len"%s%s "adminnames[x], < (count-1) ? ", ":"")
            if(
len 96 ) {
                
print_message(usermessage)
                
len format(message255"%s ",COLOR)
            }
        }
        
print_message(usermessage)
    }
    else {
        
len += format(message[len], 255-len"No admins online.")
        
print_message(usermessage)
    }
    
    
get_cvar_string("amx_contactinfo"contact63)
    if(
contact[0])  {
        
format(contactinfo111"%s Contact Server Admin -- %s"COLORcontact)
        
print_message(usercontactinfo)
    }
}

print_message(idmsg[]) {
    
message_begin(MSG_ONEgmsgSayText, {0,0,0}, id)
    
write_byte(id)
    
write_string(msg)
    
message_end()

Nothing happens... with the pluggin , not work....

what´s wrong?

Thx.
Bugg is offline
pokemonmaster
princess milk
Join Date: Nov 2010
Location: Somewhere in this world
Old 08-17-2012 , 11:01   Re: what´s wrong in this code (admin_check with delay cvar)
Reply With Quote #2

Add this to plugin_init as there is no such a forward called plugin_postini()
PHP Code:
set_task(0.1"plugin_postinit"
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
No longer active in AMXX. Sorry.
pokemonmaster is offline
Bugg
Senior Member
Join Date: Jan 2012
Old 08-17-2012 , 12:29   Re: what´s wrong in this code (admin_check with delay cvar)
Reply With Quote #3

look that-->

I tried to do too-->

PHP Code:
#include <amxmodx>

/*---------------EDIT ME------------------*/
#define ADMIN_CHECK ADMIN_KICK
#define TASKID_ANNOUNCE 219348092123573721

static const COLOR[] = "^x04" //green
static const CONTACT[] = ""
/*----------------------------------------*/
new cvar_delay
new maxplayers
new gmsgSayText

public plugin_init() {
    
register_plugin("Admin Check""1.51""OneEyed")
    
maxplayers get_maxplayers()
    
gmsgSayText get_user_msgid("SayText")
    
    
register_cvar("amx_contactinfo"CONTACTFCVAR_SERVER)
    
cvar_delay register_cvar("admins_delay""30.0")

        if (
get_pcvar_float(cvar_delay) > 0.0)
        if (!
task_exists(TASKID_ANNOUNCE))
            
set_task(get_pcvar_float(cvar_delay), "print_adminlist"TASKID_ANNOUNCE""0"b")

    
}




public 
print_adminlist(user
{
    new 
adminnames[33][32]
    new 
message[256]
    new 
contactinfo[256], contact[112]
    new 
idcountxlen
    
    
for(id id <= maxplayers id++)
        if(
is_user_connected(id))
            if(
get_user_flags(id) & ADMIN_CHECK)
                
get_user_name(idadminnames[count++], 31)

    
len format(message255"%s ADMINS ONLINE: ",COLOR)
    if(
count 0) {
        for(
count x++) {
            
len += format(message[len], 255-len"%s%s "adminnames[x], < (count-1) ? ", ":"")
            if(
len 96 ) {
                
print_message(usermessage)
                
len format(message255"%s ",COLOR)
            }
        }
        
print_message(usermessage)
    }
    else {
        
len += format(message[len], 255-len"No admins online.")
        
print_message(usermessage)
    }
    
    
get_cvar_string("amx_contactinfo"contact63)
    if(
contact[0])  {
        
format(contactinfo111"%s Contact Server Admin -- %s"COLORcontact)
        
print_message(usercontactinfo)
    }
}

print_message(idmsg[]) {
    
message_begin(MSG_ONEgmsgSayText, {0,0,0}, id)
    
write_byte(id)
    
write_string(msg)
    
message_end()

but server crash

Mmm Server shutting down i think... why?

Last edited by Bugg; 08-17-2012 at 12:30.
Bugg is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 08-17-2012 , 15:56   Re: what´s wrong in this code (admin_check with delay cvar)
Reply With Quote #4

Well , you want to print the admins online by a task instead of commands ( like /admin or / who ) ?
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
Bugg
Senior Member
Join Date: Jan 2012
Old 08-17-2012 , 16:32   Re: what´s wrong in this code (admin_check with delay cvar)
Reply With Quote #5

Just that.

But server crash ---> with the last code --> Server shutting down.
Bugg is offline
Old 08-17-2012, 16:32
MokeN
This message has been deleted by MokeN. Reason: Wrong
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 08-17-2012 , 16:47   Re: what´s wrong in this code (admin_check with delay cvar)
Reply With Quote #6

Spoiler
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.

Last edited by lucas_7_94; 08-17-2012 at 19:18.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
Bugg
Senior Member
Join Date: Jan 2012
Old 08-17-2012 , 17:25   Re: what´s wrong in this code (admin_check with delay cvar)
Reply With Quote #7

Bufff, 100% new code xD.

Thx, i go to test.

EDIT:

Works, but only print 1 admin online, if we are 2 admins connected, or 3, or 4 or 5... only print in chat 1 admin online...

Last edited by Bugg; 08-17-2012 at 17:59.
Bugg is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 08-17-2012 , 19:19   Re: what´s wrong in this code (admin_check with delay cvar)
Reply With Quote #8

Try again.
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
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 21:59.


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