Raised This Month: $51 Target: $400
 12% 

Head Admins, Admins and VIP Online


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 06-29-2011 , 17:21   Head Admins, Admins and VIP Online
Reply With Quote #1

Hey guys, I made my own script of dividing the types of administrators when typing /admins ingame (showing the admins currently online) to 3 types.

Head Admin (in my language its called 'Rashi' instead of 'Head' so you'd notice that in my code)

Admin

VIP



It divides them that when HEad Admin is detected if he has ADMIN_IMMUNITY
Admin if he has ADMIN_LEVEL_A (cuz i didnt give that to the VIP) and VIP as ADMIN_KICK (you can see what each gets in the code, it is written at the beginning)

Still, when I type ingame /admins or /admin or /vip, the same old "ADMINS: No admins online" message appears in chat.

Whats wrong with what i'm doing?? Help please!

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <chatcolor>

#define PLUGIN "Admins and VIP"
#define VERSION "1.0"
#define AUTHOR "p1Mp"

/***********************************************************\
*                   VIP and ADMINS ACCESS                   *
*                                                           *
*        VIP Flags - C, J                                   *
*        Admins Flags - C, D, E, F, I, J  + ALL LEVELS      *
*        Head Admins Flags - ALL except Z                   *
*                                                           *
\***********************************************************/


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /admin""AVIP")
    
register_clcmd("say /admins""AVIP")
    
register_clcmd("say /vip""AVIP")
}

public 
AVIP(id)
{
    new 
Rashi[5], rCounter 0
    
new Admins[16], aCounter 0
    
new VIP[16], vCounter 0
    
new MaxP[32], pCounterplayer
    
    get_players
(MaxPpCounter"ch")
    
    for (new 
i=i<pCounter i++)         // Counts how much Head Admins, Admins and VIP ARE ONLINE RIGHT NOW (Each has its own
    
{                                                 // counter, look at rCounter, aCounter and vCounter)
        
player MaxP[i]
        
        if (
access(playerADMIN_KICK))
        {
            
            if (
access(playerADMIN_LEVEL_A))
            {
                
                if (
access(playerADMIN_IMMUNITY))
                {
                    
Rashi[rCounter] = player
                    rCounter
++
                    continue;
                }
                
                
Admins[aCounter] = player
                aCounter
++
                continue;
            }
            
            
VIP[vCounter] = player
            vCounter
++
            continue;
        }
    }
    
    
    
    if (
rCounter == 0)    // If no Head Admins are online
    
{
        
client_print_color(idGREEN"^4Admins Rashi Online: No Admins Rashi online.")
    }
    
    else
    {
        new 
ronline[200] = "^4Admins Rashi Online: "
        
        
for (new z=z<rCounter z++)
        {
            new 
zname[32]
            
get_user_name(rCounterzname31)
            
add(ronline31zname)
            
            if (
== rCounter-1)
            {
                
add(ronline2".")
            }
            
            else 
            {
                
add(ronline3", ")
            }
            
        }
        
client_print_color(idGREEN"^4Admins Rashi Online: %s."ronline)
    }
    
    if (
aCounter == 0)        // If no regular admins are online
    
{
        
client_print_color(idGREEN"^4Admins Online: No Admins online.")
    }
    
    else
    {
        new 
aonline[200] = "^4Admins Online: "
        
        
for (new z=z<aCounter z++)
        {
            new 
aname[32]
            
get_user_name(aCounteraname31)
            
add(aonline31aname)
            
            if (
== aCounter-1)
            {
                
add(aonline2".")
            }
            
            else 
            {
                
add(aonline3", ")
            }
            
        }
        
        
client_print_color(idGREEN"^4Admins Online: %s."aonline)
    }
    
    if (
vCounter == 0)         // If VIP are not online
    
{
        
client_print_color(idGREEN"^4VIP Online: No VIP online.")
    }
    
    else
    {
        new 
vonline[200] = "^4VIP Online: "
        
        
for (new z=z<vCounter z++)
        {
            new 
vname[32]
            
get_user_name(vCountervname31)
            
add(vonline31vname)
            
            if (
== vCounter-1)
            {
                
add(vonline2".")
            }
            
            else 
            {
                
add(vonline3", ")
            }
            
        }
        
        
client_print_color(idGREEN"^4VIP Online: %s."vonline)
    }

NOTE: The #include <chatcolor> was from the link HERE, and it was compiled through files in my computer so it can read that .inc file, and it didnt report any errors

ALSO!!!!! when I uploaded the .amxx to my server I placed it the first at the plugins.ini file so the effect will take on this and not the AMX Super normal /admins command we all know (ADMINS: Admins Not online, or ADMINS: [admins list])









Thanks alot to whoever helps me!!!

Last edited by Diegorkable; 06-29-2011 at 17:24.
Diegorkable is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-29-2011 , 17:51   Re: Head Admins, Admins and VIP Online
Reply With Quote #2

I fixed up the section for Rashi and you can take the lessons from there to apply to the other two cases:

PHP Code:
    if (rCounter == 0)    // If no Head Admins are online
    
{
        
client_print_color(idGREEN"^4Admins Rashi Online: No Admins Rashi online.")
    }
    else
    {
        new 
ronline[200]
        new 
zname[32], iRashiID
        
        
for (new z=z<rCounter z++)
        {
            
iRashiID Rashi[z]
            
get_user_name(iRashiIDzname31)
            
add(ronlinecharsmax(ronline), zname)
            
            if (
!= rCounter-1)
            {
                
add(ronlinecharsmax(ronline), ", ")
            }
            
        }
        
client_print_color(idGREEN"^4Admins Rashi Online: %s."ronline)
    } 
Remember that the second argument of add() and copy() and other similar uses of "array[], len" is the maximum number of characters that the array can hold. So, to make it easy, there is a simple precompiler function for that called charsmax(arrayname) as you can see above.

Also, remember to never create variables inside of a loop. Create them once outside then assign and use them inside the loop.

EDIT: Oh, and try removing amx_super while testing to make sure your plugin is actually running. If everything works fine then add it back and test again. I think you may need to return PLUGIN_HANDLED or PLUGIN_HANDLED_MAIN at the end of your function to prevent amx_super from catching the say commands.
__________________

Last edited by fysiks; 06-29-2011 at 17:56.
fysiks is offline
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 06-30-2011 , 02:49   Re: Head Admins, Admins and VIP Online
Reply With Quote #3

Silly me, Thank you very much fysiks!!
I'll make sure to try it when I'm back home and post here weither it works or not

I really appreciate your time
Diegorkable is offline
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 06-30-2011 , 08:15   Re: Head Admins, Admins and VIP Online
Reply With Quote #4

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <chatcolor>

#define PLUGIN "Admins and VIP"
#define VERSION "1.0"
#define AUTHOR "p1Mp"

/***********************************************************\
*                   VIP and ADMINS ACCESS                   *
*                                                           *
*        VIP Flags - C, J                                   *
*        Admins Flags - C, D, E, F, I, J  + ALL LEVELS      *
*        Head Admins Flags - ALL except Z                   *
*                                                           *
\***********************************************************/


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /admin""AVIP")
    
register_clcmd("say /admins""AVIP")
    
register_clcmd("say /vip""AVIP")
}

public 
AVIP(id)
{
    new 
Rashi[5], rCounter 0
    
new Admins[16], aCounter 0
    
new VIP[16], vCounter 0
    
new MaxP[32], pCounterplayer
    
    get_players
(MaxPpCounter"ch")
    
    for (new 
i=i<pCounter i++)
    {
        
player MaxP[i]
        
        if (
access(playerADMIN_KICK))
        {
            
            if (
access(playerADMIN_LEVEL_A))
            {
                
                if (
access(playerADMIN_IMMUNITY))
                {
                    
Rashi[rCounter] = player
                    rCounter
++
                    continue;
                }
                
                
Admins[aCounter] = player
                aCounter
++
                continue;
            }
            
            
VIP[vCounter] = player
            vCounter
++
            continue;
        }
    }
    
    
    
    if (
rCounter == 0)    // If no Head Admins are online 
    

        
client_print_color(idGREEN"^4Admins Rashi Online: No Admins Rashi online."
    } 
    else 
    { 
        new 
ronline[200
        new 
zname[32], iRashiID 
         
        
for (new z=z<rCounter z++) 
        { 
            
iRashiID Rashi[z
            
get_user_name(iRashiIDzname31
            
add(ronlinecharsmax(ronline), zname
             
            if (
!= rCounter-1
            { 
                
add(ronlinecharsmax(ronline), ", "
            } 
            
            else
            {
                
add(ronlinecharsmax(ronline), ".")
            }
        
             
        }
        
client_print_color(idGREEN"^4Admins Rashi Online: %s."ronline
    }  
    
    if (
aCounter == 0)    // If no Admins are online 
    

        
client_print_color(idGREEN"^4Admins Online: No Admins online."
    } 
    else 
    { 
        new 
aonline[200
        new 
aname[32], iAdminID 
         
        
for (new z=z<aCounter z++) 
        { 
            
iAdminID Admins[z
            
get_user_name(iAdminIDaname31
            
add(aonlinecharsmax(aonline), aname
             
            if (
!= aCounter-1
            { 
                
add(aonlinecharsmax(aonline), ", "
            } 
        
            else
            {
                
add(aonlinecharsmax(aonline), ".")
            }
        
             
        }
        
client_print_color(idGREEN"^4Admins Online: %s."aonline
    }
    
    if (
vCounter == 0)    // If no VIP are online 
    

        
client_print_color(idGREEN"^4VIP Online: No VIP online."
    } 
    else 
    { 
        new 
vonline[200
        new 
vname[32], iVIPID 
         
        
for (new z=z<vCounter z++) 
        { 
            
iVIPID VIP[z
            
get_user_name(iVIPIDvname31
            
add(vonlinecharsmax(vonline), vname
             
            if (
!= vCounter-1
            { 
                
add(vonlinecharsmax(vonline), ", "
            } 
        
            else
            {
                
add(vonlinecharsmax(vonline), ".")
            }
        
             
        }
        
client_print_color(idGREEN"^4VIP Online: %s."vonline
        
    }
    
    return 
PLUGIN_HANDLED_MAIN

Editted the way you said and still didn't work... when I type /vip it doesnt type anything ingame, and you can see that I wrote it in chat therefore you can see the PLUGIN_HANDLED_MAIN doesnt work for some reason, and it prints the old /admins, why?? (only when I type /admin or /admins, not /vip, like the /admins CMD from AMX Super, and i've placed it first at the file of plugins.ini...
Diegorkable is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 06-30-2011 , 08:17   Re: Head Admins, Admins and VIP Online
Reply With Quote #5

you could just use 1 for loop to get the num of all types of admins and just print what you need
jimaway is offline
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 06-30-2011 , 08:38   Re: Head Admins, Admins and VIP Online
Reply With Quote #6

But that's not my question now bro, I really don't know why the script wouldnt work, you can see the /admins command typed ingame, meaning "return PLUGIN_HANDLED_MAIN" doesnt works, and it types the old /admin, and the *.amxx file of it is at the top of the list in my server files at plugins.ini, so it should take effect than the old /admins, so why isn't it working?? someone help please..
Diegorkable is offline
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 06-30-2011 , 09:31   Re: Head Admins, Admins and VIP Online
Reply With Quote #7

UPDATE: I removed the /admins and /admin command from amx_super.sma in my server and uploaded my plugin, still it doesnt type what it should type...
Diegorkable is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-30-2011 , 15:22   Re: Head Admins, Admins and VIP Online
Reply With Quote #8

I tested it on my Counter-Strike server and it works for me by itself. You still didn't do everything that I showed you above. You didn't remove:

PHP Code:
            else 
            { 
                
add(ronlinecharsmax(ronline), "."
            } 
This code causes double "." but I guess you would see that if you could get it to work .
__________________
fysiks is offline
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 06-30-2011 , 15:48   Re: Head Admins, Admins and VIP Online
Reply With Quote #9

So what does it mean?!?!?! How do I fix it?!?!
by removing the "ELSE"

fysiks dude, I tried once to copy-paste your edit to the Rashi part and paste it in my code instead of the one(rashi part) already existing, and it didn't work.... why is that??

This is my current code:

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <chatcolor>

#define PLUGIN "Admins and VIP"
#define VERSION "1.0"
#define AUTHOR "p1Mp"

/***********************************************************\
*                   VIP and ADMINS ACCESS                   *
*                                                           *
*        VIP Flags - C, J                                   *
*        Admins Flags - C, D, E, F, I, J  + ALL LEVELS      *
*        Head Admins Flags - ALL except Z                   *
*                                                           *
\***********************************************************/


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /admin""show_admins")
    
register_clcmd("say /admins""show_admins")
    
register_clcmd("say /vip""show_admins")
}

public 
show_admins(id)
{
    new 
Rashi[5], rCounter 0
    
new Admins[16], aCounter 0
    
new VIP[16], vCounter 0
    
new MaxP[32], pCounterplayer
    
    get_players
(MaxPpCounter"ch")
    
    for (new 
i=i<pCounter i++)
    {
        
player MaxP[i]
        
        if (
access(playerADMIN_KICK))
        {
            
            if (
access(playerADMIN_LEVEL_A))
            {
                
                if (
access(playerADMIN_IMMUNITY))
                {
                    
Rashi[rCounter] = player
                    rCounter
++
                    continue;
                }
                
                
Admins[aCounter] = player
                aCounter
++
                continue;
            }
            
            
VIP[vCounter] = player
            vCounter
++
            continue;
        }
    }
    
    
    
    if (
rCounter == 0)    // If no Head Admins are online 
    

        
client_print_color(idGREEN"^4Admins Rashi Online: No Admins Rashi online."
    } 
    else 
    { 
        new 
ronline[200
        new 
zname[32], iRashiID 
         
        
for (new z=z<rCounter z++) 
        { 
            
iRashiID Rashi[z
            
get_user_name(iRashiIDzname31
            
add(ronlinecharsmax(ronline), zname
             
            if (
!= rCounter-1
            { 
                
add(ronlinecharsmax(ronline), ", "
            } 
             
        } 
        
client_print_color(idGREEN"^4Admins Rashi Online: %s."ronline
    }  
    
    if (
aCounter == 0)    // If no Admins are online 
    

        
client_print_color(idGREEN"^4Admins Online: No Admins online."
    } 
    else 
    { 
        new 
aonline[200
        new 
aname[32], iAdminID 
         
        
for (new z=z<aCounter z++) 
        { 
            
iAdminID Admins[z
            
get_user_name(iAdminIDaname31
            
add(aonlinecharsmax(aonline), aname
             
            if (
!= aCounter-1
            { 
                
add(aonlinecharsmax(aonline), ", "
            } 
        

        }
        
client_print_color(idGREEN"^4Admins Online: %s."aonline
    }
    
    if (
vCounter == 0)    // If no VIP are online 
    

        
client_print_color(idGREEN"^4VIP Online: No VIP online."
    } 
    else 
    { 
        new 
vonline[200
        new 
vname[32], iVIPID 
         
        
for (new z=z<vCounter z++) 
        { 
            
iVIPID VIP[z
            
get_user_name(iVIPIDvname31
            
add(vonlinecharsmax(vonline), vname
             
            if (
!= vCounter-1
            { 
                
add(vonlinecharsmax(vonline), ", "
            } 
             
        }
        
client_print_color(idGREEN"^4VIP Online: %s."vonline
        
    }
    

Please try and spot what's wrong in it fysiks, or atleast send me the WHOLE code you compiled and tested on your server, cuz I really need to have it in my server ASAP.

Last edited by Diegorkable; 06-30-2011 at 16:03.
Diegorkable is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-30-2011 , 16:41   Re: Head Admins, Admins and VIP Online
Reply With Quote #10

I just tested with the code you posted and it works fine. The only thing that I changed is that I use the color chat stock by Connor so I had to change the include from chatcolor to colorchat.

Are you using the color chat native by Connor? If no, what are you using, post your chatcolor.inc.
__________________
fysiks 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:20.


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