Raised This Month: $51 Target: $400
 12% 

cs_get_user_team , case 1 , 2 & 3??


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Stressful
Senior Member
Join Date: Feb 2011
Old 06-21-2011 , 21:30   cs_get_user_team , case 1 , 2 & 3??
Reply With Quote #1

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.

Last edited by Stressful; 06-21-2011 at 21:45. Reason: edit
Stressful is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-21-2011 , 21:44   Re: set_user_team , case 1 , 2 & 3??
Reply With Quote #2

What are you actually trying to do? [cs_]get_user_team() is more often used with a switch.
__________________

Last edited by fysiks; 06-21-2011 at 21:51.
fysiks is offline
Stressful
Senior Member
Join Date: Feb 2011
Old 06-21-2011 , 21:45   Re: set_user_team , case 1 , 2 & 3??
Reply With Quote #3

Lol. HUD Msg . Ok my mistake. edited.
Stressful is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-21-2011 , 21:54   Re: cs_get_user_team , case 1 , 2 & 3??
Reply With Quote #4

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
    
}

__________________
fysiks is offline
Stressful
Senior Member
Join Date: Feb 2011
Old 06-21-2011 , 22:23   Re: cs_get_user_team , case 1 , 2 & 3??
Reply With Quote #5

ok Thanks , Anyway how do you make it like if the user connect , the team is T , then the msg will appear?
Stressful is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-21-2011 , 22:49   Re: cs_get_user_team , case 1 , 2 & 3??
Reply With Quote #6

It depends on what your goal is. Easiest would be to hook spawn and do it then, IMO.
__________________
fysiks is offline
Stressful
Senior Member
Join Date: Feb 2011
Old 06-21-2011 , 23:17   Re: cs_get_user_team , case 1 , 2 & 3??
Reply With Quote #7

Hmm .. Ok Thanks
Stressful is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 06-22-2011 , 04:23   Re: cs_get_user_team , case 1 , 2 & 3??
Reply With Quote #8

Quote:
Originally Posted by Stressful View Post
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 !")
        }
    }
}
__________________

Last edited by Hunter-Digital; 06-22-2011 at 04:34. Reason: fixed something in code xD
Hunter-Digital is offline
Old 06-22-2011, 08:24
Dolph_Ziggler
This message has been deleted by Dolph_Ziggler.
Stressful
Senior Member
Join Date: Feb 2011
Old 06-22-2011 , 08:50   Re: cs_get_user_team , case 1 , 2 & 3??
Reply With Quote #9

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?
Stressful is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 06-22-2011 , 08:58   Re: cs_get_user_team , case 1 , 2 & 3??
Reply With Quote #10

Quote:
Originally Posted by Dolph_Ziggler View Post
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.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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