AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   A cookie system (https://forums.alliedmods.net/showthread.php?t=55051)

sslice 05-12-2007 10:33

A cookie system
 
I was planning on writing an extension that would implement a 'cookie' system for SourceMod which would allow per-player (and per-plugin, where plugins can't access other plugins' cookies) long-term storage of basic data. But, I would like to know if scripters think if this would be useful or not... here's my current idea for implementation: http://www.ampaste.net/10980

Supports use of all the basic types (string, number (integer), float, and bool) while giving each cookie a lifetime, or expiration.

Anyways, just wanted to see if this kind of thing would be worth making. Suggestions are always welcome.

FlyingMongoose 05-12-2007 10:42

Re: A cookie system
 
I don't see why not, like I said and bail said, I currently use keyvalues because it's the best, and as far as I know, only long term data storage system in sourcemod. An alternative would be great.

L. Duke 05-12-2007 13:35

Re: A cookie system
 
I like the "autocleanup" based on the expiration.

:)

BAILOPAN 05-12-2007 14:26

Re: A cookie system
 
AMX Mod X had a system like this for HL1 called "nVault" -- it was a bit more generic. You could create a vault where you could store arbitrary key/value pairs, and each pair was timestamped so you could expire them.

The only problem was that it was flat; your idea has different key/val pairs for each player, which is an interesting thought.

Note that if you just wanted to play around with the API, you could use KeyValues internally. Once sqlite support comes around, it may be easiest to move to that, unless you have something more efficient in mind.

sskillz 05-12-2007 15:30

Re: A cookie system
 
If their isn't any vault yet why not :|
And can I have a link explaning "keyvalues" ?

teame06 05-12-2007 17:07

Re: A cookie system
 
http://wiki.alliedmods.net/KeyValues...d_Scripting%29

sslice 05-12-2007 23:38

Re: A cookie system
 
I planned on doing all of the storage manually (taking advantage of hash lookups, sorting based on usage, etc.) and storing to file on every level transition... I noticed nVault had a journaling system which is nice. The cookies system would probably have to have something similar.

Steam ID and IP lookup will be very fast since both are easy to make 32-bit keys out of (reversible, too).

Edit: One thing that I am not sure about is how the value of the cookie should be stored internally...should it always be stored as a string? Or, should it depend on what it was last set as, and make its type dynamic--similar to how KeyValues works I believe, with a union and whatnot.

BAILOPAN 05-13-2007 02:03

Re: A cookie system
 
Always a string is probably best, like a cvar, it's easier to go back and forth between types.

API 05-13-2007 12:34

Re: A cookie system
 
I would assume that a good syntax would be:
InitCookieSystem(maxplayers,TYPE_INT);

sskillz 05-13-2007 16:32

Re: A cookie system
 
Quote:

Originally Posted by teame06 (Post 475959)

Thanks, just as a ini file just with sub sections (Maybe more as a hash of hashes).


All times are GMT -4. The time now is 09:51.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.