Raised This Month: $ Target: $400
 0% 

Admin level connect !


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kimi
Member
Join Date: Nov 2007
Location: Home...
Old 01-23-2008 , 09:14   Admin level connect !
Reply With Quote #1

DELETED
__________________
[img]http://img100.**************/img100/7245/unititledja1.png[/img]


Last edited by Kimi; 01-24-2008 at 06:20.
Kimi is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-23-2008 , 13:38   Re: Admin level connect !
Reply With Quote #2

Today , 15:14
Today , 193

__________________
Arkshine is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-23-2008 , 15:44   Re: Admin level connect !
Reply With Quote #3

way too much code.

loops are your friend

Code:
#include <amxmodx>

#define PLUGIN "Plugin"
#define VERSION "1.0"
#define AUTHOR "Author"

#define ADMINTYPES 6

new const g_AdminFlags[ADMINTYPES][] =
{
    "abcdefghijklmnopqrtu",
    "abcdefghijlmnpsu",
    "bcdefijlmnpr",
    "bcdefijlpq",
    "bcfij",
    "b"
};
new const g_AdminTypes[ADMINTYPES][] =
{
    "captain",
    "sargeant",
    "officer",
    "lieutenant",
    "user",
    "personnel"
};
new g_AdminLevels[ADMINTYPES][32];
new g_AdminFlagsSum[ADMINTYPES];
new g_NumberWords[ADMINTYPES][4];

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR);
}

public plugin_cfg()
{
    for(new i=0; i < ADMINTYPES; i++)
    {
        formatex(g_AdminLevels[i], 31, "Level %i", i+1);
        g_AdminFlagsSum[i] = read_flags(g_AdminFlags[i]);
        num_to_word(i+1, g_NumberWords[i], 3);
    }
}

public client_authorized(id)
{
    set_task(1.0, "task_DelayConnect", id);
    return PLUGIN_CONTINUE;
}

public client_disconnect(id)
{
    new flags = get_user_flags(id);
    for(new i=0; i < ADMINTYPES; i++)
    {
        if(flags == g_AdminFlagsSum[i])
        {
            new name[32];
            get_user_name(id, name, 31);
            
            set_hudmessage(85, 212, 255, 0.10, 0.55, 1, 6.0, 6.0, 0.5, 0.15, 1);
            show_hudmessage(0, "ADMIN %s: %s has left the game!", name, g_AdminLevels[i]);
            client_cmd(0, "spk ^"vox/level %s administration %s deacivated^"", g_NumberWords[i], g_AdminTypes[i]);
            return PLUGIN_CONTINUE;
        }
    }
    return PLUGIN_CONTINUE;
}

public task_DelayConnect(id)
{
    if(!is_user_connected(id))
        return;
    
    new flags = get_user_flags(id);
    for(new i=0; i < ADMINTYPES; i++)
    {
        if(flags == g_AdminFlagsSum[i])
        {
            new name[32];
            get_user_name(id, name, 31);
            
            set_hudmessage(85, 212, 255, 0.10, 0.55, 1, 6.0, 6.0, 0.5, 0.15, 1);
            show_hudmessage(0, "ADMIN %s: %s is trying to connect!", name, g_AdminLevels[i]);
            client_cmd(0, "spk ^"vox/level %s administration %s acivated^"", g_NumberWords[i], g_AdminTypes[i]);
            break;
        }
    }
}
im sure it could be shortened more, but i got lazy :\
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
jageassyrian
Senior Member
Join Date: Jul 2007
Old 01-23-2008 , 23:17   Re: Admin level connect !
Reply With Quote #4

Can you change this to only 2 different types and make it appear in the middle of everyones screen In white?
jageassyrian is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-24-2008 , 07:15   Re: Admin level connect !
Reply With Quote #5

Code:
#include <amxmodx>

#define PLUGIN "Plugin"
#define VERSION "1.0"
#define AUTHOR "Author"

#define ADMINTYPES 2

new const g_AdminFlags[ADMINTYPES][] =
{
    "abcdefghijklmnopqrtu",
    "abcdefghijlmnpsu"
};
new const g_AdminTypes[ADMINTYPES][] =
{
    "captain",
    "sargeant"
};
new g_AdminLevels[ADMINTYPES][32];
new g_AdminFlagsSum[ADMINTYPES];
new g_NumberWords[ADMINTYPES][4];

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR);
}

public plugin_cfg()
{
    for(new i=0; i < ADMINTYPES; i++)
    {
        formatex(g_AdminLevels[i], 31, "Level %i", i+1);
        g_AdminFlagsSum[i] = read_flags(g_AdminFlags[i]);
        num_to_word(i+1, g_NumberWords[i], 3);
    }
}

public client_authorized(id)
{
    set_task(1.0, "task_DelayConnect", id);
    return PLUGIN_CONTINUE;
}

public client_disconnect(id)
{
    new flags = get_user_flags(id);
    for(new i=0; i < ADMINTYPES; i++)
    {
        if(flags == g_AdminFlagsSum[i])
        {
            new name[32];
            get_user_name(id, name, 31);
            
            set_hudmessage(255, 255, 255, -1.0, -1.0, 0, 6.0, 6.0, 0.5, 0.15, 1);
            show_hudmessage(0, "ADMIN %s: %s has left the game!", name, g_AdminLevels[i]);
            client_cmd(0, "spk ^"vox/level %s administration %s deacivated^"", g_NumberWords[i], g_AdminTypes[i]);
            return PLUGIN_CONTINUE;
        }
    }
    return PLUGIN_CONTINUE;
}

public task_DelayConnect(id)
{
    if(!is_user_connected(id))
        return;
    
    new flags = get_user_flags(id);
    for(new i=0; i < ADMINTYPES; i++)
    {
        if(flags == g_AdminFlagsSum[i])
        {
            new name[32];
            get_user_name(id, name, 31);
            
            set_hudmessage(255, 255, 255, -1.0, -1.0, 0, 6.0, 6.0, 0.5, 0.15, 1);
            show_hudmessage(0, "ADMIN %s: %s is trying to connect!", name, g_AdminLevels[i]);
            client_cmd(0, "spk ^"vox/level %s administration %s acivated^"", g_NumberWords[i], g_AdminTypes[i]);
            break;
        }
    }
}
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Kimi
Member
Join Date: Nov 2007
Location: Home...
Old 01-24-2008 , 13:34   Re: Admin level connect !
Reply With Quote #6

strange... only on disconnect works !
__________________
[img]http://img100.**************/img100/7245/unititledja1.png[/img]

Kimi is offline
jageassyrian
Senior Member
Join Date: Jul 2007
Old 01-24-2008 , 17:35   Re: Admin level connect !
Reply With Quote #7

oh sorry to bother when a person with the flag m comes in can you make it say A MVP has just joined and for when a person with other flags joins An Admin has joined?
jageassyrian is offline
[kirk]./musick`
Senior Member
Join Date: Jun 2007
Location: Tampa, Florida
Old 01-24-2008 , 22:22   Re: Admin level connect !
Reply With Quote #8

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

public plugin_init() {
    
register_plugin("Admin Announce""1.0""kirkhalo")
}

public 
client_connect(id){
    if (
get_user_flags(id) & ADMIN_LEVEL_A){
        
client_print(0print_chat"[AMXX] An MVP has joined the game.")
    }
    else if ((
get_user_flags(id) != ADMIN_USER) && (get_user_flags(id) != ADMIN_LEVEL_A)){
        
client_print(0print_chat"[AMXX] An Admin has joined the game.")
    }
    return 
PLUGIN_HANDLED

I know there is probably a shorter way than calling get_user_flags() a million times, but my parents are bugging the hell out of me

-Kirk
__________________
[kirk]./musick` is offline
Send a message via AIM to [kirk]./musick`
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-24-2008 , 22:51   Re: Admin level connect !
Reply With Quote #9

I would do something like :

Code:
public client_connect( id ) {     new iFlags = get_user_flags( id );         if( !( iFlags & ADMIN_USER ) )         client_print( 0, print_chat, "[AMXX] %s", ( iFlags & ADMIN_LEVEL_A ) ? "An MVP has joined the game." : "An Admin has joined the game." ) }

@[kirk]./musick` :

Remember if you use several times a native, it's better to cache its value before.
Also, no need to return something.
__________________
Arkshine is offline
jageassyrian
Senior Member
Join Date: Jul 2007
Old 01-25-2008 , 17:39   Re: Admin level connect !
Reply With Quote #10

can you make it so it shows there name like this in white

Pub-Stars
M.V.P (the persons name)

Pub-Stars
Admin (the persons name)
jageassyrian 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 08:10.


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