Raised This Month: $ Target: $400
 0% 

make it put admin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JohnBloper
Member
Join Date: Jul 2014
Old 07-29-2014 , 15:21   make it put admin
Reply With Quote #1

Hey, Could someone fix this plugin and make that it will give the admin to the player?
And i KNOW there are much much better plugins for this. But im tryin to learn and i would be happy if someone could help me or fix this, Thanks
PHP Code:
#include < amxmodx >
#include < cstrike >
#include < hamsandwich >
#include < fakemeta_util >
#define MAX_ACCESS 5
 
new szKey;


new const 
szPrimaryMAX_ACCESS ][] = 
{
    
"abcdefghijklmnopqrstu",
    
"cdefghijklmnopqrstu",
    
"cdefgijlnopqrstu",
    
"cdegijlnopqrst",
    
"ceir"
};
new 
Float:iPrimary33 ];
 
public 
plugin_init()
{
        
register_plugin"AddAdminManage""0.2""EiD" );
    
register_clcmd("/manage""CmdShowMenu");
}
 
public 
CmdShowMenuclient )
{
    static 
szItem[100];
       
        new 
Menu menu_create("\r[\d Aqua \r] \yPlayers Manage Menu""SubShowMenu");
       
        
formatexszItemcharsmaxszItem ), "Admin Flags\d: [\r %s \d]"szPrimaryiPrimaryclient ] ] );
       
        
menu_additemMenuszItem );
    
        
menu_additemMenu"\rAdd Admin!" );
    
        
menu_addblankMenu);
    
    
        
menu_displayclientMenu );
    
menu_setprop(MenuMPROP_NUMBER_COLOR"\d");
    
menu_setprop(MenuMPROP_EXITNAME"\yClose Menu");
    return 
PLUGIN_HANDLED;
}
 
public 
SubShowMenuclientMenuItem )
{
if( 
Item == MENU_EXIT )
{
menu_destroy(Menu)
return 
1;
}
       
        switch ( 
Item )
        {
                case 
0:
                {
                        if ( 
iPrimaryclient ] == charsmaxszPrimary ) )
                                
iPrimaryclient ] = -1;
                       
                        
iPrimaryclient ]++;
            return 
CmdShowMenuclient );
        }
               case 
:
                {
                        
PlrMclient );
        }
}
}
 
public 
PlrM(id)
{
    new 
setLevel menu_create("\r[\d Aqua \r] \yPlayers Manage Menu""setAccess2");
    new 
players[32], pnumplayerszName[32], szInfo[10], mItem[128];
    
get_players(playerspnum);
    for( new 
ii<pnumi++ )
    {
        
player players[i];
        
get_user_name(playerszNamecharsmax(szName));
        
num_to_str(playerszInfocharsmax(szInfo));
        
formatex(mItemsizeof mItem 1"\y%s"szName);
        
menu_additem(setLevelmItemszInfo0);
    }
    
menu_display(idsetLevel);
}
public 
setAccess2(idsetLevelitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(setLevel);
        return 
PLUGIN_HANDLED;
    }

    new 
Data[3], playerName[32],junk;
    
menu_item_getinfo(setLevelitemjunkData2, .callback junk);
    new 
plr str_to_num(Data);
    
    
get_user_name(plrplayerNamesizeof playerName 1);
    new 
Steam[32]
    
get_user_authid(plrSteam31)

    
    
server_cmd("amx_addadmin ^"%s^" ^"^" ^"%s^" ^"^" ^"ce^""SteamszPrimary[szKey]); 
    
server_cmd("amx_reloadadmins")
    

JohnBloper is offline
MrKiller2010
Senior Member
Join Date: Aug 2012
Old 07-29-2014 , 15:36   Re: make it put admin
Reply With Quote #2

Quote:
Originally Posted by JohnBloper View Post
Hey, Could someone fix this plugin and make that it will give the admin to the player?
And i KNOW there are much much better plugins for this. But im tryin to learn and i would be happy if someone could help me or fix this, Thanks
PHP Code:
#include < amxmodx >
#include < cstrike >
#include < hamsandwich >
#include < fakemeta_util >
#define MAX_ACCESS 5
 
new szKey;


new const 
szPrimaryMAX_ACCESS ][] = 
{
    
"abcdefghijklmnopqrstu",
    
"cdefghijklmnopqrstu",
    
"cdefgijlnopqrstu",
    
"cdegijlnopqrst",
    
"ceir"
};
new 
Float:iPrimary33 ];
 
public 
plugin_init()
{
        
register_plugin"AddAdminManage""0.2""EiD" );
    
register_clcmd("/manage""CmdShowMenu");
}
 
public 
CmdShowMenuclient )
{
    static 
szItem[100];
       
        new 
Menu menu_create("\r[\d Aqua \r] \yPlayers Manage Menu""SubShowMenu");
       
        
formatexszItemcharsmaxszItem ), "Admin Flags\d: [\r %s \d]"szPrimaryiPrimaryclient ] ] );
       
        
menu_additemMenuszItem );
    
        
menu_additemMenu"\rAdd Admin!" );
    
        
menu_addblankMenu);
    
    
        
menu_displayclientMenu );
    
menu_setprop(MenuMPROP_NUMBER_COLOR"\d");
    
menu_setprop(MenuMPROP_EXITNAME"\yClose Menu");
    return 
PLUGIN_HANDLED;
}
 
public 
SubShowMenuclientMenuItem )
{
if( 
Item == MENU_EXIT )
{
menu_destroy(Menu)
return 
1;
}
       
        switch ( 
Item )
        {
                case 
0:
                {
                        if ( 
iPrimaryclient ] == charsmaxszPrimary ) )
                                
iPrimaryclient ] = -1;
                       
                        
iPrimaryclient ]++;
            return 
CmdShowMenuclient );
        }
               case 
:
                {
                        
PlrMclient );
        }
}
}
 
public 
PlrM(id)
{
    new 
setLevel menu_create("\r[\d Aqua \r] \yPlayers Manage Menu""setAccess2");
    new 
players[32], pnumplayerszName[32], szInfo[10], mItem[128];
    
get_players(playerspnum);
    for( new 
ii<pnumi++ )
    {
        
player players[i];
        
get_user_name(playerszNamecharsmax(szName));
        
num_to_str(playerszInfocharsmax(szInfo));
        
formatex(mItemsizeof mItem 1"\y%s"szName);
        
menu_additem(setLevelmItemszInfo0);
    }
    
menu_display(idsetLevel);
}
public 
setAccess2(idsetLevelitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(setLevel);
        return 
PLUGIN_HANDLED;
    }

    new 
Data[3], playerName[32],junk;
    
menu_item_getinfo(setLevelitemjunkData2, .callback junk);
    new 
plr str_to_num(Data);
    
    
get_user_name(plrplayerNamesizeof playerName 1);
    new 
Steam[32]
    
get_user_authid(plrSteam31)

    
    
server_cmd("amx_addadmin ^"%s^" ^"^" ^"%s^" ^"^" ^"ce^""SteamszPrimary[szKey]); 
    
server_cmd("amx_reloadadmins")
    

Check what you've done wrong with my code:
PHP Code:
#include < amxmodx >
#include < cstrike >
#include < hamsandwich >
#include < fakemeta_util >
#define MAX_ACCESS 5

new szKey;


new const 
szPrimaryMAX_ACCESS ][] = 
{
"abcdefghijklmnopqrstu",
"cdefghijklmnopqrstu",
"cdefgijlnopqrstu",
"cdegijlnopqrst",
"ceir"
};
new 
Float:iPrimary33 ];

public 
plugin_init()
{
register_plugin"AddAdminManage""0.2""EiD" );
register_clcmd("/manage""CmdShowMenu");
}

public 
CmdShowMenuclient )
{
static 
szItem[100];

new 
Menu menu_create("\r[\d Aqua \r] \yPlayers Manage Menu""SubShowMenu");

formatexszItemcharsmaxszItem ), "Admin Flags\d: [\r %s \d]"szPrimaryiPrimaryclient ] ] );

menu_additemMenuszItem );

menu_additemMenu"\rAdd Admin!" );

menu_addblankMenu);


menu_displayclientMenu );
menu_setprop(MenuMPROP_NUMBER_COLOR"\d");
menu_setprop(MenuMPROP_EXITNAME"\yClose Menu");
return 
PLUGIN_HANDLED;
}

public 
SubShowMenuclientMenuitemid )
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(Menu);
        return 
PLUGIN_HANDLED;
    }

    switch ( 
item)
    {
        case 
0:
        {
            if ( 
iPrimaryclient ] == charsmaxszPrimary ) )
            {    
                
iPrimaryclient ]= -1;
                
                
iPrimaryclient ]++;
                return 
CmdShowMenuclient );
            }
        }
        case 
1
        {
            
PlrM(id)
        }
    }
    return 
PLUGIN_HANDLED;
}

public 
PlrM(id)
{
    new 
setLevel menu_create("\r[\d Aqua \r] \yPlayers Manage Menu""setAccess2");
    new 
players[32], pnumplayerszName[32], szInfo[10], mItem[128];
    
get_players(playerspnum);
    for( new 
ii<pnumi++ )
    {
        
player players[i];
        
get_user_name(playerszNamecharsmax(szName));
        
num_to_str(playerszInfocharsmax(szInfo));
        
formatex(mItemsizeof mItem 1"\y%s"szName);
        
menu_additem(setLevelmItemszInfo0);
    }
    
menu_display(idsetLevel);
}
public 
setAccess2(idsetLevelitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(setLevel);
        return 
PLUGIN_HANDLED;
    }
    
    new 
Data[3], playerName[32], szSteamId[32],junk;
    
menu_item_getinfo(setLevelitemjunkData2, .callback junk);
    new 
plr str_to_num(Data);
    
get_user_name(plrplayerNamesizeof playerName 1);
    
get_user_authid(plrszSteamIdcharsmax(szSteamId)) 
    
    
    
server_cmd("amx_addadmin ^"%s^" ^"^" ^"%s^" ^"^" ^"ce^""szSteamIdszPrimary[szKey]); 
    
server_cmd("amx_reloadadmins")
    return 
PLUGIN_HANDLED
    

__________________
JailBreak & HNS
MrKiller2010 is offline
JohnBloper
Member
Join Date: Jul 2014
Old 07-29-2014 , 16:25   Re: make it put admin
Reply With Quote #3

Doesnt work... and now the menu disaper when i click on the option
Edit: I made the menu to work but it doesnt give the admin..

Last edited by JohnBloper; 07-29-2014 at 16:42.
JohnBloper 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 12:52.


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