Include MySQL
#11
You can reload a players permissions but I don't think you can reload the groups.ini.
Reply
Thanks given by:
#12
(01-07-2014, 04:32 AM)daniel0916 Wrote: Is it possible to reload the groups.ini without restart the server? Is it hard to add a reload function?

Currently it is impossible to reload without a restart. A reload function will be moderately difficult to write. The main difficulty is that each cPlayer holds a pointer to all the groups they are currently in. So a reload will have to:
1, Load the new group.ini into a new structure (but keep the old structures)
2, For each world, for each player walk their (old) groups and assign new groups based on the name
3, For each world, for each player re-resolve their permissions
Reply
Thanks given by:
#13
(01-07-2014, 05:12 AM)xoft Wrote:
(01-07-2014, 04:32 AM)daniel0916 Wrote: Is it possible to reload the groups.ini without restart the server? Is it hard to add a reload function?

Currently it is impossible to reload without a restart. A reload function will be moderately difficult to write. The main difficulty is that each cPlayer holds a pointer to all the groups they are currently in. So a reload will have to:
1, Load the new group.ini into a new structure (but keep the old structures)
2, For each world, for each player walk their (old) groups and assign new groups based on the name
3, For each world, for each player re-resolve their permissions

Okey. Can i restart the server? The plugin check if the mysql db have new permissions and then it edit the groups.ini and restart the server. Is this possible?
Reply
Thanks given by:
#14
Yes.
cRoot:Get():QueueExecuteConsoleCommand("restart");
Reply
Thanks given by:
#15
(01-07-2014, 06:25 AM)xoft Wrote: Yes.
cRoot:Get():QueueExecuteConsoleCommand("restart");

Thanks.
I installed LuaRocks. Have you a guide to use this in mcserver plugin?
Reply
Thanks given by:
#16
There's no real guide.

LuaRocks is somewhat like a packaging system (like apt-get or yum for the OS, but this is for Lua). You need to invoke it to install "rocks" (packages) and then you can use those rocks from any lua code.

For example:
Install the LFS rock:
Code:
sudo luarocks install luafilesystem
Use the LFS in lua code:
local lfs = require ("lfs");
for FileName in lfs.dir(".") do  -- use the LFS function dir
 ...
end

Sorry I have only LFS example, that's the only one I've used so far. Here's a list of public rocks available:
http://luarocks.org/repositories/rocks/
Reply
Thanks given by:
#17
(01-08-2014, 02:52 AM)xoft Wrote: There's no real guide.

LuaRocks is somewhat like a packaging system (like apt-get or yum for the OS, but this is for Lua). You need to invoke it to install "rocks" (packages) and then you can use those rocks from any lua code.

For example:
Install the LFS rock:
Code:
sudo luarocks install luafilesystem
Use the LFS in lua code:
local lfs = require ("lfs");
for FileName in lfs.dir(".") do  -- use the LFS function dir
 ...
end

Sorry I have only LFS example, that's the only one I've used so far. Here's a list of public rocks available:
http://luarocks.org/repositories/rocks/

Okey.
But when i will install MySQL in LuaRocks it don't work:
C:\>luarocks install LuaSQL-MySQL MYSQL_DIR=C:\Program Files (x86)\MySQL

Error: No results matching query were found.

I'm programming in windows.
Reply
Thanks given by:
#18
I tried to use mysql in lua:

Code:
require "luasql.mysql"

function OnPlayerJoined(Player)

    env = assert (luasql.mysql())
    con = assert (env:connect"my_db")
    
end

Then it comes when i start the server this:
[17:45:54] LUA: 2 - error loading module 'luasql.mysql' from file '/usr/local/lib/lua/5.1/luasql/mysql.so':
dynamic libraries not enabled; check your Lua installation
[17:45:54] Error in plugin CryptoPermissions in file Plugins/CryptoPermissions/onlogin.lua

I don't know how can i activate dynamic libraries..
Reply
Thanks given by:
#19
It would seem that your LuaRocks is somewhat broken. On the other hand, I had been experimenting with them heavily before I managed to get them working on windows and truthfully I never managed to actually compile any Rock from source, I had to download and install a binary distribution.

I'm sorry, but I don't have any more answers, you'll need to experiment on your own here.
Reply
Thanks given by:
#20
(01-09-2014, 05:31 AM)xoft Wrote: It would seem that your LuaRocks is somewhat broken. On the other hand, I had been experimenting with them heavily before I managed to get them working on windows and truthfully I never managed to actually compile any Rock from source, I had to download and install a binary distribution.

I'm sorry, but I don't have any more answers, you'll need to experiment on your own here.

How have you installed it on windows?
I installed it on Linux and there come this error.. Maybe i made something false. Or do you know someone who are using luasql?
Reply
Thanks given by:




Users browsing this thread: 3 Guest(s)