Gsc Scripting - hudelement while spectating

  • hi,


    i'd like to find out how i can display a hud element while being in spectator mode. i wan't to display some player stats like k/d etc. of the spectated player.


    since your codjumper mode can do something very similiar by displaying fps and pressed keys of a spectated player i thought somebody will be able to help me here :)


    below is what i tried. where self is the player being in specatator mode. sadly this doesn't work at all .. it seems that only hudelements assigned to the spectated player are displayed, not hud elements owned by the spectating player.



    so i tried to create the hudelem like this:


    Code
    1. spectatedplayer = self getspectatorclient();
    2. self.spectatordisplay = NewClientHudElem(spectatedplayer);


    that does work as expected, but displays the hudelement for the spectated player and for the spectating player of course .. how can i display a hudelement only to the spectating player?

  • solved, this worked



    dont rly know why that one works tho

  • i'd like to find out how i can display a hud element while being in spectator mode. i wan't to display some player stats like k/d etc. of the spectated player.


    There are 2 ways to implement this.
    The first one is that the client and the spectator see the same K/D Ratio Hud Element. This works if you set the hudelement.archived = 1 Flag. I'm not sure, but afaik the CoDx Server Files have an other default value then the stock server files.


    The second one is to spawn the hud element only for the spectator and update it with the infos of the client. The trick here is to get the client entity.