Cuberite Forum
[Under construction] Auth plugin - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Plugins (https://forum.cuberite.org/forum-1.html)
+--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html)
+--- Thread: [Under construction] Auth plugin (/thread-152.html)

Pages: 1 2


[Under construction] Auth plugin - Zehir - 06-01-2011

Hello, I work on auth plugin (looklike xAuth plugin for bukkit)


Works:
/register
/changepass
Block player move

To do:
/login


RE: Auth plugin - FakeTruth - 06-01-2011

Read this page (just created it) http://mc-server.org/wiki/doku.php?id=api:plugin:onlogin

And check out the Core plugin for an example.


RE: Auth plugin - Zehir - 06-02-2011

Could you install the md5 Library for crypt the password?

http://www.keplerproject.org/md5/index.html



RE: Auth plugin - FakeTruth - 06-02-2011

I already have a MD5 encryption script in MCServer, but it's not open to Lua yet... I'll try to include it in next release.
In the meanwhile I think you can test your plugin without encryption


RE: Auth plugin - Zehir - 06-02-2011

Yes, for moment I have my crypt function Smile

PHP Code:
function AuthPluginCrypt(Password) return Password end

Found my first bug but I dont now how to solve it

PHP Code:
self:AddCommand("/changepass", " - [Old Password] [New Password] - Change pass", "auth.changepass") -- Commande pour changer de mot de pass (commun) self:AddCommand("/test", "", "auth.test") -- Commande pour tester self:AddCommand("/register", " - [Password] - Login with the password", "auth.register") -- Commande pour s'enregistrer (commun) self:BindCommand( "/changepass", "auth.changepass", HandleChangePassCommand ) -- Associe la commande /changepass a la fonction HandleChangePassCommand self:BindCommand( "/test", "auth.test", HandleTestCommand ) -- Associe la commande /test a la fonction HandleTestCommand self:BindCommand( "/register", "auth.register", HandleRegisterCommand ) -- Associe la commande /register a la fonction HandleRegisterCommand

Product this with /help 3


Auth
/changepass - [Old Password] [New Password] - Change pass
Auth
/test
/register - [Password] - Login with the password

An idea to fhix that?



RE: [Under construction] Auth plugin - FakeTruth - 06-02-2011

Hmm.. so you get 'Auth' twice in /help ? Sounds like a bug in the /help command of Core. Nothing you have to worry about.


RE: [Under construction] Auth plugin - Zehir - 06-02-2011

Could you make the doc for OnDisconnect please?

And I have send the screenshot for /help

Another problem...

PHP Code:
local PlayerName = Player:GetName() if ( UsersIni:ReadFile() == true ) then UsersIni:DeleteValue(PlayerName, "X") UsersIni:SetValue(PlayerName, "X", Player:GetPosZ()) UsersIni:WriteFile() return true end

Transfrome my Ini file:
Code:
[Zehir_] Groups=Admins Password=testtest
Into
Code:
[Zehir_] Groups=Admins Password=testtest Groups=Admins Password=testtest X=-2730.3552566584 [Zehir_]



RE: [Under construction] Auth plugin - FakeTruth - 06-02-2011

Thanks for the screenshot.

About your ini problem, make sure you only ReadFile() ONCE:
Code:
UsersIni = cIniFile("myIni.ini") UsersIni:ReadFile() UsersIni:ReadFile() UsersIni:ReadFile() UsersIni:WriteFile()
BAD!

Code:
UsersIni = cIniFile("myIni.ini") UsersIni:ReadFile() UsersIni:WriteFile()
GoodTongue


Here's the page for OnDisconnect: http://www.mc-server.org/wiki/doku.php?id=api:plugin:ondisconnect


RE: [Under construction] Auth plugin - Zehir - 06-02-2011

What is this fuction for ini files?

Erase();
Clear();
Reset();

Edit: Solve problem with change local values
function AuthPlugin:OnPlayerMove( Player )

Can you change your function to detect the displacement of a block and not 0.00000001 bloc? Because this spam my channel of
PHP Code:
Player:SendMessage( cChatColor.Red .. "You must login" )

Because I want block movement if player not login

PHP Code:
function AuthPlugin:OnPlayerMove( Player ) if IsAuth == 0 then --Player:TeleportTo( SpawnPosx, SpawnPosy, SpawnPosz ) else return true end Player:SendMessage( cChatColor.Red .. "You must login" ) return false end
A idea for not spam this message?


RE: [Under construction] Auth plugin - Zehir - 06-04-2011

Oh to use this fuction? AddKeyName

I have try this but not work:

PHP Code:
local UsersIni = cIniFile("users.ini") if ( UsersIni:ReadFile() == true ) then UsersIni:AddKeyName(Player:GetName()) UsersIni:WriteFile() return true end

I just want add the key if not exist

Code:
[Playername]