Raised This Month: $ Target: $400
 0% 

Detect Spectator


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Plain
Member
Join Date: Oct 2007
Location: CA
Old 03-27-2008 , 16:07   Detect Spectator
Reply With Quote #1

How do I detect if the user is in spectator mode? I am trying to give the user a c4.

Code:
case 5: if( get_pcvar_num(trinity_use) == 1 && g_Spec[id] == 0 ){
        give_item(id, "weapon_c4");
        }
Example would be helpful.
Plain is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-27-2008 , 16:12   Re: Detect Spectator
Reply With Quote #2

EDIT: sry, you meant mode, not team.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 03-27-2008 , 16:12   Re: Detect Spectator
Reply With Quote #3

PHP Code:
if (cs_get_user_team(id) == CS_SPECTATOR)
   
//User is in Spec
else
   
//User is not in Spec 

Also, I said SCRIPTING HELP, not Suggestions/Requests Next time, post in the proper place...


Just check if they are dead for Spec Mode
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Plain
Member
Join Date: Oct 2007
Location: CA
Old 03-27-2008 , 16:15   Re: Detect Spectator
Reply With Quote #4

Thanks YamiKaitou.

+Karma
Plain is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-27-2008 , 16:23   Re: Detect Spectator
Reply With Quote #5

i thought he was asking if player was spectating someone
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
alien
Senior Member
Join Date: Aug 2005
Location: London || Slovakia
Old 03-27-2008 , 22:20   Re: Detect Spectator
Reply With Quote #6

But how to literally detect this physically?
Spectator doesn't have to be dead or in spectator team.

Movetype and entity flags are useless.
__________________
alien is offline
Send a message via ICQ to alien
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-28-2008 , 04:38   Re: Detect Spectator
Reply With Quote #7

The proper way of using cs_get_user_team is as follows:

Code:
new CsTeams:team = cs_get_user_team(id);
'team' will hold the team #.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 04-03-2008 , 13:45   Re: Detect Spectator
Reply With Quote #8

PHP Code:
if (is_user_connected(id) && !is_user_alive(id)) {
        
// 1 - Locked Chase Cam, 2 - Free Chase Cam, 3 - Free Look, 4 - First Person, 5 - Free Overview, 6 - Chase Overview
        
new mode pev(idpev_iuser1)
        if (!
mode) {
                
// unassigned player - isn't "free" observer - tied to trigger_camera observe points
        
}
        else if (
mode == 3) {
                
// actual SPE/T/CT observer in free look mode
                // you can go further and do a team check
        
}
        else {
                new 
id2 pev(idpev_iuser2)
                
// observes another player with ID == id2
        
}

VEN is offline
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 04:48.


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