04-19-2015, 07:44 PM
04-19-2015, 09:16 PM
There are hooks for all of those events and SQLite bindings to store the data so it should be possible.
04-19-2015, 09:29 PM
Can you write a little example? i am a novice in lua
04-19-2015, 09:36 PM
I'm afraid I'm the wrong person to ask, I know the API from the c++ side, so I know very little about lua as well.
04-19-2015, 09:55 PM
crap. i am too :-( Relly MC-Server Nice platform for server. but plugins...
04-19-2015, 10:08 PM
Have a look at the documentation page, it has a few examples, too, in the Articles section:
http://mc-server.xoft.cz/LuaAPI/
http://mc-server.xoft.cz/LuaAPI/
04-20-2015, 05:33 PM
:-( I do not quite understand programming. I need an example of writing to a text file number of broken blocks. Please help, it is very necessary
04-21-2015, 05:55 AM
Well, if you wanna write to a .ini file (basically a fancy text file), here's some basic functions:
If you would like to access that value from disk, do this:
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:
Hope this might have helped.
-- 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.
04-21-2015, 06:00 AM
04-21-2015, 07:56 AM
Well, that was just an example of how it worked.
Per-player, I would do something like this:
And to access it:
Per-player, I would do something like this:
-- Assuming the blocks broken is 34 or something like that... local BlocksBroken = 34 -- If the player's key name does not exist, add it if SomeIniFile:FindKey(Player:GetUUID()) == -1 then SomeIniFile:AddKeyName(Player:GetUUID()) end -- Write the amount of blocks broken under the 'BlocksBroken' value under the Player's UUID SomeIniFile:SetValueI(Player:GetUUID(), "BlocksBroken", BlocksBroken) -- Write the file to disk SomeIniFile:WriteFile(FilePath)
And to access it:
-- Read the file off of the disk SomeIniFile:ReadFile(FilePath) -- Set value of NumBlocks to the amount stored under the Player's key name and 'BlocksBroken' value name local NumBlocks = SomeIniFile:GetValueI(Player:GetUUID(), "BlocksBroken")