Making a bit of progress creating a tphome mod for oxide 2. Now I want to output the list of home locations to a file which will be written to and read.
So I was wondering, whats the best practice for this to ensure smooth operation and follows some sort of standard?
Should I write to the self.Config file each users home location(s) - not worked out how I will do this bit yet - or have a separate file containing the homes coordinates. If the separate file is the way to go, how do I go about creating it and reading/writing to it?
Cheers
Dave
Data store query
Discussion in 'Rust Development' started by Taffy, Oct 17, 2014.
-
Saving to a seperate datafile is the way to go.
@thomasfn added the DataFile library yesterday but its not fully working yet. See here https://github.com/OxideMod/Oxide/commit/058e00d053119839407cc96526f5a970601e5f09 -
ah, that be why I am seeing datafilesystem errors then Thought it was just me.
Shall plod on with the code with a view to adding that later then if and when I work out the correct syntax
Thanks for the info
Cheers -
The data file system should at least be functional, what kind of errors are you getting?
Here is my test code for it:
Code:function PLUGIN:cmdDatafileTest( arg ) local datatable = datafile.GetDataTable( "test" ) datatable.entries = datatable.entries or {} datatable.entries[1] = 123 datatable.entries[2] = "hello" datatable.entries[3] = { 10, 20 } datafile.SaveDataTable( "test" ) end
-
Shit, mine didnt look anything like your example
ok so I now have the following in the init function
Code:--load or create home locations save file local datatable = datafile.GetDataTable ("homesave") datatable.entries = datatable.entries or {} datafile.SaveDataTable("homesave")
Code:[Oxide] 8:15 PM [Error] Failed to initialise plugin tphome (A .NET exception occ ured in user-code) [Oxide] 8:15 PM [Debug] at NLua.Lua.ThrowExceptionFromError (Int32 oldTop) [0x 00000] in <filename unknown>:0 at NLua.Lua.CallFunction (System.Object function, System.Object[] args, System .Type[] returnTypes) [0x00000] in <filename unknown>:0 at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (ob ject,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invoke Attr, System.Reflection.Binder binder, System.Object[] parameters, System.Global ization.CultureInfo culture) [0x00000] in <filename unknown>:0
-
-
Thanks mate, makes perfect sense. Think I have been looking at too much code today. Perhaps have too many mods on the go at the same time lol