Raised This Month: $ Target: $400
 0% 

Using chat to fill in the blanks in a command?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Stealth Penguin
Junior Member
Join Date: Jan 2005
Old 06-24-2006 , 18:20   Re: Using chat to fill in the blanks in a command?
Reply With Quote #1

I have a question about the code you made, where would I put the player selection? Thanks for the start.

Last edited by Stealth Penguin; 06-24-2006 at 20:58. Reason: isolating the question
Stealth Penguin is offline
Send a message via ICQ to Stealth Penguin Send a message via AIM to Stealth Penguin Send a message via Yahoo to Stealth Penguin
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 06-24-2006 , 21:31   Re: Using chat to fill in the blanks in a command?
Reply With Quote #2

If I understood you correctly, you put the player selection inside the switch statement in the menu cmd function.
__________________
twistedeuphoria is offline
Stealth Penguin
Junior Member
Join Date: Jan 2005
Old 06-24-2006 , 22:08   Re: Using chat to fill in the blanks in a command?
Reply With Quote #3

I need a seperate menu to select the players, it should be brought up after the command (psay or execclient for instance) is selected from the other menu.
Stealth Penguin is offline
Send a message via ICQ to Stealth Penguin Send a message via AIM to Stealth Penguin Send a message via Yahoo to Stealth Penguin
Stealth Penguin
Junior Member
Join Date: Jan 2005
Old 06-25-2006 , 02:16   Re: Using chat to fill in the blanks in a command?
Reply With Quote #4

Currently I'm trying to figure out how to make a selection of a player from a list of players in a menu (already made that menu) so I can insert that into the console command thing.

Does the code you posted actually allow you to have a players name selected from a menu? Wouldn't the switch cases have to be like:
Code:
case 1: client_cmd(id,"command1 %s %s",name,said) case 2: client_cmd(id,"command2 %s %s",name,said)
Instead of like:
Code:
case 1: client_cmd(id,"command1 %s",said) case 2: client_cmd(id,"command2 %s",said)

*edit*
Code:
public ShowMiscMenu( id, pos ) {     if( pos < 0 )     {         return     }     pos = g_nMiscMenuPosition[id] = 0     format(szMenuBody8, 255, "\yMisc:^n" )     add(szMenuBody8, 255, "^n\w1. psay"  )     add(szMenuBody8, 255, "^n\w2. execclient" )     add(szMenuBody8, 255, "^n^n\w0. Index Menu" )     show_menu( id, 1023, szMenuBody8, -1 ) } public MiscMenuCommand(id,key) {     switch(key)     {         case 0:         {             ShowPlayerListMenu( id, g_nPlayerListMenuPosition[id])             PlayerOption2[id] = 1         }         case 1:         {             ShowPlayerListMenu( id, g_nPlayerListMenuPosition[id])             PlayerOption2[id] = 2         }     }     return PLUGIN_HANDLED } public ShowPlayerListMenu(id,pos) {     if (pos <   0)     {         return     }     get_players(g_menuPlayers2[id],g_menuPlayersNum2[id])     new t     new name[32]     get_user_name(t,name,31)     new b   =   0     new start   =   pos *   6     if (start   >= g_menuPlayersNum2[id])     start   =   pos = g_nPlayerListMenuPosition[id] = 0     new len =   format(szPlayerListMenuBody,    255, "\yWhich Player?:\R%d/%d^n\w^n", pos + 1(   g_menuPlayersNum2[id] / 6 + ((g_menuPlayersNum2[id] %   6) ? 1 : 0 ))   )     new end =   start   +   6     new keys = MENU_KEY_0|MENU_KEY_8     if (end >   g_menuPlayersNum2[id])     {         end =   g_menuPlayersNum2[id]     }     for (new a = start; a   <   end; ++a)     {         t   =   g_menuPlayers2[id][a]         get_user_name(t,name,31)         if ( is_user_bot(t) || access(t,ADMIN_IMMUNITY) )         {             ++b             if ( g_coloredMenus )             len += format(szPlayerListMenuBody[len],255-len,    "\d%d. %s^n",b,name)             else             len += format(szPlayerListMenuBody[len],255-len,"#. %s^n",name)         }         else         {             keys |= (1<<b)             len += format(szPlayerListMenuBody[len],255-len,"\w%d.  %s^n",++b,name)         }     }     if (end >   g_menuPlayersNum2[id])     end =   g_menuPlayersNum2[id]     if (end != g_menuPlayersNum2[id])     {         len += format(szPlayerListMenuBody[len],255-len,"^n8. More")         len += format(szPlayerListMenuBody[len],255-len,"^n9. Back")     }     else format(szPlayerListMenuBody[len],255-len,"^n0. Back to choices")     show_menu(id,keys,szPlayerListMenuBody,-1,"\yWhich Player?:") } public PlayerListCommand(id,key) {     switch (key) {         case 7: ShowPlayerListMenu(id,++g_nPlayerListMenuPosition[id])         case 8: ShowPlayerListMenu(id,--g_nPlayerListMenuPosition[id])         case 9: ShowMiscMenu(id, 0)         default:         {             PlayerTarget = g_menuPlayers2[id][g_nPlayerListMenuPosition[id] * 6 + key]             new name2[32], name[32]             get_user_name(id,name2,31)             new authid[32],authid2[32]             get_user_authid(id,authid,31)             get_user_authid(id,authid2,31)             i   =   g_menuPlayers[id][a]             get_user_name(i,PlayerTarget,31)             get_user_name(id,name,31)             ShowPlayerListMenu(id,g_nPlayerListMenuPosition[id])             if ( PlayerOption2[id] == 1 )             {                 sayspecial[id] = 1             }             else if ( PlayerOption2[id] == 2 )             {                 sayspecial[id] = 2             }         }     } } public DoShowPlayerListMenu(id,level,cid) {     if (!cmd_access(id,level,cid,1))     {         return PLUGIN_HANDLED     }     ShowPlayerListMenu(id,g_nPlayerListMenuPosition[id] = 0)     return PLUGIN_HANDLED } ///////////////////////////////////////////////////////////////////////////// public say_hook(id) {     new said[191]     read_args(said,190)     remove_quotes(said)     if( sayspecial[id] != 0 )     {         switch(sayspecial[id])         {             case 1: client_cmd(id,"amx_psay %s %s",PlayerTarget,said)             case 2: client_cmd(id,"amx_execclient %s %s",PlayerTarget,said)         }         sayspecial[id] = 0         PlayerTarget[id] = 0     }     return PLUGIN_HANDLED }
There is what I've tried to get working so far. The problem seems to be with finding the name of the player you select in the menu and getting it into the client_cmd string. This is quite baffling to me, because the menus show up fine, its just that the way the command is carried out is not correct. After I choose an option from the first menu, it goes to the second menu to choose a player. Once I choose a player I can type into chat "Bob kill" and it will either psay to Bob "kill" (without the quotes) or it will make him kill himself depending on which of the first menu's options I chose. I'm trying to eliminate having to type the person's name into the chat.

Last edited by Stealth Penguin; 06-25-2006 at 03:33. Reason: stumped
Stealth Penguin is offline
Send a message via ICQ to Stealth Penguin Send a message via AIM to Stealth Penguin Send a message via Yahoo to Stealth Penguin
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 06-25-2006 , 08:58   Re: Using chat to fill in the blanks in a command?
Reply With Quote #5

Holy fucking tabs and variables >_>!
__________________

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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