AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Show Menu Only after player choose team (https://forums.alliedmods.net/showthread.php?t=240260)

brlight 05-11-2014 14:53

Show Menu Only after player choose team
 
Hi, like title says I´m trying to display a Menu to players that enter Server but only after they choose one team (either T or CT). At the moment I have something like this:
PHP Code:

public showmenu(id)
{
    if( 
is_user_connected(id))
    {
        
Code Here
    
}


But if some player enter Server and doesnt choose any of the teams, menu is displayed while he is in Motd.Because user is actually "connected". How can I do so it will display only after choosing team?

Thanks in advance.


Regards,

brlight

wickedd 05-11-2014 15:52

Re: Show Menu Only after player choose team
 
You can just check if the player is alive.

PHP Code:

public showmenu(id)
{
    if( 
is_user_connected(id))
    {
        
Code Here
    
}


:arrow:

PHP Code:

public showmenu(id)
{
    if( 
is_user_alive(id))
    {
        
Code Here
    
}


If you want show to CT and TT different menus, you can use cs_get_user_team or get_user_team.

Edit:If you want to show them a menu after they select a team even if they're dead you can use cs_get_user_team or get_user_team also.

brlight 05-11-2014 17:28

Re: Show Menu Only after player choose team
 
Ok, one problem solved, many thanks!!

swapped 05-12-2014 03:51

Re: Show Menu Only after player choose team
 
another idea should be to check first spawn

brlight 05-12-2014 10:42

Re: Show Menu Only after player choose team
 
Thanks swapped but, how can i do that?

GinNNy 05-14-2014 15:11

Re: Show Menu Only after player choose team
 
You can use like this
PHP Code:

if(cs_get_user_team(idCS_TEAM_UNASSIGNED))
    {
        return
    }
    else
    {
        
Code
    



brlight 05-15-2014 18:11

Re: Show Menu Only after player choose team
 
Quote:

Originally Posted by GinNNy (Post 2137762)
You can use like this
PHP Code:

if(cs_get_user_team(idCS_TEAM_UNASSIGNED))
    {
        return
    }
    else
    {
        
Code
    



Thank you so much for helping me!
I think you did a little mistake in that should be:
PHP Code:

if(cs_get_user_team(id) == CS_TEAM_UNASSIGNED)
    {
        return
    }
    else
    {
        
code here
    



Backstabnoob 05-15-2014 18:26

Re: Show Menu Only after player choose team
 
If you want to show them the menu when they choose a team then just hook the TeamInfo event, the other replies don't make much sense

GinNNy 05-15-2014 20:03

Re: Show Menu Only after player choose team
 
Nope its should be cs_get_user_team(id) == blabla

Backstabnoob 05-15-2014 20:04

Re: Show Menu Only after player choose team
 
No, he should hook TeamInfo, stop posting if you don't know what you're talking about


All times are GMT -4. The time now is 09:38.

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