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 szPrimary[ MAX_ACCESS ][] =
{
"abcdefghijklmnopqrstu",
"cdefghijklmnopqrstu",
"cdefgijlnopqrstu",
"cdegijlnopqrst",
"ceir"
};
new Float:iPrimary[ 33 ];
public plugin_init()
{
register_plugin( "AddAdminManage", "0.2", "EiD" );
register_clcmd("/manage", "CmdShowMenu");
}
public CmdShowMenu( client )
{
static szItem[100];
new Menu = menu_create("\r[\d Aqua \r] \yPlayers Manage Menu", "SubShowMenu");
formatex( szItem, charsmax( szItem ), "Admin Flags\d: [\r %s \d]", szPrimary[ iPrimary[ client ] ] );
menu_additem( Menu, szItem );
menu_additem( Menu, "\rAdd Admin!" );
menu_addblank( Menu, 0 );
menu_display( client, Menu );
menu_setprop(Menu, MPROP_NUMBER_COLOR, "\d");
menu_setprop(Menu, MPROP_EXITNAME, "\yClose Menu");
return PLUGIN_HANDLED;
}
public SubShowMenu( client, Menu, Item )
{
if( Item == MENU_EXIT )
{
menu_destroy(Menu)
return 1;
}
switch ( Item )
{
case 0:
{
if ( iPrimary[ client ] == charsmax( szPrimary ) )
iPrimary[ client ] = -1;
iPrimary[ client ]++;
return CmdShowMenu( client );
}
case 1 :
{
PlrM( client );
}
}
}
public PlrM(id)
{
new setLevel = menu_create("\r[\d Aqua \r] \yPlayers Manage Menu", "setAccess2");
new players[32], pnum, player, szName[32], szInfo[10], mItem[128];
get_players(players, pnum);
for( new i; i<pnum; i++ )
{
player = players[i];
get_user_name(player, szName, charsmax(szName));
num_to_str(player, szInfo, charsmax(szInfo));
formatex(mItem, sizeof mItem - 1, "\y%s", szName);
menu_additem(setLevel, mItem, szInfo, 0);
}
menu_display(id, setLevel);
}
public setAccess2(id, setLevel, item)
{
if( item == MENU_EXIT )
{
menu_destroy(setLevel);
return PLUGIN_HANDLED;
}
new Data[3], playerName[32],junk;
menu_item_getinfo(setLevel, item, junk, Data, 2, .callback = junk);
new plr = str_to_num(Data);
get_user_name(plr, playerName, sizeof playerName - 1);
new Steam[32]
get_user_authid(plr, Steam, 31)
server_cmd("amx_addadmin ^"%s^" ^"^" ^"%s^" ^"^" ^"ce^"", Steam, szPrimary[szKey]);
server_cmd("amx_reloadadmins")
}