Raised This Month: $ Target: $400
 0% 

is_user_spectate


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 05-03-2012 , 13:23   Re: is_user_spectate
Reply With Quote #3

PHP Code:
// EITHER
#define is_user_spectator( %0 ) ( get_user_team( %0 ) == 3 )

// OR
boolis_user_spectatoriPlayer )
  return 
get_user_teamiPlayer ) == 3
Edit:

Or, if you want to know whether user is spectating someone:

PHP Code:
#define INVALID_PLAYER -1

get_user_spectating_targetiPlayer )
{
  static 
i;

  if( !
is_user_aliveiPlayer ) && is_user_connected( ( peviPlayerpev_iuser1 ) ) ) )
    return 
i;

  return 
INVALID_PLAYER;

Then, you can check:

PHP Code:
if( is_user_spectatoriClient ) && get_user_spectating_targetiClient ) != INVALID_PLAYER )
{
  
// His team is spectator and he is spectating a valid target
}

if( 
is_user_spectatoriClient ) )
{
  
// His team is spectator
}

if( 
get_user_spectating_targetiClient ) != INVALID_PLAYER )
{
  
// His team may be Red, Blue or Spectator and he is spectating a valid target

__________________

Last edited by claudiuhks; 05-04-2012 at 02:21.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
 



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 00:31.


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