Approved Admin menu

Plug-ins compatibility with Zombie Escape 1.x only!


Post Reply
User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

Admin menu

#1

Post by Night Fury » 5 years ago

| Description:
  1. This admin menu is to control your server exactly like in ZP but this is more compatible with ZE mod.
  2. This menu has for no only turn to zombie/human.

| Natives:
  • This allows you to open main admin menu // id is the admin's index.

    Code: Select all

    ze_open_admin_menu(id)

| Commands:
  1. Say /am to open main admin menu. // Normal chat
  2. Say ze_zombie target to turn target into zombie // Console - Target is the player name
  3. Say ze_human target to turn target into human // Console - Target is the player name

| Cvars:
  • This to log every command used by the admin? ( 1= Enable || 2= Disable)

    Code: Select all

    ze_log_admin_commands

| Addiotions:
  1. Open your zombie_escape.txt & add those lines at the last:

    Code: Select all

    MENU_ADMIN_TITLE = Admin Menu
    MAKE_HM_ZM = Make Zombie/Human
    CMD_NOT_ACCESS = You have no access.
    CLASS_ZOMBIE = Zombie
    CLASS_HUMAN = Human
    CMD_NOT = Unavailable command.
    ALREADY_HUMAN = This player is already human
    ALREADY_ZOMBIE = This player is already zombie
    CMD_CANT_LAST_ZOMBIE = Can't apply this action on the last zombie
    CMD_CANT_LAST_HUMAN = Can't apply this action on the last human
    CMD_ONLY_AFTER_GAME_MODE = This command is available only after game starts
    CMD_CURED = Was turned to human
    CMD_INFECTED = Was turned to zombie
  2. Open your zombie_escape.ini & add those lines at the last:

    Code: Select all

    [Access Flags]
    Make Zombie = d
    Make Human = d
    1. This is the access to turn player to a zombie

      Code: Select all

      Make Zombie
    2. This is the access to turn player to a human

      Code: Select all

      Make Human

| Code:

  1. #include <zombie_escape>
  2.  
  3. new const ZE_SETTINGS_FILE[] = "zombie_escape.ini"
  4.  
  5. new g_szAccess_Make_Zombie[2] = "d"
  6. new g_szAccess_Make_Human[2] = "d"
  7.  
  8. new g_iMaxPlayers, bool:g_bIsZombieReleased, bool:g_bIsRoundEnded
  9. new g_pCvarAMXShowActivity, g_pCvarLogAdminCmds
  10.  
  11. public plugin_natives()
  12. {
  13.     register_native("ze_open_admin_menu", "_ze_open_admin_menu", 1)
  14. }
  15.  
  16. public plugin_precache()
  17. {
  18.     if (!amx_load_setting_string(ZE_SETTINGS_FILE, "Access Flags", "Make Zombie", g_szAccess_Make_Zombie, charsmax(g_szAccess_Make_Zombie)))
  19.         amx_save_setting_string(ZE_SETTINGS_FILE, "Access Flags", "Make Zombie", g_szAccess_Make_Zombie)
  20.  
  21.     if (!amx_load_setting_string(ZE_SETTINGS_FILE, "Access Flags", "Make Human", g_szAccess_Make_Human, charsmax(g_szAccess_Make_Human)))
  22.         amx_save_setting_string(ZE_SETTINGS_FILE, "Access Flags", "Make Human", g_szAccess_Make_Human)
  23. }
  24.  
  25. public plugin_init()
  26. {
  27.     register_plugin("[ZE] Addons: Admin szMenu", "1.0", "Jack GamePlay")
  28.  
  29.     register_clcmd("say /am", "Open_Admin_Menu")
  30.  
  31.     register_concmd("ze_zombie", "Zombie_Cmd", _, "<target> - Turn someone into a zombie", 0)
  32.     register_concmd("ze_human", "Human_Cmd", _, "<target> - Turn someone back to human", 0)
  33.  
  34.     g_pCvarLogAdminCmds = register_cvar("ze_log_admin_commands", "1")
  35.  
  36.     g_iMaxPlayers = get_member_game(m_nMaxPlayers)
  37. }
  38.  
  39. public ze_zombie_appear()
  40. {
  41.     g_bIsZombieReleased = false
  42.     g_bIsRoundEnded = false
  43. }
  44.  
  45. public ze_game_started()
  46. {
  47.     g_bIsZombieReleased = false
  48.     g_bIsRoundEnded = false
  49. }
  50.  
  51. public ze_zombie_release()
  52. {
  53.     g_bIsZombieReleased = true
  54.     g_bIsRoundEnded = false
  55. }
  56.  
  57. public ze_roundend()
  58. {
  59.     g_bIsRoundEnded = true
  60.     g_bIsZombieReleased = false
  61. }
  62.  
  63. public plugin_cfg()
  64. {
  65.     g_pCvarAMXShowActivity = get_cvar_pointer("amx_show_activity")
  66. }
  67.  
  68. public Open_Admin_Menu(id)
  69. {
  70.     static szMenu[250]
  71.     new iMenuID
  72.    
  73.     formatex(szMenu, charsmax(szMenu), "\y%L:^n^n", LANG_PLAYER, "MENU_ADMIN_TITLE")
  74.     iMenuID = menu_create(szMenu, "Admin_Menu_Handler")
  75.    
  76.     if (get_user_flags(id) & (read_flags(g_szAccess_Make_Zombie) | read_flags(g_szAccess_Make_Human)))
  77.         formatex(szMenu, charsmax(szMenu), "\w%L^n", LANG_PLAYER, "MAKE_HM_ZM")
  78.     else
  79.         formatex(szMenu, charsmax(szMenu), "\d%L^n", LANG_PLAYER, "MAKE_HM_ZM")
  80.     menu_additem(iMenuID, szMenu)
  81.  
  82.     menu_display(id, iMenuID, 0, 30)
  83. }
  84.  
  85. public Admin_Menu_Handler(id, iMenuID, iKey)
  86. {
  87.     // Player disconnected?
  88.     if (!is_user_connected(id))
  89.         return PLUGIN_HANDLED
  90.    
  91.     switch (iKey)
  92.     {
  93.         case 0:
  94.         {
  95.             if (get_user_flags(id) & (read_flags(g_szAccess_Make_Zombie) | read_flags(g_szAccess_Make_Human)))
  96.             {
  97.                 Show_Player_Menu(id)
  98.             }
  99.             else
  100.             {
  101.                 ze_colored_print(id, "%L", LANG_PLAYER, "CMD_NOT_ACCESS")
  102.                 Open_Admin_Menu(id)
  103.             }
  104.         }
  105.     }
  106.  
  107.     menu_destroy(iMenuID)
  108.     return PLUGIN_HANDLED
  109. }
  110.  
  111. public Show_Player_Menu(id)
  112. {
  113.     static szMenu[128], szAdminName[32], szPlayerName[32]
  114.     new iIndex, iMenuID, iItemData[2]
  115.  
  116.     get_user_name(id, szAdminName, charsmax(szAdminName))
  117.  
  118.     formatex(szMenu, charsmax(szMenu), "%L:^n^n", LANG_PLAYER, "MAKE_HM_ZM")
  119.     iMenuID = menu_create(szMenu, "Player_Menu_Handler")
  120.  
  121.     for (iIndex = 0; iIndex <= g_iMaxPlayers; iIndex++)
  122.     {
  123.         if (!is_user_connected(iIndex))
  124.             continue
  125.  
  126.         get_user_name(iIndex, szPlayerName, charsmax(szPlayerName))
  127.  
  128.         if (ze_is_user_zombie(iIndex))
  129.         {
  130.             if ((get_user_flags(id) & read_flags(g_szAccess_Make_Human)) && is_user_alive(iIndex) && g_bIsZombieReleased && !g_bIsRoundEnded)
  131.             {
  132.                 if (equali(szPlayerName, szAdminName))
  133.                     formatex(szMenu, charsmax(szMenu), "\y%s \d[\r%L\d]", szPlayerName, LANG_PLAYER, "CLASS_ZOMBIE")
  134.                 else
  135.                     formatex(szMenu, charsmax(szMenu), "\w%s \d[\r%L\d]", szPlayerName, LANG_PLAYER, "CLASS_ZOMBIE")
  136.             }
  137.             else
  138.                 formatex(szMenu, charsmax(szMenu), "\d%s [%L]", szPlayerName, LANG_PLAYER, "CLASS_ZOMBIE")
  139.         }
  140.         else
  141.         {
  142.             if ((get_user_flags(id) & read_flags(g_szAccess_Make_Zombie)) && is_user_alive(iIndex) && g_bIsZombieReleased && !g_bIsRoundEnded)
  143.             {
  144.                 if (equali(szPlayerName, szAdminName))
  145.                     formatex(szMenu, charsmax(szMenu), "\y%s \d[\r%L\d]", szPlayerName, LANG_PLAYER, "CLASS_HUMAN")
  146.                 else
  147.                     formatex(szMenu, charsmax(szMenu), "\w%s \d[\r%L\d]", szPlayerName, LANG_PLAYER, "CLASS_HUMAN")
  148.             }
  149.             else
  150.                 formatex(szMenu, charsmax(szMenu), "\d%s [%L]", szPlayerName, LANG_PLAYER, "CLASS_HUMAN")
  151.         }
  152.  
  153.         iItemData[0] = iIndex
  154.         iItemData[1] = 0
  155.         menu_additem(iMenuID, szMenu, iItemData)
  156.     }
  157.  
  158.     // Back - Next - Exit
  159.     formatex(szMenu, charsmax(szMenu), "%L", LANG_PLAYER, "BACK")
  160.     menu_setprop(iMenuID, MPROP_BACKNAME, szMenu)
  161.     formatex(szMenu, charsmax(szMenu), "%L", LANG_PLAYER, "NEXT")
  162.     menu_setprop(iMenuID, MPROP_NEXTNAME, szMenu)
  163.     formatex(szMenu, charsmax(szMenu), "%L", LANG_PLAYER, "EXIT")
  164.     menu_setprop(iMenuID, MPROP_EXITNAME, szMenu)
  165.  
  166.     menu_display(id, iMenuID, 0, 30)
  167. }
  168.  
  169. public Player_Menu_Handler(id, iMenuID, iKey)
  170. {
  171.     if (iKey == MENU_EXIT)
  172.     {
  173.         menu_destroy(iMenuID)
  174.         Open_Admin_Menu(id)
  175.         return PLUGIN_HANDLED
  176.     }
  177.    
  178.     new iItemData[2], iDummy, iPlayer
  179.     menu_item_getinfo(iMenuID, iKey, iDummy, iItemData, charsmax(iItemData), _, _, iDummy)
  180.     iPlayer = iItemData[0]
  181.  
  182.     if (is_user_connected(iPlayer))
  183.     {
  184.         if (ze_is_user_zombie(iPlayer))
  185.         {
  186.             if ((get_user_flags(id) & read_flags(g_szAccess_Make_Human)) && is_user_alive(iPlayer) && g_bIsZombieReleased && !g_bIsRoundEnded)
  187.                 {
  188.                     ze_admin_command_human(id, iPlayer)
  189.                     Show_Player_Menu(id)
  190.                 }
  191.             else
  192.                 ze_colored_print(id, "%L", LANG_PLAYER, "CMD_NOT")
  193.         }
  194.         else
  195.         {
  196.             if ((get_user_flags(id) & read_flags(g_szAccess_Make_Zombie)) && is_user_alive(iPlayer) && g_bIsZombieReleased && !g_bIsRoundEnded)
  197.                 {
  198.                     ze_admin_command_zombie(id, iPlayer)
  199.                     Show_Player_Menu(id)
  200.                 }
  201.             else
  202.                 ze_colored_print(id, "%L", LANG_PLAYER, "CMD_NOT")
  203.         }
  204.     }
  205.  
  206.     menu_destroy(iMenuID)
  207.     return PLUGIN_HANDLED
  208. }
  209.  
  210. public ze_admin_command_human(Admin_ID, Player_ID)
  211. {
  212.     if (!is_user_connected(Admin_ID))
  213.     {
  214.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d)", Admin_ID)
  215.         return false
  216.     }
  217.    
  218.     if (!is_user_alive(Player_ID))
  219.     {
  220.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d)", Player_ID)
  221.         return false
  222.     }
  223.    
  224.     Cmd_Human(Admin_ID, Player_ID)
  225.     return true
  226. }
  227.  
  228. public ze_admin_command_zombie(Admin_ID, Player_ID)
  229. {
  230.     if (!is_user_connected(Admin_ID))
  231.     {
  232.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d)", Admin_ID)
  233.         return false
  234.     }
  235.    
  236.     if (!is_user_alive(Player_ID))
  237.     {
  238.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d)", Player_ID)
  239.         return false
  240.     }
  241.    
  242.     Cmd_Zombie(Admin_ID, Player_ID)
  243.     return true
  244. }
  245.  
  246. public Human_Cmd(Admin_ID, level, cid)
  247. {
  248.     // Check for access flag - Make Human
  249.     if (!cmd_access(Admin_ID, read_flags(g_szAccess_Make_Human), cid, 2))
  250.         return PLUGIN_HANDLED
  251.    
  252.     // Retrieve arguments
  253.     new szArg[32], Player_ID
  254.     read_argv(1, szArg, charsmax(szArg))
  255.     Player_ID = cmd_target(Admin_ID, szArg, (CMDTARGET_ONLY_ALIVE | CMDTARGET_ALLOW_SELF))
  256.    
  257.     // Invalid target
  258.     if (!Player_ID || !g_bIsZombieReleased || g_bIsRoundEnded)
  259.         return PLUGIN_HANDLED
  260.    
  261.     // Target not allowed to be human
  262.     if (!ze_is_user_zombie(Player_ID))
  263.     {
  264.         new szPlayerName[32]
  265.         get_user_name(Player_ID, szPlayerName, charsmax(szPlayerName))
  266.         client_print(Admin_ID, print_console, "[ZE] %L (%s).", LANG_PLAYER, "ALREADY_HUMAN", szPlayerName)
  267.         return PLUGIN_HANDLED
  268.     }
  269.    
  270.     Cmd_Human(Admin_ID, Player_ID)
  271.     return PLUGIN_HANDLED
  272. }
  273.  
  274. public Zombie_Cmd(Admin_ID, level, cid)
  275. {
  276.     // Check for access flag - Make Human
  277.     if (!cmd_access(Admin_ID, read_flags(g_szAccess_Make_Zombie), cid, 2))
  278.         return PLUGIN_HANDLED
  279.    
  280.     // Retrieve arguments
  281.     new szArg[32], Player_ID
  282.     read_argv(1, szArg, charsmax(szArg))
  283.     Player_ID = cmd_target(Admin_ID, szArg, (CMDTARGET_ONLY_ALIVE | CMDTARGET_ALLOW_SELF))
  284.    
  285.     // Invalid target
  286.     if (!Player_ID || !g_bIsZombieReleased  || g_bIsRoundEnded)
  287.         return PLUGIN_HANDLED
  288.    
  289.     // Target not allowed to be human
  290.     if (ze_is_user_zombie(Player_ID))
  291.     {
  292.         new szPlayerName[32]
  293.         get_user_name(Player_ID, szPlayerName, charsmax(szPlayerName))
  294.         client_print(Admin_ID, print_console, "[ZE] %L (%s).", LANG_PLAYER, "ALREADY_ZOMBIE", szPlayerName)
  295.         return PLUGIN_HANDLED
  296.     }
  297.    
  298.     Cmd_Zombie(Admin_ID, Player_ID)
  299.     return PLUGIN_HANDLED
  300. }
  301.  
  302. public Cmd_Human(Admin_ID, Player_ID)
  303. {
  304.     // Prevent infecting last zombie
  305.     //if (ze_is_last_zombie(Player_ID))
  306.     if (ze_get_zombies_number() == 1)
  307.     {
  308.         ze_colored_print(Admin_ID, "%L", LANG_PLAYER, "CMD_CANT_LAST_ZOMBIE")
  309.         return
  310.     }
  311.    
  312.     // Zombies have not been released yet
  313.     if (!g_bIsZombieReleased)
  314.     {
  315.         ze_colored_print(Admin_ID, "%L", LANG_PLAYER, "CMD_ONLY_AFTER_GAME_MODE")
  316.         return
  317.     }
  318.    
  319.     ze_set_user_human(Player_ID)
  320.    
  321.     // Get user names
  322.     new szAdminName[32], szPlayerName[32]
  323.     get_user_name(Admin_ID, szAdminName, charsmax(szAdminName))
  324.     get_user_name(Player_ID, szPlayerName, charsmax(szPlayerName))
  325.    
  326.     // Show activity?
  327.     if (g_pCvarAMXShowActivity)
  328.     {
  329.         switch (get_pcvar_num(g_pCvarAMXShowActivity))
  330.         {
  331.             case 1: ze_colored_print(0, "!tAdmin !y- !g%s !t%L", szPlayerName, LANG_PLAYER, "CMD_CURED")
  332.             case 2: ze_colored_print(0, "!tAdmin !g%s !y- !g%s !t%L", szAdminName, szPlayerName, LANG_PLAYER, "CMD_CURED")
  333.         }
  334.     }
  335.    
  336.     // Log to Zombie Plague log file?
  337.     if (get_pcvar_num(g_pCvarLogAdminCmds))
  338.     {
  339.         new szAuthid[32], szIP[16]
  340.         get_user_authid(Admin_ID, szAuthid, charsmax(szAuthid))
  341.         get_user_ip(Admin_ID, szIP, charsmax(szIP), 1)
  342.         ze_log("Admin [%s (%s - %s)] - [%s] [%L]", szAdminName, szAuthid, szIP, szPlayerName, LANG_PLAYER, "CMD_CURED")
  343.     }
  344. }
  345.  
  346. public Cmd_Zombie(Admin_ID, Player_ID)
  347. {
  348.     // Prevent infecting last zombie
  349.     //if (ze_is_last_human(Player_ID))
  350.     if (ze_get_humans_number() == 1)
  351.     {
  352.         ze_colored_print(Admin_ID, "%L", LANG_PLAYER, "CMD_CANT_LAST_HUMAN")
  353.         return
  354.     }
  355.    
  356.     // Game is already started
  357.     if (ze_is_game_started())
  358.     {
  359.         // Zombie released
  360.         if (!g_bIsZombieReleased)
  361.         {
  362.             ze_colored_print(Admin_ID, "%L", LANG_PLAYER, "CMD_ONLY_AFTER_GAME_MODE")
  363.             return
  364.         }
  365.     }
  366.    
  367.     ze_set_user_zombie(Player_ID)
  368.    
  369.     // Get user names
  370.     new szAdminName[32], szPlayerName[32]
  371.     get_user_name(Admin_ID, szAdminName, charsmax(szAdminName))
  372.     get_user_name(Player_ID, szPlayerName, charsmax(szPlayerName))
  373.    
  374.     // Show activity?
  375.     if (g_pCvarAMXShowActivity)
  376.     {
  377.         switch (get_pcvar_num(g_pCvarAMXShowActivity))
  378.         {
  379.             case 1: ze_colored_print(0, "!tAdmin !y- !g%s !t%L", szPlayerName, LANG_PLAYER, "CMD_INFECTED")
  380.             case 2: ze_colored_print(0, "!tAdmin !g%s !y- !g%s !t%L", szAdminName, szPlayerName, LANG_PLAYER, "CMD_INFECTED")
  381.         }
  382.     }
  383.    
  384.     // Log to Zombie Plague log file?
  385.     if (get_pcvar_num(g_pCvarLogAdminCmds))
  386.     {
  387.         new szAuthid[32], szIP[16]
  388.         get_user_authid(Admin_ID, szAuthid, charsmax(szAuthid))
  389.         get_user_ip(Admin_ID, szIP, charsmax(szIP), 1)
  390.         ze_log("Admin [%s(%s - %s)]-[%s] [%L]", szAdminName, szAuthid, szIP, szPlayerName, LANG_PLAYER, "CMD_INFECTED")
  391.     }
  392. }
  393.  
  394. stock ze_log(const szMessageFmt[], any:...)
  395. {
  396.     static szMessage[256], szFileName[32], szDate[16]
  397.     vformat(szMessage, charsmax(szMessage), szMessageFmt, 2)
  398.     format_time(szDate, charsmax(szDate), "%Y%m%d")
  399.     formatex(szFileName, charsmax(szFileName), "ZombieEscape_%s.log", szDate)
  400.     log_to_file(szFileName, "%s", szMessage)
  401. }
  402.  
  403. public _ze_open_admin_menu(id)
  404. {
  405.     if (!is_user_connected(id))
  406.     {
  407.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d)", id)
  408.         return false
  409.     }
  410.    
  411.     Open_Admin_Menu(id)
  412.     return true
  413. }
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

User avatar
Luxurious
Mod Tester
Mod Tester
Egypt
Posts: 177
Joined: 6 years ago
Location: Egypt
Contact:

#2

Post by Luxurious » 3 years ago

Hello, Can You Update This And Add Respawn in admin menu?
DRK Zombie-Escape V1.6
IP : 81.169.153.129:27015

User avatar
z0h1r-LK
Mod Developer
Mod Developer
Morocco
Posts: 476
Joined: 5 years ago
Location: The Red City ❤
Contact:

#3

Post by z0h1r-LK » 3 years ago

Luxurious wrote: 3 years ago Hello, Can You Update This And Add Respawn in admin menu?
Just tell me to add revive menu in menu !

User avatar
Luxurious
Mod Tester
Mod Tester
Egypt
Posts: 177
Joined: 6 years ago
Location: Egypt
Contact:

#4

Post by Luxurious » 3 years ago

lizoumapper wrote: 3 years ago
Luxurious wrote: 3 years ago Hello, Can You Update This And Add Respawn in admin menu?
Just tell me to add revive menu in menu !

Okay if u can
DRK Zombie-Escape V1.6
IP : 81.169.153.129:27015

Mouh11
Member
Member
Algeria
Posts: 1
Joined: 2 years ago
Contact:

#5

Post by Mouh11 » 2 years ago

How can i add zombie nemesis in the menu

User avatar
VicKy
Mod Tester
Mod Tester
Pakistan
Posts: 87
Joined: 3 years ago
Contact:

#6

Post by VicKy » 2 years ago

Can You Add
Coins Menu (viewtopic.php?t=3663)
Give Level Menu
Or Give Turtorial
Image

User avatar
Amnesia
Member
Member
Posts: 27
Joined: 2 years ago
Contact:

#7

Post by Amnesia » 2 years ago

Code: Select all

    register_native("ze_open_admin_menu", "_ze_open_admin_menu", 1)
Error :)!

User avatar
z0h1r-LK
Mod Developer
Mod Developer
Morocco
Posts: 476
Joined: 5 years ago
Location: The Red City ❤
Contact:

#8

Post by z0h1r-LK » 2 years ago

Amnesia wrote: 2 years ago

Code: Select all

    register_native("ze_open_admin_menu", "_ze_open_admin_menu", 1)
Error :)!
???

User avatar
Amnesia
Member
Member
Posts: 27
Joined: 2 years ago
Contact:

#9

Post by Amnesia » 1 year ago

Z0uha1r_LK wrote: 2 years ago
Amnesia wrote: 2 years ago

Code: Select all

    register_native("ze_open_admin_menu", "_ze_open_admin_menu", 1)
Error :)!
???
he is saying error there so yep!

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 0 guests