GSC reference › Built-in
IsSpectating()
Built-in (engine)
Client
Returns 1 if the local client is spectating
Signature
IsSpectating(<localClientNum>, [checkFistPerson])
Parameters
| Name | Required? | Details |
|---|---|---|
| localClientNum | Required | Number of the local client to check |
| checkFistPerson | Optional | Check if we want first person spectating to be not considered as spectate |
Example (from Treyarch's docs)
if ( IsSpectating( localClientNum, false ) )
Real uses in BO3's scripts
Called 59 times in the decompiled scripts. A few, zombies first:
- scripts/zm/_zm.csc, line 870
if(!self islocalplayer() || isspectating(localclientnum, 1) || localclientnum != self getlocalclientnumber()) - scripts/zm/_zm_ai_raps.csc, line 84
if(isspectating(n_local_client)) - scripts/zm/_zm_ai_sentinel_drone.csc, line 193
if(isspectating(n_local_client)) - scripts/zm/_zm_ai_spiders.csc, line 114
if(isspectating(n_local_client)) - scripts/zm/_zm_ai_wasp.csc, line 91
if(isspectating(n_local_client))
New to GSC?
Start with the basics, or paste a compile error to get the fix.
Built-in descriptions, parameters and examples come from Treyarch's BO3 mod tools docs. Usage links point at shiversoftdev/t7-source (decompiled BO3 scripts).