DataStore

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,093
4,784
113
At your house.
github.com
Methods:
C#:
ToIni(String InifileName = "DataStore"):bool
Add(String TableName, object Key, object Value):void
ContainsKey(String TableName, object Key):bool
ContainsValue(String TableName, object Value):bool
Count(String TableName):int
Flush(String TableName):void
Get(String TableName, object Key):object
GetTable(String TableName):Hashtable
Keys(String TableName):object[]
Load():void
Remove(String TableName, object Key):void
Save():void
Values(String TableName):object[]
Example:
Python:
def On_Command(self, Player, cmd, args):
if cmd == "prokit":
if DataStore.ContainsKey("Kit", Player.SteamID):
Player.Message("You already used this kit!")
return
DataStore.Add("Kit", Player.SteamID, 1)
Player.Message("Used Kit!")
JavaScript:
function On_Command(Player, cmd, args) {
if (cmd == "prokit") {
if (DataStore.ContainsKey("Kit", Player.SteamID)) {
Player.Message("You already used this kit!");
return;
}
DataStore.Add("Kit", Player.SteamID, 1);
Player.Message("Used Kit!");
}
}
 

MasterPeace

Retired Staff
Retired Staff
Feb 2, 2015
269
69
28
45
Poland
This question may be dumb, but:

Where is DataStore saving data? To player file in 'Saves' dir or just in memory and resetting when I restart server?

I'll also need it to make backups etc.

Oh, Is it FougeriteDatastore.ds maybe?
 
Last edited:

MasterPeace

Retired Staff
Retired Staff
Feb 2, 2015
269
69
28
45
Poland
I have idea. What if Fougerite can't handle Database (too much properties in memory) and then crashing?

When Fougerite is saving Database? My server running for about 2 hours now, and I see in FTP that Datastore still have yesterday date.

RustPP Autosave Interval is on 200000 now. And I see that map is saving good.

But Datastore not saving anything.
 

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,093
4,784
113
At your house.
github.com
I have idea. What if Fougerite can't handle Database (too much properties in memory) and then crashing?

When Fougerite is saving Database? My server running for about 2 hours now, and I see in FTP that Datastore still have yesterday date.

RustPP Autosave Interval is on 200000 now. And I see that map is saving good.

But Datastore not saving anything.
It should be saving, but you can call DataStore.Save() in a plugin.

I didn't have crashes because of datastore, but I came up with a patch idea. Balu made It, I'm testing It at the moment. If I won't have floods from the BasicWildLife and from the uLink we will release It.
 

MasterPeace

Retired Staff
Retired Staff
Feb 2, 2015
269
69
28
45
Poland
Thanks. Any possibility to call it from Rust Console? If I turn off server to add this function to some plugin DataStore will not save again.
 

MasterPeace

Retired Staff
Retired Staff
Feb 2, 2015
269
69
28
45
Poland
Ok.. It crashed so I updated one plugin with this DataStore.Save() function. Working now. Thanks.
 

MasterPeace

Retired Staff
Retired Staff
Feb 2, 2015
269
69
28
45
Poland
I added it to my AddCash function. Now about 24 hours and still no crash. So all recent crashes was just DataStore fails I guess.

Thanks man.
 

MasterPeace

Retired Staff
Retired Staff
Feb 2, 2015
269
69
28
45
Poland
Yea but it's 1.0.8 RC 2 still.. But I'll not check if crashes gonna happen on 1.0.8 RC 7 too. Too risky to lose some players.
 

MasterPeace

Retired Staff
Retired Staff
Feb 2, 2015
269
69
28
45
Poland
Because errors will make crashes - FAC is not ready for 1.0.8, I would need to fix my plugins also for this Rad checker etc. RustPP was not working on RC6, I don't know if it's working on latest.

Too many problems. I'll wait until next release of Fougerite and FAC.
 

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,093
4,784
113
At your house.
github.com
Because errors will make crashes - FAC is not ready for 1.0.8, I would need to fix my plugins also for this Rad checker etc. RustPP was not working on RC6, I don't know if it's working on latest.

Too many problems. I'll wait until next release of Fougerite and FAC.
I don't get you. The latest release runs fine, and Rust++ is working without errors.

What's the problem with fac on 1.0.8?
 

MasterPeace

Retired Staff
Retired Staff
Feb 2, 2015
269
69
28
45
Poland
Snake is working on FAC problems. (Or worked, as he said he fixed it)

I think you get me, really - I just don't want to risk. Remember that it's Linux and it's harder to keep it alive. I had DataStore saving normally on Windows. Only Linux server had those problems.

I'm paying for server and you need to understand that it's so shitty when I pay for VPS to be 24/7, but server crashing and is offline until I came back from work and restart it. And then after some hours will crash again and if I'm online I'm wasting my money again.

Now it's stable, so I'll just wait until I see that you didn't report any problems with newest release, so I'll be sure that I want to risk uploading it.

And just other example: Jint or RustPP error from RC 5 or 6 made my save clear on Windows host. What if I would upload it to Linux and forget to make any backup?

I think Windows server just ignoring some errors, bugs, glitches. Linux server can't. It will crash if there is same plugin error for like 10 time, it will crash if datastore not saving, it will crash if I'll try to tp 3 times to player who is not available for some reason (didn't spawn or something)
 

MasterPeace

Retired Staff
Retired Staff
Feb 2, 2015
269
69
28
45
Poland
Is it possible that 1.0.8 cleared my Datastore because of new version? Players lost yesterday all they cash etc.... But I'm not sure when. I got 3 crashes.

Or is there max size maybe?

Worst thing in this is that I can't manually edit database.. Only fougerite functions..
 
Last edited:

MasterPeace

Retired Staff
Retired Staff
Feb 2, 2015
269
69
28
45
Poland
Do you maybe know what can cause that? I just restarted my server because forgot to pay in time.... And after restart it's again clear, 1 kb. Players lost everything what they saved.

I have something similiar on localhost when I download save from main server, it clear all map sometimes for no reason.

I could change it to INI base, but I thought it's main advantage of DataStore, that I don't need to make files.
 
Last edited: