Player stats list
#8
Well, if you wanna write to a .ini file (basically a fancy text file), here's some basic functions:

-- File path, the root starts at the MCServer executable
local FilePath = "Plugins/SomePlugin/MyIniFile.ini"

-- An integer that we want to store, let's say 34
local BlocksDestroyed = 34

-- Creates a .ini file object
local SomeIniFile = cIniFile()

-- Create a key for values to go under
SomeIniFile:AddKeyName("BlocksBroken")

-- Create a value under this key name
SomeIniFile:SetValueI("BlocksBroken", "ValueNumber", BlocksDestroyed)

-- Write the file to disk
SomeIniFile:WriteFile(FilePath)

If you would like to access that value from disk, do this:

-- Read the file off of the disk
SomeIniFile:ReadFile(FilePath)

-- Set value of NumBlocks to the amount stored under the key name and that specific value name
local NumBlocks = SomeIniFile:GetValueI("BlocksBroken", "ValueNumber")
file
NumBlocks would then contain the 34 that was stored in the file earlier. If you look in the file at the set file path, you should see a file structured like this:

[BlocksBroken]
ValueNumber=34

Hope this might have helped.
Reply
Thanks given by:


Messages In This Thread
Player stats list - by Boo - 04-19-2015, 07:44 PM
RE: Player stats list - by worktycho - 04-19-2015, 09:16 PM
RE: Player stats list - by Boo - 04-19-2015, 09:29 PM
RE: Player stats list - by worktycho - 04-19-2015, 09:36 PM
RE: Player stats list - by Boo - 04-19-2015, 09:55 PM
RE: Player stats list - by xoft - 04-19-2015, 10:08 PM
RE: Player stats list - by Boo - 04-20-2015, 05:33 PM
RE: Player stats list - by DiamondToaster - 04-21-2015, 05:55 AM
RE: Player stats list - by NiLSPACE - 04-21-2015, 06:00 AM
RE: Player stats list - by DiamondToaster - 04-21-2015, 07:56 AM



Users browsing this thread: 3 Guest(s)