AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   cs_get_user_team , case 1 , 2 & 3?? (https://forums.alliedmods.net/showthread.php?t=159805)

Stressful 06-21-2011 21:30

cs_get_user_team , case 1 , 2 & 3??
 
Hello , Previously I saw a thread regarding to this , But I tried finding it back but cant find it . What I meant by cs_get_user_team , case 1 , 2 & 3?? is that , Example , set_user_team for CT then case 1 : What will happen to CT and stuff.
set_user_team for T then case 2 : What will happen to T and stuff , Same for spec.

fysiks 06-21-2011 21:44

Re: set_user_team , case 1 , 2 & 3??
 
What are you actually trying to do? [cs_]get_user_team() is more often used with a switch.

Stressful 06-21-2011 21:45

Re: set_user_team , case 1 , 2 & 3??
 
Lol. HUD Msg . Ok my mistake. edited.

fysiks 06-21-2011 21:54

Re: cs_get_user_team , case 1 , 2 & 3??
 
PHP Code:

switch( cs_get_user_teamid ) )
{
    case 
CS_TEAM_CT:
    {
        
// player is on CT
    
}
    case 
CS_TEAM_T:
    {
        
// Player is on Terrorist Team
    
}
    case 
CS_TEAM_SPEC:
    {
        
// Player is in specator
    
}



Stressful 06-21-2011 22:23

Re: cs_get_user_team , case 1 , 2 & 3??
 
ok Thanks , Anyway how do you make it like if the user connect , the team is T , then the msg will appear?

fysiks 06-21-2011 22:49

Re: cs_get_user_team , case 1 , 2 & 3??
 
It depends on what your goal is. Easiest would be to hook spawn and do it then, IMO.

Stressful 06-21-2011 23:17

Re: cs_get_user_team , case 1 , 2 & 3??
 
Hmm .. Ok Thanks :D

Hunter-Digital 06-22-2011 04:23

Re: cs_get_user_team , case 1 , 2 & 3??
 
Quote:

Originally Posted by Stressful (Post 1493207)
ok Thanks , Anyway how do you make it like if the user connect , the team is T , then the msg will appear?

When user connects he has no team, you need to hook spawn or teaminfo and set a variable for that player indicating that's the first thime he spawned/joined team.

You already have a spawn example, I'll show you a join team example:

Code:

#include <amxmodx>

new bool:g_bJoined[33]

public plugin_init()
{
    register_event("TeamInfo", "player_joinTeam", "a")
}

public client_disconnect(id)
{
    g_bJoined[id] = false
}

public player_joinTeam()
{
    new id = read_data(1)

    new szTeam[2]

    read_data(2, szTeam, charsmax(szTeam))

    /* this triggers when player joins the game aswell, having team UNASSIGNED... OR if player already joined once, skip. */

    if(szTeam[0] == 'U' || g_bJoined[id])
        return

    g_bJoined[id] = true

    switch(szTeam[0])
    {
        case 'T':
        {
            client_print(id, print_chat, "Welcome to this server, terrorist !")
        }

        case 'C':
        {
            client_print(id, print_chat, "Welcome to this server, counter-terrorist !")
        }

        case 'S':
        {
            client_print(id, print_chat, "Welcome to this server, spectator !")
        }
    }
}


Stressful 06-22-2011 08:50

Re: cs_get_user_team , case 1 , 2 & 3??
 
Thanks , I did this , But ,
PHP Code:

    switch(szTeam[0])
    {
        case 
'T':
        {
           
set_hudmessage(02550, -1.0, -1.0)
           
show_hudmessage(id" Test ")
           
        }

        case 
'C':
        {
           
set_hudmessage(25500, -1.00.01)
           
show_hudmessage(id" Test 13231")
           
        }

        case 
'S':
        {
            
client_print(idprint_chat"Welcome to this server, spectator !")
        }
    }


But The hud message appear when I choosen a team . But disappear after I've joined the game . I wan the hud msg to be visible still when the player joined the game and playing for like about 20 sec perhaps . How do I do that?

drekes 06-22-2011 08:58

Re: cs_get_user_team , case 1 , 2 & 3??
 
Quote:

Originally Posted by Dolph_Ziggler (Post 1493429)
you must check if team is UNNASIGNED !!!

If he doesn't want to do anything with unassigned players, he doesn't have to add that. Learn before trying to help other people.


All times are GMT -4. The time now is 23:30.

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