AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   simple script please help (https://forums.alliedmods.net/showthread.php?t=41428)

k007 07-15-2006 03:24

simple script please help
 
could someone tell me whats wrong with this?
Code:
#include <amxmodx> #include <amxmisc> #define KeysServers (1<<0)|(1<<1)|(1<<2)|(1<<3) public plugin_init() {  register_plugin("server menus ", "1.0", "AUTHOR")  register_menucmd(register_menuid("Servers"), KeysServers, "PressedServers")  register_concmd("say /servers", "ShowServers")  register_cvar("sv_serversmenu", "1")     } public funcconecttosurf(id)          {          if((get_cvar_num("sv_serversmenu") == 0)                      {                client_print(id,print_chat,"This menu is disabled")              return PLUGIN_HANDLED            }            else                    {            client_print(id,print_console,"connect 63.211.110.204:27015")            }          return PLUGIN_HANDLED } public funcconecttocustomskin(id)         {         if((get_cvar_num("sv_serversmenu") == 0)                      {                        client_print(id,print_chat,"This menu is disabled")                      return PLUGIN_HANDLED           }           else                    {                    client_print(id,print_console,"connect 216.198.244.158:27015")           }         return PLUGIN_HANDLED } public funcconecttodeathmatch(id)         {         if((get_cvar_num("sv_serversmenu") == 0)                     {                       client_print(id,print_chat,"This menu is disabled")                     return PLUGIN_HANDLED           }           else                    {                    client_print(id,print_console,"connect 70.31.209.45:27014")           }         return PLUGIN_HANDLED } public END_MENU(id) { return PLUGIN_HANDLED } public ShowServers(id)  {  if(get_cvar_num("sv_serversmenu") == 0)    client_print(id,print_chat,"This mod is disabled")     return PLUGIN_HANDLED    }  else   {                    show_menu(id, KeysServers, "Servers^n^n1. Go to the surf server^n2. Go to the custom skin server^n3. Go to the Death match server^n4. Exit^n", -1, "Servers")                    return PLUGIN_HANDLED          }          return PLUGIN_HANDLED } public PressedServers(id, key)         {         switch (key)         {                  case 0:                  {                              funcconecttosurf(id)                  }                  case 1:                  {                              funcconecttocustomskin(id)                    }                  case 2:                  {                              funcconecttodeathmatch(id)                  }                  case 3:                  {                              END_MENU(id)                  }         } }

teame06 07-15-2006 03:45

Re: simple script please help
 
Code:
client_print(id,print_console,"connect 63.211.110.204:27015") to client_cmd(id, "connect 63.211.110.204:27015")

This need to be done to all of them. What you are doing is just printing to the client console. You need to use the client_cmd to send the command to the console.

Gizmo 07-15-2006 03:47

Re: simple script please help
 
Like teame06 said, you need to connect to the server
Code:
#include <amxmodx> #include <amxmisc> #define KeysServers (1<<0)|(1<<1)|(1<<2)|(1<<3) public plugin_init() {     register_plugin("server menus ", "1.0", "AUTHOR")     register_menucmd(register_menuid("Servers"), KeysServers, "PressedServers")     register_concmd("say /servers", "ShowServers")     register_cvar("sv_serversmenu", "1") } public funcconecttosurf(id) {     if(get_cvar_num("sv_serversmenu") == 0)     {         client_print(id,print_chat,"This menu is disabled")         return PLUGIN_HANDLED     }     else     {         client_cmd(id, "connect 63.211.110.204:27015")     }     return PLUGIN_HANDLED } public funcconecttocustomskin(id) {     if(get_cvar_num("sv_serversmenu") == 0)     {         client_print(id,print_chat,"This menu is disabled")         return PLUGIN_HANDLED     }     else     {         client_cmd(id, "connect 216.198.244.158:27015")     }     return PLUGIN_HANDLED } public funcconecttodeathmatch(id) {     if(get_cvar_num("sv_serversmenu") == 0)     {         client_print(id,print_chat,"This menu is disabled")         return PLUGIN_HANDLED     }     else     {         client_cmd(id, "connect 70.31.209.45:27014")     }     return PLUGIN_HANDLED } public END_MENU(id) {     return PLUGIN_HANDLED } public ShowServers(id) {     if(get_cvar_num("sv_serversmenu") == 0)     {         client_print(id,print_chat,"This mod is disabled")         return PLUGIN_HANDLED     }     else     {         show_menu(id, KeysServers, "Servers^n^n1. Go to the surf server^n2. Go to the custom skin server^n3. Go to the Death match server^n4. Exit^n", -1, "Servers")         return PLUGIN_HANDLED     }     return PLUGIN_HANDLED } public PressedServers(id, key) {     switch (key)     {         case 0: funcconecttosurf(id)         case 1: funcconecttocustomskin(id)         case 2: funcconecttodeathmatch(id)         case 3: END_MENU(id)     } }

k007 07-15-2006 04:50

Re: simple script please help
 
thank you guys so much +karma and i just though printin it in the users concel is the same thing


All times are GMT -4. The time now is 08:06.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.