Jump to content

Home

Session Data in Siege?


SecretChord

Recommended Posts

I've been making a small modification for siege, and I've been using client->sess.somename to store data, like whether someone is logged in to admin for example. This data seems to clear when the sides switch (it doesn't even wait for a map change). Should I be storing data this somewhere else if I want it to stay until the client disconnects?

Link to comment
Share on other sites

You need to write and read the session data from the cvars its stored in. It's already done for the existing session data, and you can just add your own data to the end of the strings. You'll find all of this in g_session.c.

 

And another thing you might want to know (though if you're making a siege mod I don't you will need to know), the session data isn't carried over if the gametype changes.

Link to comment
Share on other sites

Thanks for the help. Got it working now, but just wanted to know.. for qboolean do I just use %i (which is what it looks like they did) or would that be incorrect. That makes sense if qboolean is actually stored as 0 or 1.

 

Also, how can you get a players IP? I would use the status rcon command but that doesn't seem to be sitting with the other rcon commands..

Link to comment
Share on other sites

Thanks for the help. Got it working now, but just wanted to know.. for qboolean do I just use %i (which is what it looks like they did) or would that be incorrect. That makes sense if qboolean is actually stored as 0 or 1.

Yep, %i would work for that.

 

Also, how can you get a players IP? I would use the status rcon command but that doesn't seem to be sitting with the other rcon commands..

The status cmd is part of the server program, and not in the source code. But to get the player's IP, if you look at ClientConnect() in g_client.c, it does something like...

s = Info_ValueForKey (userinfo, "ip");

You'll have to fiddle about with that...

Link to comment
Share on other sites

You can only access that on firstTime of ClientConnect however due to a bug in the userinfo setting code. so you would want to set it as a char array in clientSession. however session is cleared on gametype change, and if you're not careful, you will end up setting it to nothing so there are some specific ways of doing it without messing up, it just takes a little more coding than adding something normal to the session and getting it to actually stay.

Link to comment
Share on other sites

Yeah.. I managed to get it to stick until the attacking team one the round but then as soon as the teams switch I lost the IP.. Thanks for explaining why I wasn't able to retrieve it outside of ClientConnect.

 

The thing is I put it in to a char class session data, and I did the same thing with adding it to g_session.c as I did with my other variables (except used %s instead of %i) but for some reason the IP won't stick while the others do..

 

[EDIT]

Just another quick question, does anyone know where on the player ps.origin points to. It seems to be the around the right knee or something, I would have thought a smarter place would be dead centre of the body or the centre of the head.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...