Raised This Month: $ Target: $400
 0% 

Storing some info...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JFeldon
Member
Join Date: Feb 2007
Location: United Kingdom
Old 11-30-2007 , 18:03   Storing some info...
Reply With Quote #1

Yo,

Ok I'm not too sure how to do this. I'm creating a plugin for The Specialists Role Play and I'm creating a 'passport'. So this item would store the users name, date of birth and a few other things. (Bear with me here since this is my first proper plugin project and I may get the wording wrong or something)

How can I store this information to the passport? I could use SQL I guess but that would be harder, wasteful and require the owner to do more work setting it up. I wanna try and keep it as simple and streamlined as possible So, e.g.

Bob has this passport item. His name is Bob Bobbson and his date of birth is 1st March 1990. When Bob receives the item, he will register his information with something like /pportreg "Bob Bobbson" "1st March 1990" and the plugin will get that and go store it somewhere. It will use his SteamID to identify him. So if I use SQL, it will create two more columns to store his DOB and name in. (I think)

So should I store this in a file on the server or in the SQL database along with the rest of the settings? I don't think they're are any other ways (Correct me if I'm wrong) I gotta remember though that obviously almost every user of the server will use a passport.

Thanks for any help
-JFeldon
JFeldon is offline
Send a message via MSN to JFeldon
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 11-30-2007 , 18:32   Re: Storing some info...
Reply With Quote #2

Look at some logging and stats plugins, that should give you a headstart.
__________________
M249-M4A1 is offline
alien
Senior Member
Join Date: Aug 2005
Location: London || Slovakia
Old 11-30-2007 , 19:33   Re: Storing some info...
Reply With Quote #3

You can use vault or binary vault to store data. SQL is an elegant solution (especially with SQLx module), but makes server dependent on external source.

I would create my own vault using fread_raw, fwrite_raw. It would consist of 2 files: 1st one with all steam id recods and indices. This one would be sorted every time you add record - like an index file. Second file would store all other information.

If I'd like to look up a record, I'll search by steam id. I would use binary search to make things fast - get the index of specific steam id from the first file, seek the position according to the index inside second file and read the data.

Sounds as a lot of work but it's real.
__________________
alien is offline
Send a message via ICQ to alien
JFeldon
Member
Join Date: Feb 2007
Location: United Kingdom
Old 12-01-2007 , 07:06   Re: Storing some info...
Reply With Quote #4

Sounds like a good idea. I understood parts of it, but have never used/seen the fread_raw and fwrite_raw before. I looked 'em up in the FuncWiki thing but don't really understand it. Can you explain more please?

Thanks for the help though
JFeldon is offline
Send a message via MSN to JFeldon
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:05.


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