AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   make it put admin (https://forums.alliedmods.net/showthread.php?t=245206)

JohnBloper 07-29-2014 15:21

make it put admin
 
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")
    



MrKiller2010 07-29-2014 15:36

Re: make it put admin
 
Quote:

Originally Posted by JohnBloper (Post 2175875)
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
    



JohnBloper 07-29-2014 16:25

Re: make it put admin
 
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..


All times are GMT -4. The time now is 12:52.

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