HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /* Plugin generated by AMXX-Studio */
  2.  
  3. #include <amxmodx>
  4. #include <amxmisc>
  5. #include <fun>
  6. #include <zombieplague>
  7.  
  8.  
  9. #define PLUGIN "Ammo Pack adas menubol"
  10. #define VERSION "1.0"
  11. #define AUTHOR "Bence98007"
  12.  
  13. new nev[32]
  14.  
  15. public plugin_init()
  16. {
  17. register_plugin(PLUGIN,VERSION,AUTHOR)
  18. register_clcmd("say /ammomenu", "ammomenu")
  19. register_cvar("ammo_mennyisege", "1000")
  20. }
  21.  
  22. public ammomenu(id)
  23. {
  24. if (get_user_flags(id) & ADMIN_BAN)
  25. {
  26. new menu = menu_create("\rValaszd ki a jatekost \d[By Bence98007]", "menu_handler");
  27. new players[32], pnum, tempid;
  28. new szName[32], szTempid[10];
  29. get_players(players, pnum);
  30.  
  31. for( new i; i<pnum; i++ )
  32. {
  33. tempid = players[i];
  34.  
  35. get_user_name(tempid, szName, charsmax(szName));
  36. num_to_str(tempid, szTempid, charsmax(szTempid));
  37.  
  38. menu_additem(menu, szName, szTempid, 0);
  39.  
  40. }
  41.  
  42. menu_display(id, menu, 0);
  43. }
  44. else
  45. {
  46. print_color(id, "!tEhez a parancshoz nincs engedlyed!")
  47. }
  48. }
  49. public menu_handler(id, menu, item)
  50. {
  51. if( item == MENU_EXIT )
  52. {
  53. menu_destroy(menu);
  54. return PLUGIN_HANDLED;
  55. }
  56.  
  57. new data[6], szName[64];
  58. new access, callback;
  59. menu_item_getinfo(menu, item, access, data,charsmax(data), szName,charsmax(szName), callback);
  60.  
  61. new tempid = str_to_num(data);
  62. new ammo = zp_get_user_ammo_packs(id)
  63. new cvar = get_cvar_num("ammo_mennyisege")
  64.  
  65. if(is_user_connected(tempid))
  66. {
  67. get_user_name(tempid, nev, 31)
  68. zp_set_user_ammo_packs(tempid, ammo+=cvar)
  69. print_color(0, "!g[Ammo Pack] !t%s !ykapott !t%d !gAmmo Pack-et!", nev, cvar)
  70. }
  71.  
  72. menu_destroy(menu);
  73. return PLUGIN_HANDLED;
  74. }
  75.  
  76.  
  77. stock print_color(const id, const input[], any:...)
  78. {
  79. new count = 1, players[32]
  80. static msg[191]
  81. vformat(msg, 190, input, 3)
  82.  
  83. replace_all(msg, 190, "!g", "^4")
  84. replace_all(msg, 190, "!y", "^1")
  85. replace_all(msg, 190, "!t", "^3")
  86. replace_all(msg, 190, "", "á")
  87. replace_all(msg, 190, "", "é")
  88. replace_all(msg, 190, "", "í")
  89. replace_all(msg, 190, "", "ó")
  90. replace_all(msg, 190, "", "ö")
  91. replace_all(msg, 190, "", "ő")
  92. replace_all(msg, 190, "", "ú")
  93. replace_all(msg, 190, "", "ü")
  94. replace_all(msg, 190, "", "ű")
  95. replace_all(msg, 190, "", "Á")
  96. replace_all(msg, 190, "", "É")
  97. replace_all(msg, 190, "", "Í")
  98. replace_all(msg, 190, "", "Ó")
  99. replace_all(msg, 190, "", "Ö")
  100. replace_all(msg, 190, "", "Ő")
  101. replace_all(msg, 190, "", "Ú")
  102. replace_all(msg, 190, "", "Ü")
  103. replace_all(msg, 190, "", "Ű")
  104.  
  105. if (id) players[0] = id; else get_players(players, count, "ch")
  106. {
  107. for (new i = 0; i < count; i++)
  108. {
  109. if (is_user_connected(players[i]))
  110. {
  111. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
  112. write_byte(players[i])
  113. write_string(msg)
  114. message_end()
  115. }
  116. }
  117. }
  118. return PLUGIN_HANDLED
  119. }
  120.