vasyyshakov / zombiereloaded

Automatically exported from code.google.com/p/zombiereloaded
0 stars 0 forks source link

Late load Cookies causing terrible glitches. #269

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

This is rather difficult to explain and to reproduce. ClientPrefs late loads 
for clients typically after OnClientPutInServer/OnClientPostAdminCheck/Whatever 
is called. They're not guaranteed to be loaded at this time, and in most cases, 
they're not. Later when it loads, attributes are set on the client regardless 
of what their class/team is.

Fix: This is very tricky to do without a hack (In most cases, I can't even see 
how this is failing). A semi easy solution would be to simply have a global 
bool storing if clients have loaded their cookies yet (With the amount of 
global bools ZR uses it might be better to use a single trie?). If they have, 
continue on. If they haven't, create a timer (Probably 3s) to periodically 
check. This has it's own draw backs, and is extremely hacky. With how cookies 
are implemented at the moment, this cannot be fixed without a complete rewrite.

What's the big issue?
This effects ZMarket (Weapons), Player Classes, Credit Storage, and the Class 
Overlay / ZHP display settings. This should be pretty high on the priority list 
as this has/contains the potential to destroy the mod. Personally, we are 
having Human/Zombie class settings mixing because of the late loading. Giving 
Zombies no knockback, and or increased jump/whatever else is contained in 
another class.

Original issue reported on code.google.com by kyle.l...@gmail.com on 10 Aug 2011 at 4:00

GoogleCodeExporter commented 8 years ago
Which version and branch does this apply to?

Cookies are loaded in OnClientCookiesCached and we use this event to load 
cookie-based data.

In the beta 2 release it looks like classes aren't loaded on players until 
cookies are loaded, but usually cookies are loaded pretty fast (before the 
player is spawning). During the time I managed a ZR server class cookies worked 
fine. Those issues I had were bugs in ZR, that I fixed.

The symptoms with no knock back or settings from another class when loading 
from cookies sounds like a very old bug that was fixed a long time ago. When 
loading classes from cookies it should revalidate the team in case class config 
has changed.

In the dev branch we've made a special event to fire when certain conditions 
are met (OnClientReady). For this event we actually store whether cookies are 
loaded, as you mentioned. The event fires when clients are connected, admin 
checked and cookies loaded (as far as I remember). We use this to preload a 
default class, and then replace it with the saved class once cookies are loaded.

What happens with ZMarket and other settings? ZMarket should at least work for 
buying weapons.

Original comment by richard.helgeby@gmail.com on 10 Aug 2011 at 5:29

GoogleCodeExporter commented 8 years ago
This is the exact same issue I am having currently.  I haven't always had this 
issue but it has been happening on my server regularly.  A fix or even some 
type of patch would be greatly appreciated.

Original comment by jljr...@gmail.com on 1 Mar 2012 at 3:20

GoogleCodeExporter commented 8 years ago
Adding links with more info about this for future reference:
http://forums.alliedmods.net/showthread.php?t=179465

Discussion of solutions:
http://forums.alliedmods.net/showthread.php?t=186433

The best solution so far is a "waiting for players"-round, but I'm not sure how 
it should work in detail.

Original comment by richard.helgeby@gmail.com on 4 Jun 2012 at 5:41