SHARE
TWEET

Servers Menu v1.0

orayon May 21st, 2020 (edited) 1,271 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <amxmodx>
  2.  
  3. enum _:ServerData
  4. {
  5.     g_Name[50],
  6.     g_IP[90]
  7. }
  8. new g_Servers[][ServerData] =
  9. {
  10.     {"server #1", "192.168.1.1"},
  11.     {"server #2", "192.168.1.2"},
  12.     {"server #3", "192.168.1.3"}
  13. }
  14.  
  15. public plugin_init() {
  16.     register_plugin("Servers Menu", "1.0", "BiBi")
  17.    
  18.     register_clcmd("say /server", "ServerMenu")
  19.     register_clcmd("say /servers", "ServerMenu")
  20.     register_clcmd("say_team /server", "ServerMenu")
  21.     register_clcmd("say_team /servers", "ServerMenu")
  22. }
  23.  
  24. public ServerMenu(id)
  25. {
  26.     new menu = menu_create("Servers menu", "mHandler")
  27.    
  28.     for (new i; i < sizeof(g_Servers); i++)
  29.     {
  30.         new format[60]
  31.         formatex(format, charsmax(format), "%s", g_Servers[i][g_Name])
  32.         menu_additem(menu, format)
  33.     }
  34.    
  35.     menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
  36.     menu_display(id, menu)
  37. }
  38.  
  39.  
  40. public mHandler(id, menu, item)
  41. {
  42.     new szName[ 32 ]
  43.     get_user_name( id, szName, charsmax( szName ))
  44.  
  45.     if (item == MENU_EXIT)
  46.     {
  47.         menu_destroy(menu)
  48.         return;
  49.     }
  50.    
  51.     client_cmd(id, ";^"Connect^" %s", g_Servers[item][g_IP])
  52.     client_print(0, print_chat, "^3%s ^1Has Connected To The Server^4%s", szName, g_Servers[item][g_Name]);
  53. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top