Player slots

Discuss programming in the QuakeC language.
Post Reply
Cobalt
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA
Contact:

Player slots

Post by Cobalt »

Noticed some strange stuff regarding player connections to a server in my mod. Not sure if its by default, but I think parm10 is coded to be -1 when a client first connects? Seems when a new player connects they fit into the team that the client who previously left the server / vacated spot is, and are not treated like its the first connection.

Are the player slots in effect like a standard dynamic entity? I notice in clientdisconnect() some floats are set to zero, so that leads me to believe the entities paramaters are not wiped on the player leaving the server. Any input appreciated.
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: Player slots

Post by Spike »

the parms will be set by either SetNewParms(called when a player first connects) or SetChangeParms (called at the end of the map).
parms must not be set anywhere else.
they may only be read after a call to setspawnparms, or in PutClientInServer (when it is called by the server. note that the qc also calls it, but only after a setspawnparms call), or after an explicit call to SetNewParms.

parm10 is not used in vanilla. If its got some value other than 0 then its because your mod set it to some value other than 0.

I only know of fte which persists stats between reconnects, and that's only if it has some ranking subsystem activated, which is not by default, and even then the mod must have set the parm to something in the past.
Cobalt
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA
Contact:

Re: Player slots

Post by Cobalt »

Ah yes, you are right. They set parm 10 to 1 if the start map is loaded in SetNew Parms()....else it is -1 otherwise. This later holds the value for self.team....(4 is red team, 14 is blue team) for changelevel / parms. There is also a self.lastteam float that comes into play....if a player switches teams. Start map will put you on a team automaticly on connect....other maps throw you into observer on first connect, play motd etc.
This process has always stumped me, but I am a step closer to understanding it now, thanks.
Spike wrote: parm10 is not used in vanilla. If its got some value other than 0 then its because your mod set it to some value other than 0.
Cobalt
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA
Contact:

Re: Player slots

Post by Cobalt »

Ok thought I had this resolved, and its better but now it seems to have happened again....and cant understand why.

What always happened was when you first connect, the system places you in observer, and displays motd...like I coded it to be. Now it will do this, but if you join the game and leave, then reconnect, it seems to be remembering all the .floats like the admin level, team, and weather or not motd was displayed etc, as if you were still that client that just disconnected. I thought setnewparms() is called by the engine when you connect new? I thought maybe its just a bug in that slot, but if I connect with another instance of dp-quake it appears all the slots are set to these
same parms when you connect. When you restart the engine new, it will work normally as far as I can tell - strange.


UPDATE:

I fixed the trouble by adding a new assignment to a parm in the SetNewParms () area. I guess when you change one thing, it effects other things.
Understanding SetNewParms, SetChangeParms and DecodeLevelParms , have been more trouble for me than I first thought.
Post Reply