Raised This Month: $ Target: $400
 0% 

How to chek if player is connected and is in CT or T team?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 08-12-2011 , 23:01   How to chek if player is connected and is in CT or T team?
Reply With Quote #1

How to chek if player is connected and is in CT or T team?

PHP Code:
public CheckClientConnectedTeam(Client,Client2)
{
    if(
is_user_connected(Client) && get_user_team(Client) == CS_TEAM_T && is_user_connected(Client2) && get_user_team(Client2) == CS_TEAM_CT)
    {
        
/*DO SOMETHING*/
        
client_print(0,3,"OK, ALL CLIENTS IS NOW CONNECTED, CONTINUE");
        return 
PLUGIN_HANDLED;
    }
    else
    {
        
/*DO SOMETHING ELSE*/
        
client_print(0,3,"LOL, WAIT FOR CLIENT CONNECT");
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_HANDLED;

HTML Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

Warning: Tag mismatch on line 22
Warning: Tag mismatch on line 22
Header size:            244 bytes
Code size:              680 bytes
Data size:              252 bytes
Stack/heap size:      16384 bytes; estimated max. usage=780 cells (3120 bytes)
Total requirements:   17560 bytes

2 Warnings.
Done.
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
sader
Junior Member
Join Date: Aug 2011
Old 08-12-2011 , 23:09   Re: How to chek if player is connected and is in CT or T team?
Reply With Quote #2

Try this way
PHP Code:
#include <cstrike> 
 
public client_spawn(this)
{  
  if(
cs_get_user_team(this) == CS_TEAM_CT)
  {
 
  }
  else
  {
 
 
  }
 
  return 
PLUGIN_HANDLED;

sader is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 08-12-2011 , 23:15   Re: How to chek if player is connected and is in CT or T team?
Reply With Quote #3

Ops, i edited my funcion, small fail:

is not get_user_team

is cs_get_user_team

PHP Code:
public CheckClientConnectedTeam(Client,Client2)
{
    if((
is_user_connected(Client) && cs_get_user_team(Client) == CS_TEAM_T) && (is_user_connected(Client2) && cs_get_user_team(Client2) == CS_TEAM_CT))
    {
        
client_print(0,3,"OK, ALL CLIENTS IS NOW CONNECTED");
        return 
PLUGIN_HANDLED;
    }
    else
    {
        
/*DO SOMETHING ELSE*/
        
client_print(0,3,"LOL, WAIT FOR CLIENT CONNECT");
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_HANDLED;

Not errors, but is correct way?
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 

Last edited by ^SmileY; 08-12-2011 at 23:18. Reason: :P
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-12-2011 , 23:22   Re: How to chek if player is connected and is in CT or T team?
Reply With Quote #4

Yes.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
sader
Junior Member
Join Date: Aug 2011
Old 08-12-2011 , 23:23   Re: How to chek if player is connected and is in CT or T team?
Reply With Quote #5

Well you asked how to check if player is connected and on what team he is.
Yes from your code prototype I see you compare two players, but what exactly you trying to achieve?
sader is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 08-12-2011 , 23:25   Re: How to chek if player is connected and is in CT or T team?
Reply With Quote #6

I try to check if 2 players is connected, and player A is in TR or CT team, and player B is in TR or CT team.

PHP Code:
public CheckCaptainJoin(NextCaptainMenu)
{
    if((
is_user_connected(RandomPlayer1) && (cs_get_user_team(RandomPlayer1) == CS_TEAM_T || cs_get_user_team(RandomPlayer1) == CS_TEAM_CT)) && (is_user_connected(RandomPlayer2) && (cs_get_user_team(RandomPlayer2) == CS_TEAM_T || cs_get_user_team(RandomPlayer2) == CS_TEAM_CT)))
    {
        
set_task(2.0,"captain_menu",NextCaptainMenu)
    }
    else
    {
        
set_task(5.0,"CheckCaptainJoin",NextCaptainMenu)
    }

__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-12-2011 , 23:29   Re: How to chek if player is connected and is in CT or T team?
Reply With Quote #7

Opposite teams?
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 08-12-2011 , 23:31   Re: How to chek if player is connected and is in CT or T team?
Reply With Quote #8

Its capitains in team

But, capitain 1 or 2 its connected to server
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 

Last edited by ^SmileY; 08-12-2011 at 23:31. Reason: ops
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
sader
Junior Member
Join Date: Aug 2011
Old 08-12-2011 , 23:34   Re: How to chek if player is connected and is in CT or T team?
Reply With Quote #9

But you must strore players ID somewhere,somehow.
You can loop through players and do some checks

PHP Code:
for(new i=1i<=32i++)
{
  if(
is_user_alive(i))
  {
  }


Maybe you need somthing like this? How you know if player is Captain?
PHP Code:
new CT_captain_foundT_captain_found;
for(new 
i=1i<=32i++)
{
  if(
is_user_alive(i))
  {
    if(
CT_captain_found == && cs_get_user_team(i) == CS_TEAM_CT && is captain)
    {
      
//somethings goes here
      
CT_captain_found 1
    }
    
    if(
T_captain_found == && cs_get_user_team(i) == CS_TEAM_T && is captain)
    {
      
//somethings goes here
      
T_captain_found 1
    }
  }


Last edited by sader; 08-12-2011 at 23:41.
sader is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 08-13-2011 , 00:03   Re: How to chek if player is connected and is in CT or T team?
Reply With Quote #10

Solved/
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Reply


Thread Tools
Display Modes

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 03:24.


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