Player stats list - Printable Version +- Cuberite Forum (https://forum.cuberite.org) +-- Forum: Plugins (https://forum.cuberite.org/forum-1.html) +--- Forum: Plugin Requests (https://forum.cuberite.org/forum-3.html) +--- Thread: Player stats list (/thread-1883.html) |
Player stats list - Boo - 04-19-2015 Hello, I need to make a little database with this information: Player name Killed mobs Destroyed Blocks Died etc. If its possible on mc-server? RE: Player stats list - worktycho - 04-19-2015 There are hooks for all of those events and SQLite bindings to store the data so it should be possible. RE: Player stats list - Boo - 04-19-2015 Can you write a little example? i am a novice in lua RE: Player stats list - worktycho - 04-19-2015 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. RE: Player stats list - Boo - 04-19-2015 crap. i am too :-( Relly MC-Server Nice platform for server. but plugins... RE: Player stats list - xoft - 04-19-2015 Have a look at the documentation page, it has a few examples, too, in the Articles section: http://mc-server.xoft.cz/LuaAPI/ RE: Player stats list - Boo - 04-20-2015 :-( 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 RE: Player stats list - DiamondToaster - 04-21-2015 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. RE: Player stats list - NiLSPACE - 04-21-2015 @DiamondToaster But that isn't per-player right? RE: Player stats list - DiamondToaster - 04-21-2015 Well, that was just an example of how it worked. 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") |