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
__________________