AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Open menu after connect (https://forums.alliedmods.net/showthread.php?t=113097)

Debesėlis 12-23-2009 12:09

Open menu after connect
 
PHP Code:

public client_connectid )
{
        if ( 
is_user_connectedid ) & is_user_aliveid ) )
        {
            
show_menu(id);
        }


why doesn't show the menu?

YamiKaitou 12-23-2009 12:25

Re: Open menu after connect
 
It would be best to show the menu after they join a team. client_connect is called when they connect, they aren't fully in the server yet.

Mxnn 12-23-2009 12:56

Re: Open menu after connect
 
You can use client_putinserver()

Lure.d 12-23-2009 13:27

Re: Open menu after connect
 
Sorry for a bit of lithuanian, just want to welcome this guy, becouse hes from my country.
[IGNORE THIS IF YOUR NOT LTU]
Sveikas, paprasciausiai naudok:
public client_putinserver(), atsidaryk { }
ir viduje irasyk kad atidarytu meniu. Skype motd_lt daugiau info ;]

[/IGNORE THIS IF YOUR NOT LTU]

Here's code for it to open menu when player is connected.

PHP Code:

public client_putinserver(id) {
     
show_menu(id);
     } 

if you wane, you can make a delay, for e.g:
player joins, and usually takes ~1,2 secs,
to choose team so he could clearly see the menu.
(becouse the chooseteam menu is on top of
your menu. So you press to team 1, it chooses 1 option of ur menu.

Ok so we add 5 seconds delay: (and another block of code :P)
PHP Code:

public client_putinserver(id) {
     
set_task(0.5show_menu_cmdid);
     }
public 
show_menu_cmd(id) {
     
show_menu(id);
     } 

Notes, not sure for the show_menu_cmd in task - maybe,
you can just type in show_menu(id) , but it might give an error,
in mine case works fine :P

platzpatrone 12-23-2009 14:07

Re: Open menu after connect
 
yeah Lure.d but the best way is to use the team_join event
after the team is choosen he gets the menu :wink:

YamiKaitou 12-23-2009 14:27

Re: Open menu after connect
 
Quote:

Originally Posted by Lure.d (Post 1028498)
Ok so we add 5 seconds delay: (and another block of code :P)
PHP Code:

public client_putinserver(id) {
     
set_task(0.5show_menu_cmdid);
     }
public 
show_menu_cmd(id) {
     
show_menu(id);
     } 


0.5 is half a second not 5 seconds.

BEST way would be to create a 2-5 second task on team_join/class_select and show the menu. This way you can make sure that they are ready.

worldspawn 12-23-2009 15:33

Re: Open menu after connect
 
how to detect team_join/class_select?

platzpatrone 12-23-2009 16:07

Re: Open menu after connect
 
Quote:

Originally Posted by worldspawn (Post 1028706)
how to detect team_join/class_select?

PHP Code:

register_event("TextMsg","team_join","a","1=1","2&Game_join_te","2&Game_join_ct"



All times are GMT -4. The time now is 04:16.

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