[ZE] Admin Coins Menu

Gameplay Addons
User avatar
Luxurious
Senior Member
Senior Member
Egypt
Posts: 150
Joined: 1 Year Ago
Location: Egypt
Has thanked: 3 times
Been thanked: 4 times
Contact:

[ZE] Admin Coins Menu

#1

Post by Luxurious » 3 Months Ago

hi all , its my first post here !
I have converted this Plugin To Zombie Escape V1.4

Description:
This Plugins Only For Admins Access "ADMIN_PASSWORD (k)"

Instructions:
  • You Can Use /ecmenu OR ecmenu in console
Some Photos:
coins_menu.JPG
coins_menu.JPG (17.52 KiB) Viewed 564 times
coins_menu.JPG
coins_menu.JPG (17.52 KiB) Viewed 564 times
give_coins.JPG
take_coins.JPG
Code:
  1. #include <zombie_escape>
  2. #include <colorchat>
  3.  
  4. enum _:PlayerData
  5. {
  6.     g_szName[32],
  7.     g_szSteamID[32],
  8.     g_iOption,
  9.     g_iPlayer,
  10.     g_iChoosen
  11. }
  12.  
  13. new g_PlayerInfo[33][PlayerData] /* [0 - 32], [0 - 4]*/
  14.  
  15. new const g_szCoinsMenuItems[][] =
  16. {
  17.     "\yGive Coins",
  18.     "\yTake Coins",
  19.     "\ySet Coins^n",
  20.     "\yReload Coins"
  21. }
  22.  
  23. public plugin_init()
  24. {
  25.     register_plugin("Admin Menu", "1.0", "Luxurious")
  26.  
  27.     register_concmd("say /ecmenu", "CoinsMenu", ADMIN_PASSWORD)
  28.     register_concmd("ecmenu", "CoinsMenu", ADMIN_PASSWORD)
  29.  
  30.     register_concmd("ENTER_Coins_NUMBER", "CoinsEntered")
  31.  
  32.     register_concmd("ENTER_Coins_Reset", "CoinsReset")
  33. }
  34.  
  35. public client_authorized(id)
  36. {
  37.     get_user_name(id, g_PlayerInfo[id][g_szName], charsmax(g_PlayerInfo[][g_szName]))
  38.     get_user_authid(id, g_PlayerInfo[id][g_szSteamID], charsmax(g_PlayerInfo[][g_szSteamID]))
  39. }
  40.  
  41. public plugin_natives()
  42. {
  43.     register_native("CoinsMenu","native_CoinsMenu",1)
  44. }
  45.  
  46. public native_CoinsMenu(id)
  47. {
  48.     CoinsMenu(id)
  49. }
  50.  
  51. public CoinsMenu(id)
  52. {
  53.     new iMenuID = menu_create("\rCoins Menu \w:", "CoinsMenuHandle")
  54.  
  55.     for(new i=0; i<sizeof(g_szCoinsMenuItems); i++) menu_additem(iMenuID, g_szCoinsMenuItems[i])
  56.  
  57.     menu_display(id, iMenuID)
  58. }
  59.  
  60. public CoinsMenuHandle(id, iMenuID, iItem)
  61. {
  62.     switch(iItem)
  63.     {
  64.         case 0, 1, 2:
  65.         {
  66.             g_PlayerInfo[id][g_iOption] = iItem+1
  67.             ChooseCoinsPlayer(id)
  68.         }
  69.         case 3:
  70.         {
  71.             client_cmd(id, "messagemode ENTER_COINS_Reset")
  72.         }
  73.  
  74.     }
  75.  
  76.     menu_destroy(iMenuID)
  77.    
  78.     return 0
  79. }
  80.  
  81. public ChooseCoinsPlayer(id)
  82. {
  83.     new szItem[64], szName[33], iMenuID = menu_create("\rChoose Target \w:", "ChooseCoinsPlayerHandle")
  84.  
  85.     for(new i=0, n=0; i<=32; i++)
  86.     {
  87.         if(!is_user_connected(i)) continue
  88.  
  89.         g_PlayerInfo[n++][g_iPlayer] = i
  90.  
  91.         get_user_name(i, szName, charsmax(szName))
  92.  
  93.         formatex(szItem, charsmax(szItem), "\y%s - \d[\r%d\d]", szName, ze_get_escape_coins(i))
  94.  
  95.         menu_additem(iMenuID, szItem, "0", 0)
  96.     }
  97.  
  98.     menu_display(id, iMenuID)
  99. }
  100.  
  101. public ChooseCoinsPlayerHandle(id, iMenuID, iItem)
  102. {
  103.     if (!is_user_connected(id))
  104.         return 1
  105.    
  106.     if ((!(iItem >= 0 && iItem <= 32)) || (!(g_iChoosen >= 0 && iItem <= 4)) ||
  107.     (!(g_iPlayer >= 0 && g_iPlayer <= 4)))
  108.     {
  109.         return 1
  110.     }
  111.    
  112.     g_PlayerInfo[id][g_iChoosen] = g_PlayerInfo[iItem][g_iPlayer]
  113.  
  114.     if(!is_user_connected(g_PlayerInfo[id][g_iChoosen]))
  115.     {
  116.  
  117.         ColorChat(id, TEAM_COLOR, "^4[Admin Menu] ^1Target Not Founded In The Server.")
  118.  
  119.         return 1
  120.     }
  121.  
  122.     client_cmd(id, "messagemode ENTER_Coins_NUMBER")
  123.  
  124.     menu_destroy(iMenuID)
  125.  
  126.     return 0
  127. }
  128.  
  129. public CoinsEntered(id)
  130. {
  131.     new szNumber[32], iNumber, g_aName[33]
  132.  
  133.     get_user_name(id, g_aName, 32)
  134.  
  135.     read_argv(1, szNumber, charsmax(szNumber))
  136.  
  137.     iNumber = str_to_num(szNumber)
  138.  
  139.     if(!iNumber) return 1
  140.  
  141.     if(!is_user_connected(g_PlayerInfo[id][g_iChoosen]))
  142.     {
  143.         ColorChat(id, TEAM_COLOR, "^4[Admin Menu] ^1Target Not Founded In The Server.")
  144.  
  145.         return 1
  146.     }
  147.  
  148.     switch(g_PlayerInfo[id][g_iOption])
  149.     {
  150.         case 1:
  151.         {
  152.  
  153.             ze_set_escape_coins(g_PlayerInfo[id][g_iChoosen], ze_get_escape_coins(g_PlayerInfo[id][g_iChoosen]) + iNumber)
  154.  
  155.             ColorChat(0, TEAM_COLOR, "^4[Admin Menu] ^1Admin ^3%s ^1have Gaved ^4%i ^1Escape Coins To ^3%s.", g_aName, iNumber, g_PlayerInfo[g_PlayerInfo[id][g_iChoosen]][g_szName])
  156.  
  157.             ze_log("ADMIN %s Gaved %i Coins To %s", g_aName, iNumber, g_PlayerInfo[g_PlayerInfo[id][g_iChoosen]][g_szName])
  158.  
  159.         }
  160.         case 2:
  161.         {
  162.             ze_set_escape_coins(g_PlayerInfo[id][g_iChoosen], ze_get_escape_coins(g_PlayerInfo[id][g_iChoosen]) - iNumber)
  163.  
  164.             ColorChat(0, TEAM_COLOR, "^4[Admin Menu] ^1Admin ^3%s ^1have Taked ^4%i ^1Escape Coins From ^3%s.", g_aName, iNumber, g_PlayerInfo[g_PlayerInfo[id][g_iChoosen]][g_szName])
  165.  
  166.             ze_log("ADMIN %s Taked %i Coins From %s", g_aName, iNumber, g_PlayerInfo[g_PlayerInfo[id][g_iChoosen]][g_szName])
  167.         }
  168.         case 3:
  169.         {
  170.             ze_set_escape_coins(g_PlayerInfo[id][g_iChoosen], iNumber)
  171.  
  172.             ColorChat(0, TEAM_COLOR, "^4[Admin Menu] ^1Admin ^3%s ^1have Set Coins Of ^3%s ^1To ^4%i ^1Escape Coins.", g_aName, g_PlayerInfo[g_PlayerInfo[id][g_iChoosen]][g_szName], iNumber)
  173.  
  174.             ze_log("ADMIN %s Have Set Coins Of %s To %i", g_aName, g_PlayerInfo[g_PlayerInfo[id][g_iChoosen]][g_szName], iNumber)
  175.         }
  176.     }
  177.    
  178.     return 0
  179. }
  180.  
  181. public CoinsReset(id)
  182. {
  183.     new szNumber[32], iNumber, g_aName[33]
  184.    
  185.     get_user_name(id, g_aName, 32)
  186.  
  187.     read_argv(1, szNumber, charsmax(szNumber))
  188.  
  189.     iNumber = str_to_num(szNumber)
  190.  
  191.     if(!iNumber) return 1
  192.  
  193.     new iPlayers[32], iPlayerCount, i, player
  194.  
  195.     get_players(iPlayers, iPlayerCount, "a")
  196.  
  197.     for(i = 0; i < iPlayerCount; i++)
  198.     {
  199.         player = iPlayers[i]
  200.  
  201.         if(ze_get_escape_coins(player) >= iNumber)
  202.  
  203.             continue
  204.  
  205.         ze_set_escape_coins(player, iNumber)
  206.     }
  207.  
  208.     ColorChat(0, TEAM_COLOR, "^4[Admin Menu] ^1Admin ^3%s ^1have Reset Coins To ^3^%i ^4Escape Coins.", g_aName, iNumber)
  209.  
  210.     ze_log("ADMIN %s Have Set Coins To %i Escape Coins", g_aName, iNumber)
  211.  
  212.     return 0
  213. }
  214.  
  215.  
  216.  
  217. stock ze_log(const message_fmt[], any:...)
  218. {
  219.  
  220.     static message[256], filename[32]
  221.  
  222.     vformat(message, charsmax(message), message_fmt, 2)
  223.  
  224.     formatex(filename, charsmax(filename), "ze_Adminmenu.log")
  225.  
  226.     log_to_file(filename, "%s", message)
  227. }
Last edited by Luxurious on 30 Jul 2019, 13:06, edited 2 times in total.
These users thanked the author Luxurious for the post (total 2):
Muhammet20 (3 Months Ago) • tmv (3 Months Ago)
BeTalk Zombie-Escape V1.4
IP : 51.77.103.159:27015

User avatar
Muhammet20
Veteran Member
Veteran Member
Syria
Posts: 399
Joined: 1 Year Ago
Location: Turkey
Has thanked: 36 times
Been thanked: 5 times
Age: 13
Contact:

#2

Post by Muhammet20 » 3 Months Ago

nice sharing bro
+Like
.::Kaya Gaming || Never Give Up || Zombie Escape::. [Server is Under The Work]
https://kaya-gaming.ga/

I just believe in two things, First thing is who i see in the mirror, second thing is who i don't see in the sky.

User avatar
tmv
Member
Member
Russia
Posts: 31
Joined: 3 Months Ago
Has thanked: 2 times
Been thanked: 0
Age: 19
Contact:

#3

Post by tmv » 3 Months Ago

Do not use the colorchat include

User avatar
Muhammet20
Veteran Member
Veteran Member
Syria
Posts: 399
Joined: 1 Year Ago
Location: Turkey
Has thanked: 36 times
Been thanked: 5 times
Age: 13
Contact:

#4

Post by Muhammet20 » 3 Months Ago

@tmv why not?
.::Kaya Gaming || Never Give Up || Zombie Escape::. [Server is Under The Work]
https://kaya-gaming.ga/

I just believe in two things, First thing is who i see in the mirror, second thing is who i don't see in the sky.

User avatar
tmv
Member
Member
Russia
Posts: 31
Joined: 3 Months Ago
Has thanked: 2 times
Been thanked: 0
Age: 19
Contact:

#5

Post by tmv » 3 Months Ago

Because most of the users are using amx 1.8.3 and higher (1.9)

User avatar
Luxurious
Senior Member
Senior Member
Egypt
Posts: 150
Joined: 1 Year Ago
Location: Egypt
Has thanked: 3 times
Been thanked: 4 times
Contact:

#6

Post by Luxurious » 3 Months Ago

Muhammet20 wrote:
3 Months Ago
nice sharing bro
+Like
Thx Bro <3
BeTalk Zombie-Escape V1.4
IP : 51.77.103.159:27015

User avatar
tmv
Member
Member
Russia
Posts: 31
Joined: 3 Months Ago
Has thanked: 2 times
Been thanked: 0
Age: 19
Contact:

#7

Post by tmv » 3 Months Ago

[AMXX] Displaying debug trace (plugin "ze_admin_coins_menu.amxx", version "1.0")
[AMXX] Run time error 4: index out of bounds
[AMXX] [0] ze_admin_coins_menu.sma::ChooseCoinsPlayerHandle (line 160)
Last edited by tmv on 29 Jul 2019, 13:45, edited 1 time in total.

User avatar
Luxurious
Senior Member
Senior Member
Egypt
Posts: 150
Joined: 1 Year Ago
Location: Egypt
Has thanked: 3 times
Been thanked: 4 times
Contact:

#8

Post by Luxurious » 3 Months Ago

tmv wrote:
3 Months Ago
[AMXX] Displaying debug trace (plugin "ze_admin_coins_menu.amxx", version "1.0")
[AMXX] Run time error 4: index out of bounds
[AMXX] [0] ze_admin_coins_menu.sma::ChooseCoinsPlayerHandle (line 156)
Try!
  1. #include <zombie_escape>
  2. #include <colorchat>
  3.  
  4.  
  5.  
  6. enum _:PlayerData
  7.  
  8. {
  9.  
  10.     g_szName[32],
  11.  
  12.     g_szSteamID[32],
  13.  
  14.     g_iOption,
  15.  
  16.     g_iPlayer,
  17.  
  18.     g_iChoosen
  19.  
  20. }
  21.  
  22.  
  23.  
  24. new g_PlayerInfo[33][PlayerData]
  25.  
  26.  
  27.  
  28. new const g_szCoinsMenuItems[][] =
  29.  
  30. {
  31.  
  32.     "\yGive Coins",
  33.  
  34.     "\yTake Coins",
  35.  
  36.     "\ySet Coins^n",
  37.  
  38.     "\yReload Coins"
  39.  
  40. }
  41.  
  42.  
  43.  
  44. public plugin_init()
  45.  
  46. {
  47.  
  48.     register_plugin("Admin Menu", "1.0", "Luxurious")
  49.  
  50.     register_concmd("say /ecmenu", "CoinsMenu", ADMIN_PASSWORD)
  51.     register_concmd("ecmenu", "CoinsMenu", ADMIN_PASSWORD)
  52.    
  53.  
  54.    
  55.  
  56.     register_concmd("ENTER_Coins_NUMBER", "CoinsEntered")
  57.  
  58.     register_concmd("ENTER_Coins_Reset", "CoinsReset")
  59.  
  60. }
  61.  
  62.  
  63.  
  64. public client_authorized(id)
  65.  
  66. {
  67.  
  68.     get_user_name(id, g_PlayerInfo[id][g_szName], charsmax(g_PlayerInfo[][g_szName]))
  69.     get_user_authid(id, g_PlayerInfo[id][g_szSteamID], charsmax(g_PlayerInfo[][g_szSteamID]))
  70.  
  71. }
  72.  
  73.  public plugin_natives()
  74. {
  75.   register_native("CoinsMenu","native_CoinsMenu",1)
  76. }
  77. public native_CoinsMenu(id)
  78.  
  79. {
  80.   CoinsMenu(id)
  81.  
  82. }
  83.  
  84. public CoinsMenu(id)
  85.  
  86. {
  87.  
  88.     new iMenuID = menu_create("\rCoins Menu \w:", "CoinsMenuHandle")
  89.  
  90.     for(new i=0; i<sizeof(g_szCoinsMenuItems); i++) menu_additem(iMenuID, g_szCoinsMenuItems[i])
  91.  
  92.     menu_display(id, iMenuID)
  93.  
  94. }
  95.  
  96.  
  97.  
  98. public CoinsMenuHandle(id, iMenuID, iItem)
  99.  
  100. {
  101.  
  102.     switch(iItem)
  103.  
  104.     {
  105.  
  106.         case 0, 1, 2:
  107.  
  108.         {
  109.  
  110.             g_PlayerInfo[id][g_iOption] = iItem+1
  111.  
  112.             ChooseCoinsPlayer(id)
  113.  
  114.         }
  115.  
  116.         case 3: client_cmd(id, "messagemode ENTER_COINS_Reset")
  117.  
  118.     }
  119.  
  120.     menu_destroy(iMenuID)
  121.  
  122.     return 0
  123.  
  124. }
  125.  
  126.  
  127.  
  128. public ChooseCoinsPlayer(id)
  129.  
  130. {
  131.  
  132.     new szItem[64], szName[33], iMenuID = menu_create("\rChoose Target \w:", "ChooseCoinsPlayerHandle")
  133.  
  134.     for(new i=0, n=0; i<=32; i++)
  135.  
  136.     {
  137.  
  138.         if(!is_user_connected(i)) continue
  139.  
  140.         g_PlayerInfo[n++][g_iPlayer] = i
  141.  
  142.         get_user_name(i, szName, charsmax(szName))
  143.  
  144.         formatex(szItem, charsmax(szItem), "\y%s - \d[\r%d\d]", szName, ze_get_escape_coins(i))
  145.  
  146.         menu_additem(iMenuID, szItem, "0", 0)
  147.  
  148.     }
  149.  
  150.     menu_display(id, iMenuID)
  151.  
  152. }
  153.  
  154.  
  155.  
  156. public ChooseCoinsPlayerHandle(id, iMenuID, iItem)
  157.  
  158. {
  159.  
  160.     g_PlayerInfo[id][g_iChoosen] = g_PlayerInfo[iItem][g_iPlayer]
  161.  
  162.     if(!is_user_connected(g_PlayerInfo[id][g_iChoosen]))
  163.  
  164.     {
  165.  
  166.     ColorChat(id, TEAM_COLOR, "^4[Admin Menu] ^1Target Not Founded In The Server.")
  167.  
  168.         return 1
  169.  
  170.     }
  171.  
  172.     client_cmd(id, "messagemode ENTER_Coins_NUMBER")
  173.  
  174.     menu_destroy(iMenuID)
  175.  
  176.     return 0
  177.  
  178. }
  179.  
  180.  
  181.  
  182. public CoinsEntered(id)
  183.  
  184. {
  185.  
  186.     new szNumber[32], iNumber, g_aName[33]
  187.  
  188.     get_user_name(id, g_aName, 32)
  189.  
  190.     read_argv(1, szNumber, charsmax(szNumber))
  191.  
  192.     iNumber = str_to_num(szNumber)
  193.  
  194.     if(!iNumber) return 1
  195.  
  196.     if(!is_user_connected(g_PlayerInfo[id][g_iChoosen]))
  197.  
  198.     {
  199.  
  200.         ColorChat(id, TEAM_COLOR, "^4[Admin Menu] ^1Target Not Founded In The Server.")
  201.  
  202.         return 1
  203.  
  204.     }
  205.  
  206.     switch(g_PlayerInfo[id][g_iOption])
  207.  
  208.     {
  209.  
  210.         case 1:
  211.  
  212.         {
  213.  
  214.             ze_set_escape_coins(g_PlayerInfo[id][g_iChoosen], ze_get_escape_coins(g_PlayerInfo[id][g_iChoosen]) + iNumber)
  215.  
  216.             ColorChat(0, TEAM_COLOR, "^4[Admin Menu] ^1Admin ^3%s ^1have Gaved ^4%i ^1Escape Coins To ^3%s.", g_aName, iNumber, g_PlayerInfo[g_PlayerInfo[id][g_iChoosen]][g_szName])
  217.  
  218.             ze_log("ADMIN %s Gaved %i Coins To %s", g_aName, iNumber, g_PlayerInfo[g_PlayerInfo[id][g_iChoosen]][g_szName])
  219.  
  220.         }
  221.  
  222.         case 2:
  223.  
  224.         {
  225.  
  226.             ze_set_escape_coins(g_PlayerInfo[id][g_iChoosen], ze_get_escape_coins(g_PlayerInfo[id][g_iChoosen]) - iNumber)
  227.  
  228.             ColorChat(0, TEAM_COLOR, "^4[Admin Menu] ^1Admin ^3%s ^1have Taked ^4%i ^1Escape Coins From ^3%s.", g_aName, iNumber, g_PlayerInfo[g_PlayerInfo[id][g_iChoosen]][g_szName])
  229.  
  230.             ze_log("ADMIN %s Taked %i Coins From %s", g_aName, iNumber, g_PlayerInfo[g_PlayerInfo[id][g_iChoosen]][g_szName])
  231.  
  232.         }
  233.  
  234.         case 3:
  235.  
  236.         {
  237.  
  238.             ze_set_escape_coins(g_PlayerInfo[id][g_iChoosen], iNumber)
  239.  
  240.             ColorChat(0, TEAM_COLOR, "^4[Admin Menu] ^1Admin ^3%s ^1have Set Coins Of ^3%s ^1To ^4%i ^1Escape Coins.", g_aName, g_PlayerInfo[g_PlayerInfo[id][g_iChoosen]][g_szName], iNumber)
  241.  
  242.             ze_log("ADMIN %s Have Set Coins Of %s To %i", g_aName, g_PlayerInfo[g_PlayerInfo[id][g_iChoosen]][g_szName], iNumber)
  243.  
  244.         }
  245.  
  246.     }
  247.  
  248.     return 0
  249.  
  250. }
  251.  
  252.  
  253.  
  254. public CoinsReset(id)
  255.  
  256. {
  257.  
  258.     new szNumber[32], iNumber, g_aName[33]
  259.  
  260.     get_user_name(id, g_aName, 32)
  261.  
  262.     read_argv(1, szNumber, charsmax(szNumber))
  263.  
  264.     iNumber = str_to_num(szNumber)
  265.  
  266.     if(!iNumber) return 1
  267.  
  268.     new iPlayers[32], iPlayerCount, i, player
  269.  
  270.     get_players(iPlayers, iPlayerCount, "a")
  271.  
  272.     for(i = 0; i < iPlayerCount; i++)
  273.  
  274.     {
  275.  
  276.         player = iPlayers[i]
  277.  
  278.         if(ze_get_escape_coins(player) >= iNumber)
  279.  
  280.             continue
  281.  
  282.         ze_set_escape_coins(player, iNumber)
  283.  
  284.     }
  285.  
  286.     ColorChat(0, TEAM_COLOR, "^4[Admin Menu] ^1Admin ^3%s ^1have Reset Coins To ^3^%i ^4Escape Coins.", g_aName, iNumber)
  287.  
  288.     ze_log("ADMIN %s Have Set Coins To %i Escape Coins", g_aName, iNumber)
  289.  
  290.     return 0
  291.  
  292. }
  293.  
  294.  
  295.  
  296. stock ze_log(const message_fmt[], any:...)
  297.  
  298. {
  299.  
  300.     static message[256], filename[32]
  301.  
  302.     vformat(message, charsmax(message), message_fmt, 2)
  303.  
  304.     formatex(filename, charsmax(filename), "ze_Adminmenu.log")
  305.  
  306.     log_to_file(filename, "%s", message)
  307.  
  308. }
BeTalk Zombie-Escape V1.4
IP : 51.77.103.159:27015

User avatar
tmv
Member
Member
Russia
Posts: 31
Joined: 3 Months Ago
Has thanked: 2 times
Been thanked: 0
Age: 19
Contact:

#9

Post by tmv » 3 Months Ago

not fixed

User avatar
Luxurious
Senior Member
Senior Member
Egypt
Posts: 150
Joined: 1 Year Ago
Location: Egypt
Has thanked: 3 times
Been thanked: 4 times
Contact:

#10

Post by Luxurious » 3 Months Ago

tmv wrote:
3 Months Ago
not fixed
its working well with me !
BeTalk Zombie-Escape V1.4
IP : 51.77.103.159:27015

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest