Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <amxmisc>
- #include <cstrike>
- #include <engine>
- #include <fakemeta>
- #include <hamsandwich>
- #include <fun>
- #include <colorchat>
- #define PLUGIN "Custom Admin Menu"
- #define AUTHOR "anderseN"
- #define VERSION "1.0"
- new const Prefix[] = "[AdminMenu]";
- new szName[33], szPlayerName[33]
- public plugin_init()
- {
- register_plugin(PLUGIN, VERSION, AUTHOR)
- }
- public client_PreThink(id)
- {
- if (pev(id, pev_button) & IN_RELOAD && !(pev(id, pev_oldbuttons) & IN_RELOAD))
- {
- CmdMainMenu(id);
- }
- }
- /* Action That Will Show You The Menu */
- public CmdMainMenu(id)
- {
- if(!(get_user_flags(id) & ADMIN_CFG))
- {
- Print(id, "you do not have access to use this menu");
- }
- else
- {
- ShowMainMenu(id);
- }
- }
- /* The Main Menu */
- ShowMainMenu(id)
- {
- static title[128];
- formatex(title, sizeof(title) - 1, "\r[GP] \wGamepark Admin Panel\y v1.0^n\y - Main Menu");
- new menu = menu_create(title, "MenuMain");
- menu_additem(menu, "Slap", "1");
- menu_additem(menu, "Slay^n", "2");
- menu_additem(menu, "Kick Menu", "3");
- menu_additem(menu, "Ban Menu^n", "4");
- menu_additem(menu, "Mapvote^n", "5");
- menu_additem(menu, "Extra Thins", "6");
- menu_display(id, menu);
- }
- public MenuMain(id, menu, item)
- {
- if( item == MENU_EXIT )
- {
- menu_destroy(menu);
- return;
- }
- static _access, info[4], callback;
- menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback);
- menu_destroy(menu);
- switch( info[0] )
- {
- case '1':
- {
- SlapMenu(id);
- }
- case '2':
- {
- SlayMenu(id);
- }
- case '3':
- {
- KickMenu(id);
- }
- case '4':
- {
- BanMenu(id);
- }
- case '5':
- {
- Print(id, "This menu is under progress!");
- }
- case '6':
- {
- CmdOwnerMenu(id)
- }
- }
- }
- public CmdOwnerMenu(id)
- {
- if(!(get_user_flags(id) & ADMIN_IMMUNITY))
- {
- Print(id, "Sorry, only^04 Owners^03 can access this menu");
- ShowMainMenu(id)
- }
- else
- {
- ShowOwnerMenu(id);
- }
- }
- /* The Owner Menu */
- ShowOwnerMenu(id)
- {
- static title[128];
- formatex(title, sizeof(title) - 1, "\r[GP] \wGamepark Admin Panel\y v1.0^n\y - Owner Menu");
- new menu = menu_create(title, "MenuOwners");
- new Temp [ 190 ]
- if ( get_user_noclip(id) >= 1 )
- formatex ( Temp, sizeof ( Temp ) - 1, "\wNoclip:\r [On]" )
- else if ( get_user_noclip(id) >= 0 )
- formatex ( Temp, sizeof ( Temp ) - 1, "\wNoclip:\r [Off]" )
- menu_additem ( menu, Temp, "1", 0 )
- if ( get_user_godmode(id) >= 1 )
- formatex ( Temp, sizeof ( Temp ) - 1, "\wGodmode:\r [On]" )
- else if ( get_user_godmode(id) >= 0 )
- formatex ( Temp, sizeof ( Temp ) - 1, "\wGodmode:\r [Off]" )
- menu_additem ( menu, Temp, "2", 0 )
- menu_additem(menu, "Revive Yourself^n", "3");
- menu_additem(menu, "Team Change Menu", "4");
- menu_display(id, menu);
- }
- public MenuOwners(id, menu, item)
- {
- if( item == MENU_EXIT )
- {
- menu_destroy(menu);
- return;
- }
- static _access, info[4], callback;
- menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback);
- menu_destroy(menu);
- switch( info[0] )
- {
- case '1':
- {
- ToggleNoclip(id)
- ShowOwnerMenu(id)
- }
- case '2':
- {
- ToggleGodmode(id)
- ShowOwnerMenu(id)
- }
- case '3':
- {
- CmdRevive(id)
- ShowOwnerMenu(id)
- }
- case '4':
- {
- ShowTeamMenu(id);
- }
- }
- }
- ShowTeamMenu(id)
- {
- static title[128];
- formatex(title, sizeof(title) - 1, "\r[GP] \wGamepark Admin Panel\y v1.0^n\y - Team Menu^n\w Select a team");
- new menu = menu_create(title, "MenuTeam");
- menu_additem(menu, "Terrorist", "1");
- menu_additem(menu, "Counter Terrorist", "2");
- menu_additem(menu, "Spectator^n", "3");
- menu_display(id, menu);
- }
- public MenuTeam(id, menu, item)
- {
- if( item == MENU_EXIT )
- {
- ShowMainMenu(id);
- }
- static _access, info[4], callback;
- menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback);
- menu_destroy(menu);
- switch( info[0] )
- {
- case '1':
- {
- CmdTerrorist(id)
- ShowOwnerMenu(id)
- }
- case '2':
- {
- CmdCounterTerrorist(id)
- ShowOwnerMenu(id)
- }
- case '3':
- {
- CmdSpectator(id)
- ShowOwnerMenu(id)
- }
- }
- }
- ToggleNoclip(id)
- {
- if (get_user_noclip(id))
- {
- set_user_noclip(id, 0);
- Print(id, "Noclip has been disabled");
- }
- else
- {
- set_user_noclip(id, 1);
- Print(id, "Noclip has been^04 Enabled");
- }
- }
- ToggleGodmode(id)
- {
- if (get_user_godmode(id))
- {
- set_user_godmode(id, 0);
- Print(id, "Godmode has been disabled");
- }
- else
- {
- set_user_godmode(id, 1);
- Print(id, "Godmode has been^04 Enabled");
- }
- }
- public CmdRevive(id)
- {
- if(is_user_alive(id))
- {
- Print(id, "you're already alive, dumbass");
- return;
- }
- else
- {
- ExecuteHam(Ham_CS_RoundRespawn, id);
- Print(id, "You have been^04 Revived");
- }
- }
- public CmdTerrorist(id)
- {
- if (get_user_team(id) == 1)
- {
- Print(id, "you are already a Terrorist");
- }
- else
- {
- if(is_user_connected(id))
- {
- cs_set_user_team(id, CS_TEAM_T);
- Print(id, "you have been moved to^04 Terrorist Team");
- }
- }
- }
- public CmdCounterTerrorist(id)
- {
- if (get_user_team(id) == 2)
- {
- Print(id, "you are already a Counter Terrorist");
- }
- else
- {
- if(is_user_connected(id))
- {
- cs_set_user_team(id, CS_TEAM_CT);
- Print(id, "you have been moved to^04 Counter Terrorist Team");
- }
- }
- }
- public CmdSpectator(id)
- {
- if (get_user_team(id) == 3)
- {
- Print(id, "you are already a Spectator");
- }
- else
- {
- if(is_user_connected(id))
- {
- cs_set_user_team(id, CS_TEAM_SPECTATOR);
- Print(id, "you have been moved to^04 Spectator");
- }
- }
- }
- /*Action for the Slap Menu*/
- public SlapMenu(id)
- {
- new SlapPlayer = menu_create ("\r[GP] \wGamepark Admin Panel\y v1.0^n\y - Slap Menu", "HandleSlap")
- new num, players[32], tempid, szTempID [10], tempname [32]
- get_players (players, num, "a")
- for (new i = 0; i < num; i++)
- {
- tempid = players [ i ]
- get_user_name (tempid, tempname, 31)
- num_to_str (tempid, szTempID, 9)
- menu_additem (SlapPlayer, tempname, szTempID, 0)
- }
- menu_display (id, SlapPlayer)
- return PLUGIN_HANDLED
- }
- /*Action for the Slay Menu*/
- public SlayMenu(id)
- {
- new SlayPlayer = menu_create ("\r[GP] \wGamepark Admin Panel\y v1.0^n\y - Slay Menu", "HandleSlay")
- new num, players[32], tempid, szTempID [10], tempname [32]
- get_players (players, num, "a")
- for (new i = 0; i < num; i++)
- {
- tempid = players [ i ]
- get_user_name (tempid, tempname, 31)
- num_to_str (tempid, szTempID, 9)
- menu_additem (SlayPlayer, tempname, szTempID, 0)
- }
- menu_display (id, SlayPlayer)
- return PLUGIN_HANDLED
- }
- /*Action for the Kick Menu*/
- public KickMenu(id)
- {
- new KickPlayer = menu_create ("\r[GP] \wGamepark Admin Panel\y v1.0^n\y - Kick Menu", "HandleKick")
- new num, players[32], tempid, szTempID [10], tempname [32]
- get_players (players, num, "a")
- for (new i = 0; i < num; i++)
- {
- tempid = players [ i ]
- get_user_name(tempid, tempname, 31)
- num_to_str(tempid, szTempID, 9)
- menu_additem(KickPlayer, tempname, szTempID, 0)
- }
- menu_display (id, KickPlayer)
- return PLUGIN_HANDLED
- }
- /*Action for the Ban Menu*/
- public BanMenu(id)
- {
- new BanPlayer = menu_create ("\r[GP] \wGamepark Admin Panel\y v1.0^n\y - Ban Menu", "HandleBan")
- new num, players[32], tempid, szTempID [10], tempname [32]
- get_players (players, num, "a")
- for (new i = 0; i < num; i++)
- {
- tempid = players [ i ]
- get_user_name(tempid, tempname, 31)
- num_to_str(tempid, szTempID, 9)
- menu_additem(BanPlayer, tempname, szTempID, 0)
- }
- menu_display (id, BanPlayer)
- return PLUGIN_HANDLED
- }
- /*HANDLES*/
- /*The handle of the Slap Menu*/
- public HandleSlap(id, menu, item)
- {
- if(item == MENU_EXIT)
- {
- menu_destroy(menu)
- return PLUGIN_HANDLED
- }
- new data[6], name[64]
- new access, callback
- menu_item_getinfo (menu, item, access, data, 5, name, 63, callback)
- new tempid = str_to_num (data)
- get_user_name(id, szName, 32)
- get_user_name(tempid, szPlayerName, 32)
- Print(0, "%s^04 slapped^03 %s^04!", szName, szPlayerName);
- user_slap(tempid, 0)
- CmdMainMenu(id)
- return PLUGIN_CONTINUE
- }
- /*The handle of the Slay Menu*/
- public HandleSlay(id, menu, item)
- {
- if(item == MENU_EXIT)
- {
- menu_destroy(menu)
- return PLUGIN_HANDLED
- }
- new data[6], name[64]
- new access, callback
- menu_item_getinfo (menu, item, access, data, 5, name, 63, callback)
- new tempid = str_to_num (data)
- get_user_name(id, szName, 32)
- get_user_name(tempid, szPlayerName, 32)
- Print(0, "%s^04 slayed^03 %s^04!", szName, szPlayerName);
- user_silentkill(tempid)
- CmdMainMenu(id)
- return PLUGIN_CONTINUE
- }
- /*The handle of the Kick Menu*/
- public HandleKick(id, menu, item)
- {
- if(item == MENU_EXIT)
- {
- menu_destroy(menu)
- return PLUGIN_HANDLED
- }
- new data[6], name[64]
- new access, callback, UserID
- menu_item_getinfo (menu, item, access, data, 5, name, 63, callback)
- new tempid = str_to_num(data)
- get_user_name(id, szName, 32)
- get_user_name(tempid, szPlayerName, 32)
- UserID = get_user_userid(tempid)
- Print(0, "%s^04 kicked^03 %s^04!", szName, szPlayerName);
- server_cmd("kick ^"#%d^" ^"kicked by %s^"", UserID, szName)
- CmdMainMenu(id)
- return PLUGIN_CONTINUE
- }
- /*The handle of the Ban Menu*/
- public HandleBan(id, menu, item)
- {
- if(item == MENU_EXIT)
- {
- menu_destroy(menu)
- return PLUGIN_HANDLED
- }
- new data[6], name[64]
- new access, callback, UserID
- menu_item_getinfo (menu, item, access, data, 5, name, 63, callback)
- new tempid = str_to_num(data)
- get_user_name(id, szName, 32)
- get_user_name(tempid, szPlayerName, 32)
- UserID = get_user_userid(tempid)
- Print(0, "%s^04 banned^03 %s^04!", szName, szPlayerName);
- server_cmd("amx_ban ^"#%d^" ^"30^" ^"Banned by ADMIN %s^"", UserID, szName)
- CmdMainMenu(id)
- return PLUGIN_CONTINUE
- }
- Print(id, const szMessage[], any:...)
- {
- static szBuffer[192];
- vformat(szBuffer, charsmax(szBuffer), szMessage, 3);
- ColorChat(id, GREY, "^04%s^03 %s", Prefix, szBuffer);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement