Checking which player spectating player is spectating.

Discuss all aspects related to modding Zandronum here.
User avatar
ZZYZX
Posts a lot
Posts: 742
Joined: Thu Jun 07, 2012 5:56 pm
Location: Ukraine
Clan: A3
Clan Tag: [A3]

Re: Checking which player spectating player is spectating.

#21

Post by ZZYZX » Mon Jul 18, 2016 4:36 pm

You can query spectator's nickname serverside. You can query spectator's GetUserCVar serverside. With additional scripting you can even have their position dynamically updated on the server so you can interact with things while being a spectator. (to a limited extent of course).
They are players. This is important. Randcaps work because of this. Don't say "spectators aren't players". Things such as this are important to distinguish for advanced ACS. Blurry humanitarian terminology isn't applicable in programming, it only causes confusion.
This is what ZzZombo was trying to say. Not "look at me I know the engine better".

User avatar
SwordGrunt
Forum Regular
Posts: 377
Joined: Thu Jun 07, 2012 8:43 pm

Re: Checking which player spectating player is spectating.

#22

Post by SwordGrunt » Mon Jul 18, 2016 6:15 pm

ZZYZX wrote:You can query spectator's nickname serverside. You can query spectator's GetUserCVar serverside. With additional scripting you can even have their position dynamically updated on the server so you can interact with things while being a spectator. (to a limited extent of course).
They are players. This is important. Randcaps work because of this. Don't say "spectators aren't players". Things such as this are important to distinguish for advanced ACS. Blurry humanitarian terminology isn't applicable in programming, it only causes confusion.
This is what ZzZombo was trying to say. Not "look at me I know the engine better".
They're obviously players and have their own variables since they are running zandronum.exe and joined a server. Does that change the fact they can't interact with the physical game world? They aren't a doomguy in-game, they're an invisible camera that can do nothing but fly around, even if they're a doomguy with a spectator flag in the source code. By coding spectator position updating on the server you are literally going against the entire concept of a spectator in Skulltag/Zandronum that is to cause as little network traffic as possible.

I think everything was made pretty damn clear to people who could be interested in knowing so there's no point in dragging this out any further.

User avatar
ibm5155
Addicted to Zandronum
Posts: 1641
Joined: Tue Jun 05, 2012 9:32 pm
Location: Somewhere, over the rainbow

Re: Checking which player spectating player is spectating.

#23

Post by ibm5155 » Mon Jul 18, 2016 7:13 pm

Code: Select all

script 10 enter{// show who's spectating you
    int mypos;
    int otherpos;
    int i=0;
    int x,y,z;
    while(true){
        x = GetActorX(1000+playernumber());
        y = GetActorY(1000+playernumber());
        z = +GetActorZ(1000+playernumber());
        for(i=0;i<64;i++){
            if(i!=playernumber()){
                if(abs(abs(x) -abs(PX[i])) <= 10.0){
                    if(abs(abs(y)-abs(PY[i])) <= 10.0){
                        if(abs(abs(z)-abs(PZ[i])) <= 10.0){
                            acs_executealways(11,0,i,i);
                        }
                    }
                }
            }
        }
        delay(1);
    }
}


script 11 (int name,int i) clientside{
    if(activatortid()-1000!=consoleplayernumber())
        terminate;
    hudMessage(n:i,s:" is spectating you";HUDMSG_PLAIN,0,CR_WhiTE,0.5,0.5+(i*0.01),1.0);
}
each spectator shold have his position stored over the PX,PY and PZ array, I don't think there's a way for doing that without using my modified zandronum bin.

Here's the code that I used to get the player's câmera pos

Code: Select all

script 7 open clientside{//Update Spectators position to the server
    int ox,oy,oz;
    int x,y,z;
    ox = GetCameraX();
    oy = GetCameraY();
    oz = GetCameraZ();
    x = ox;
    y = oy;
    z = oz;
    while(true){
        x = GetCameraX();
        y = GetCameraY();
        z = GetCameraZ();
        if(x != ox || y != oy || z != oz){ // don't update the server if the position doesn't have changed
            ox = x;
            oy = y;
            oz = z;
            RequestScriptPuke(8,consoleplayeRnumber(),x,y);
            RequestScriptPuke(88,consoleplayeRnumber(),z,GetCameraAngle());
            RequestScriptPuke(89,consoleplayeRnumber(),GetCameraPitch(),0);
        }
        delay(1);
    }
}

script 8 (int activator,int x,int y) NET{// receive spectators position
   // printbold(s:"activator 8:",d:activator, s:" X:",f:x,s:" y:",f:y);
    PX[activator] = x;
    PY[activator] = y;
}

script 88 (int activator,int z,int angle) NET{// receive spectators position
   // printbold(s:"activator 88:",d:activator,s:" Z:", f:z);
    PZ[activator] = z;
    PAngle[activator] = angle;
}
with that you could know witch players or spectors are coop spying you
Projects
Cursed Maze: DONE, V2.0
Zombie Horde - ZM09 map update: [3/15/13]
Need help with English? Then you've come to the right place!

<this post is proof of "Decline">

ZzZombo
Forum Regular
Posts: 323
Joined: Mon Jun 11, 2012 12:11 pm
Location: Ravenholm

Re: Checking which player spectating player is spectating.

#24

Post by ZzZombo » Tue Jul 19, 2016 1:34 pm

I can create actors that also can't react with the game world. Hell, puffs, particle fountains, map spots and trails already don't. Does it make them non-actors?
QZRcon - Qt-based tool for Zandronum/Skulltag servers!
#grandvoid funny stats

User avatar
Ænima
Addicted to Zandronum
Posts: 3523
Joined: Tue Jun 05, 2012 6:12 pm

Re: Checking which player spectating player is spectating.

#25

Post by Ænima » Tue Jul 19, 2016 2:00 pm

r u guys still splitting hairs over this
­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­
Doom64: Unabsolved: New weapons, monsters, and gameplay features for coop !


ZandroSkins
: a pack made by our community

User avatar
SwordGrunt
Forum Regular
Posts: 377
Joined: Thu Jun 07, 2012 8:43 pm

Re: Checking which player spectating player is spectating.

#26

Post by SwordGrunt » Tue Jul 19, 2016 3:37 pm

Ænima wrote:r u guys still splitting hairs over this
It's just a typical 13 year old that wants to have the last word at all costs, I already let him have it so hopefully no more time will be wasted here

User avatar
Ænima
Addicted to Zandronum
Posts: 3523
Joined: Tue Jun 05, 2012 6:12 pm

Re: Checking which player spectating player is spectating.

#27

Post by Ænima » Tue Jul 19, 2016 4:47 pm

SwordGrunt wrote:
Ænima wrote:r u guys still splitting hairs over this
It's just a typical 13 year old that wants to have the last word at all costs, I already let him have it so hopefully no more time will be wasted here
he was right though ...
­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­
Doom64: Unabsolved: New weapons, monsters, and gameplay features for coop !


ZandroSkins
: a pack made by our community

User avatar
SwordGrunt
Forum Regular
Posts: 377
Joined: Thu Jun 07, 2012 8:43 pm

Re: Checking which player spectating player is spectating.

#28

Post by SwordGrunt » Tue Jul 19, 2016 4:54 pm

Ænima wrote:
SwordGrunt wrote:
Ænima wrote:r u guys still splitting hairs over this
It's just a typical 13 year old that wants to have the last word at all costs, I already let him have it so hopefully no more time will be wasted here
he was right though ...
Yeah usually when you ignore everything someone says except the part you wish to correct, you end up being "right"

User avatar
Ænima
Addicted to Zandronum
Posts: 3523
Joined: Tue Jun 05, 2012 6:12 pm

Re: Checking which player spectating player is spectating.

#29

Post by Ænima » Tue Jul 19, 2016 5:56 pm

SwordGrunt wrote:
Ænima wrote:
SwordGrunt wrote:
Ænima wrote:r u guys still splitting hairs over this
It's just a typical 13 year old that wants to have the last word at all costs, I already let him have it so hopefully no more time will be wasted here
he was right though ...
Yeah usually when you ignore everything someone says except the part you wish to correct, you end up being "right"
I re-read both yours and his first posts in this thread and I can't find anything fundamentally "wrong" about what he said.
SwordGrunt wrote:
ZzZombo wrote:
as spectators aren't technically players.
as spectators aren't technically players.
as spectators aren't technically players.
technically
uw0tm8?
Technically, spectators do not have a physical game world actor like players do. So that is entirely correct, as spectators are potential players in the server but not for the game engine.
Spectators do have a physical actor ... It exists in the level whether it's significant or not.

It seems like you guys are just disagreeing for the sake of disagreeing. I'm not sure what kind of "technicality" totally negates the existence of a spectator's body. It either exists or it doesn't.
­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­
Doom64: Unabsolved: New weapons, monsters, and gameplay features for coop !


ZandroSkins
: a pack made by our community

User avatar
Ru5tK1ng
Frequent Poster Miles card holder
Posts: 794
Joined: Fri Jun 01, 2012 9:04 pm

Re: Checking which player spectating player is spectating.

#30

Post by Ru5tK1ng » Tue Jul 19, 2016 6:07 pm

My favorite part is this is still going on even though the author already got his question answered. :smile:

User avatar
SwordGrunt
Forum Regular
Posts: 377
Joined: Thu Jun 07, 2012 8:43 pm

Re: Checking which player spectating player is spectating.

#31

Post by SwordGrunt » Tue Jul 19, 2016 6:52 pm

Ru5tK1ng wrote:My favorite part is this is still going on even though the author already got his question answered. :smile:
Same, I actually find it hard to believe none of this was split yet

But now that I mentioned it, this very post is probably gonna bite the dust soon

Post Reply