Forum

> > CS2D > Scripts > My menu get closed.
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch My menu get closed.

5 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt My menu get closed.

Pablotez
User Off Offline

Zitieren
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.
2× editiert, zuletzt 03.04.17 08:49:25

alt Re: My menu get closed.

DC
Admin Off Offline

Zitieren
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.

alt Re: My menu get closed.

Pablotez
User Off Offline

Zitieren
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.

alt Re: My menu get closed.

Powermonger
User Off Offline

Zitieren
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.

alt Re: My menu get closed.

Pablotez
User Off Offline

Zitieren
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
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht