Forum

> > CS2D > Scripts > My menu get closed.
Forums overviewCS2D overview Scripts overviewLog in to reply

English My menu get closed.

5 replies
To the start Previous 1 Next To the start

old My menu get closed.

Pablotez
User Off Offline

Quote
If I run the script with menu(id,"!slap 1, "..player(idpl[1], "name")) it recognize me but and add my name to the button. The problem comes when I try to recognize more players like in the spoiler and they do not exist, then the menu get closed.
Spoiler >

The console error message is this if you want to see it:
Spoiler >

Do you have an idea about what I need to do?
Thanks beforehand.
edited 2×, last 03.04.17 08:49:25 am

old Re: My menu get closed.

DC
Admin Off Offline

Quote
Aparrently you assigned no value to the variable
id
before using it in line 6. Therefore CS2D doesn't know for which player you want to open that menu.

old Re: My menu get closed.

Pablotez
User Off Offline

Quote
The idea is a punish menu and after select the type of punish you select the player who will be the target then I need to agroup the players there, the problem comes when any player have for example the id 2 then we have a nil value there, but I can not find the right form to do that menu without errors.

old Re: My menu get closed.

Powermonger
User Off Offline

Quote
This should work (not tested though):
1
menu(id,"!slap 1,"..(idpl[1] and player(idpl[1],"name") or "(-)")..","..(idpl[2] and player(idpl[2],"name") or "(-)")..","..(idpl[3] and player(idpl[3],"name") or "(-)")..","..(idpl[4] and player(idpl[4],"name") or "(-)")..","..(idpl[5] and player(idpl[5],"name") or "(-)")..","..(idpl[6] and player(idpl[6],"name") or "(-)")..","..(idpl[7] and player(idpl[7],"name") or "(-)")..","..(idpl[8] and player(idpl[8],"name") or "(-)")..", Next page")
Let me know if it doesn't work.

PS. Now tested and works.

old Re: My menu get closed.

Pablotez
User Off Offline

Quote
Thank you very much @user Powermonger: for spend a little of time on my code.
It was so easy as I can see but I'm not an experienced scripter, I'm still learning.
It works nice
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview