View Single Post
KyleS
SourceMod Plugin Approver
Join Date: Jul 2009
Location: Segmentation Fault.
Old 11-26-2013 , 19:04   Re: [Tutorial] ClientPrefs
Reply With Quote #14

Quote:
Originally Posted by RedSword View Post
Because when the plugins load, it doesn't get the clients' cookie. What it does is check that the clients have their cookie loaded (but not in your plugin's memory) using OnClientCookiesCached ==> why even do this ?.

Try to simply run OnClientPutInServer() for every InGame client OnPluginStart() rather than L33-37.


Quote:
Originally Posted by Arkarr View Post
Here is it.
It looks like you've preserved the load code in OnClientPutInServer, which is horribly incorrect. It also looks like you only store the client data when they disconnect, which would reproduce the plugin reload bug. If you're worried about the overhead of updating your cookie data over and over again in your timer, you can use OnPluginEnd; but that's a thing.


EDIT: Unrelated to ClientPrefs, you should return Plugin_Stop in your Timer, otherwise you're leaking timers. Your plugin will eventually auto-unload after enough clients connect, from running out of Handles. You should also pass the flag TIMER_FLAG_NO_MAPCHANGE, as all of your timers should die then anyways.

Last edited by KyleS; 11-26-2013 at 19:07.
KyleS is offline