Raised This Month: $ Target: $400
 0% 

Execute Menu Action on target


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Zenith77
Veteran Member
Join Date: Aug 2005
Old 10-29-2005 , 19:32   Execute Menu Action on target
Reply With Quote #1

Ok, i want to know how to do soemthing to a selcted player...


For example I have a menu

Code:
Bla Bla

1. Bob
2. Joe
3. etc

9. Next
0. Exit
If i select Bob, I want to know how do i find out his index?

This is the code i have...

Code:
public ShowtryoutSelMenu(id) {         new szPlayer[200]     new szMenu[200]     new num[33]     new i         add(szMenu, 199, "Tryout\Accept Menu ( Press 8 To change Action ) ")         for( i = 0; i <get_maxplayers(); i++) {                 if( !is_user_connected(i) ) continue                 if( indexDislpayed[i] ) continue             //  if( is_user_admin(i) ) continue             //  if( i == id ) continue                 num[id]++                 if( num[id] == 8 ) {                         num[id] = 0                         break         }                     if( num[id] < 8 ) {                     new name[32]                         get_user_name(i, name, 31)                         szPlayer = ("%d. %s^n", num[id], name)                         add(szMenu, 199, szPlayer)                         indexDislpayed[i] = true                 }     }         switch(Action[id]) {                 case 1: add(szMenu, 199, "8. Tryout^n" )         case 2: add(szMenu, 199, "8. Accept^n" )     }         add(szMenu, 199, "9. Next^n")     add(szMenu, 199, "0. Exit")         show_menu(id,KeystryoutSelMenu, szMenu, -1, "tryoutSelMenu") // Display menu     } public PressedtryoutSelMenu(id, key) {     /* Menu:     * TryOut\Accept Menu     * $players(1,7,%n. %v)         * 8. Tryout\Accept         * 9.Next     * 0. Exit     */     switch (key) {         case 9: {                         new i                         for( i = 1; i < get_maxplayers(); i++ ) {                                 indexDislpayed[i] = false             }         }                     case 8: {                         ShowtryoutSelMenu(id)                     }                 case 7: {                         switch(Action[id]) {                                 case 1: Action[id] = ACTION_ACCEPT                 case 2: Action[id] = ACTION_TRYOUT             }                         ShowtryoutSelMenu(id)         }                 case 6: {                         // Do something to target         }     } }


I tried looking at AMXX's default menu plugin to find out how they did it but
I couldnt understand it :/

If you need any more info regarding this code, please tell me.

I thank you for all your help
--Zenith77
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Kensai
Veteran Member
Join Date: Aug 2005
Location: San Diego, California
Old 10-29-2005 , 19:46  
Reply With Quote #2

What do you mean? Show the menu only to "Bob"?

Make a command that shows the menu for the target player.

i.e.

Code:
public blah(id,level,cid)     {     if (!cmd_access(id,level,cid,3))         return PLUGIN_HANDLED             new arg[32], arg2[32]     read_argv(1,arg,31)     read_argv(2,arg2,31)         new target=cmd_target(id,arg,4)     if(!target)         {         client_print(id,print_console,"Invalid Target!")         return PLUGIN_HANDLED     }         ShowMenu(target)         return PLUGIN_HANDLED }

I think.
Kensai is offline
Send a message via AIM to Kensai Send a message via MSN to Kensai
Zenith77
Veteran Member
Join Date: Aug 2005
Old 10-29-2005 , 19:51  
Reply With Quote #3

lol kensai... thats not what i mean

I want to execute a function on the player he selects through a menu... not a command .
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Kensai
Veteran Member
Join Date: Aug 2005
Location: San Diego, California
Old 10-29-2005 , 20:04  
Reply With Quote #4

OOOO. So like if the menu is like.

Want 200hp?
1. Yes
2. No

And he picks yes you want his hp to be set to 200?
[/small]
Kensai is offline
Send a message via AIM to Kensai Send a message via MSN to Kensai
Sodium
Member
Join Date: Oct 2004
Old 10-29-2005 , 20:07  
Reply With Quote #5

http://forums.alliedmods.net/showthr...p?t=11192+menu
Sodium is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 10-29-2005 , 20:34  
Reply With Quote #6

@ kensai: nope thats still wrong...


nm everybody, i think i find a way, i'll post back to see if it works..
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Kensai
Veteran Member
Join Date: Aug 2005
Location: San Diego, California
Old 10-29-2005 , 20:41  
Reply With Quote #7

Lol, well nevermind then. You lost me.
Kensai is offline
Send a message via AIM to Kensai Send a message via MSN to Kensai
Charr
Senior Member
Join Date: Jul 2005
Location: Long Island, New York, U
Old 10-29-2005 , 21:19  
Reply With Quote #8

I think he means when you select bob, it executes a function on him.
__________________
Charr is offline
Send a message via AIM to Charr Send a message via MSN to Charr
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 23:39.


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