A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

pointerstat explanation (and case study)

STATS are variables sent to CSQC by the server. As a player, they usually contain information about you, your health, ammo, armour, etc, so they can be displayed in your HUD. What if you want your CSQC to get information about *other* players, so you can (eg) display *their* health, or some other .variable your client wouldn’t normally have access to?


const int STAT_FOO_0 = 50;

// near the top of  worldspawn

for (int i = 0; i < 32; i++)
pointerstat(STAT_TFSTATE_0+i, EV_INTEGER, &edict_num(i + 1).foo);

When the map starts, before anything else happens (top of worldspawn) pointerstat creates 32 stats (STAT 50 – STAT 82) which are pointers to the .foo(integers) used by the entities (1 – 32) (which are players).
Player 1’s .foo =  STAT 50
Player 2’s .foo = STAT 51
Player 32’s .foo = STAT 82

STATS are sent by the server to each client, and normally contain information about themselves (their own localplayer). These STATS however, contain information about other players. IIUC the above code ‘tells’ CSQC to set aside 32 integer slots for STATs (?). Or possibly not.


const int STAT_TFSTATE_0 = 50;
.foois a local CSQC variable no relation to its ssqc namesake.


//self is a player, here via deltalisten
// self.entnum is this entity’s actual number on the ssqc server = getstati(STAT_FOO_0 + self.entnum-1);

this fills the variable with the value of the STAT which is ‘the ent number (1-32)’


Scenario 1: ssqc entity 70 (not a client) uses ‘the mdl which runs deltalisten’
70-1 is 69. CSQC will access STAT 69, what *should* have been player/entity 19’s foo. it will either get wrong/irrelevant data, or if there is no player 19, it will get 0

Scenario 2: ssqc entity 200 (not a client) uses ‘the mdl which runs deltalisten’
200-1 is 199. CSQC will access STAT 199, and there IS NO STAT 199!! Hence:

Leave a Reply




You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.