AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   saving things & possible data lost & cpu usable (https://forums.alliedmods.net/showthread.php?t=196544)

f55z55p 09-22-2012 13:50

saving things & possible data lost & cpu usable
 
Hello, Im having a questions about saving things.
I want to make new rank systems.
Rank are saved into playerdatabase.dat and inside of file will be
Quote:

// player 1
password: xxxxxxxx
name: xxxxxxxx
ip: xxx.xxx.xxx.xxx
rank: xxx xx x x xxx xx xxxx xx xx
grXP: x

// player 2
password: xxxxxxxx
name: xxxxxxxx
ip: xxx.xxx.xxx.xxx
rank: xxx xx x x xxx xx xxxx xx xx
grXP: x

// player 3
password: xxxxxxxx
name: xxxxxxxx
ip: xxx.xxx.xxx.xxx
rank: xxx xx x x xxx xx xxxx xx xx
grXP: x
...
// player x text will not be, it was just for example.
I have nice idea for new saving opportunity
if player connects, read setinfo xindex, xindex is line what show where player data are located in playerdatabase.dat
so we dont need to check all lines one by one.
but as i noticed that saving stuff inside the file takes alot of cpu.

Q1: is this good idea to save player rank every time when something happen (example if player shot or make dmg) or mayby i keep data in variables till player disconnects and then save data?

Q2: if i save data only then when player disconnects then is there any chance that some(or all) data will be lost and not saved.

Q3: if the database file goes to big like 100k lines ( because every player bring 16 new lines with his data ) then reading that big file ( even when line is known ) will cost more cpu usable?

Q4: what is maximum col in one line what can be


I am very sure that you wanna ask me now that why the hell you dont use nvault or mysql.
answer: mysql can be slow sometimes, nvault i think reading stuff from there cost large cpu usable ( if nvault file is very big )

I hope that you find a time to reply my questions, i will be very grateful.
Thanks!

xPaw 09-22-2012 16:07

Re: saving things & possible data lost & cpu usable
 
What you want to do will be way slower than MySQL.

f55z55p 09-22-2012 17:39

Re: saving things & possible data lost & cpu usable
 
Quote:

Originally Posted by xPaw (Post 1804177)
What you want to do will be way slower than MySQL.

but its in server frame where the plugin is working, that is the good side of this.

I dont understand why writing is that way is slower than using nvault or mysql.
Computer first need to code text into hex language and then again writing.
Anyway, can somebody please answer my questions?

My way feels so nice, because i can read the text and i dont need to use any decoder.
-f55z55p


All times are GMT -4. The time now is 08:12.

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