Raised This Month: $ Target: $400
 0% 

is_user_spectate


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
vamppa
Senior Member
Join Date: Apr 2010
Location: The Netherlands
Old 05-03-2012 , 13:17   is_user_spectate
Reply With Quote #1

is there a way to check when the user is spectate?


the purpose:
for example if it where to exist
PHP Code:
if(!is_user_spectate id ) ) 
vamppa is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-03-2012 , 13:18   Re: is_user_spectate
Reply With Quote #2

PHP Code:
cs_get_user_team(id) != CS_TEAM_SPECTATOR 
?
__________________
<VeCo> is offline
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
Bilal Pro
Senior Member
Join Date: Mar 2012
Location: Holland
Old 05-03-2012 , 13:48   Re: is_user_spectate
Reply With Quote #4

Quote:
Originally Posted by claudiuhks View Post
PHP Code:
// EITHER
#if !defined is_user_spectator
  #define is_user_spectator( %0 ) ( get_user_team( %0 ) == 3 )
#endif

// OR
boolis_user_spectatoriPlayer )
  return 
get_user_teamiPlayer ) == 3

i think 3 wont work, 0 = spectator?
__________________
  • Point System with rank titles for sale [X] [100% private]
  • VIP Menu for sale [X] [100% private]
  • HnS shop more features for sale [X] [100% private]
Contact: Bilalzaandam1234, on steam if you are interested.
Bilal Pro is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 05-03-2012 , 13:57   Re: is_user_spectate
Reply With Quote #5

Quote:
Originally Posted by Bilal Pro View Post
i think 3 wont work, 0 = spectator?
Think before posting.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
vamppa
Senior Member
Join Date: Apr 2010
Location: The Netherlands
Old 05-03-2012 , 13:21   Re: is_user_spectate
Reply With Quote #6

for a Non-counterstrike mod.
vamppa is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 05-03-2012 , 14:05   Re: is_user_spectate
Reply With Quote #7

0 = unassigned
1 = terrorist
2 = counter-terrorist
3 = spectator
__________________
You can do anything you set your mind to, man.

Devil259 is offline
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 05-03-2012 , 14:12   Re: is_user_spectate
Reply With Quote #8

I think he is asking about how to get wheter a player is spectating someone. If so: Check if player is dead AND if get_user_aiming returns a Player
__________________
Quote:
#define true ((rand() % 2)? true: false) //Happy debugging suckers
mottzi is offline
Send a message via MSN to mottzi
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 05-04-2012 , 02:19   Re: is_user_spectate
Reply With Quote #9

Quote:
Originally Posted by mottzi View Post
I think he is asking about how to get wheter a player is spectating someone. If so: Check if player is dead AND if get_user_aiming returns a Player
I came with an edit about this.
__________________
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-03-2012 , 15:12   Re: is_user_spectate
Reply With Quote #10

Code:
stock GetSpectatedPlayer(id) {     if( !is_user_alive(id)     && ((1 << pev(id, pev_iuser1)) & ((1 << 1)|(1 << 2)|(1 << 4))) )     {         new player = pev(id, pev_iuser2);         if( is_user_alive(player) )         {             return player;         }     }         return id; } stock bool:IsUserSpectatingPlayer(spectater, player) {     return (GetSpectatedPlayer(spectater) == player); } stock bool:IsUserSpectating(id) {     return (GetSpectatedPlayer(id) != id); }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 05-03-2012 at 15:58.
Exolent[jNr] is offline
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 00:31.


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