Jump to content

مساعدة في كود


MOKET

Recommended Posts

سلآم الله عليكم اخواني

ممكن طلب بسيط جداً

ساطرح لكم ملف كلينت وملف سيرفر لمود auto login

ولكن هذا المود عمله مختلف عن الذي اريدة ، 

حيث انه يعمل عند كتابة

autologin user pass

وانا لا اريدة هكذه

اريده لو يسجل دخوله الاعب مره واحدة يسوي auto login تلقائي

يعني من اول مره ي اخوان

ملف كلينت :

addEventHandler("onClientResourceStart",getRootElement(),

    function()

        if not fileExists("settings.xml") then

            local settings = xmlCreateFile("settings.xml","AutoLogin")

            local Username = xmlCreateChild(settings,"Username")

            local Password = xmlCreateChild(settings,"Password")

            local Serial = xmlCreateChild(settings,"Serial")

            xmlSaveFile(settings)

        end

        local node = xmlLoadFile ("settings.xml")

        local Username = xmlFindChild(node,"Username",0)

        local Password = xmlFindChild(node,"Password",0)

        local Serial = xmlFindChild(node,"Serial",0)

        local pass = xmlNodeGetValue(Password)

        local user = xmlNodeGetValue(Username)

        local serial = xmlNodeGetValue(Serial)

        if getPlayerSerial(localPlayer) == serial then

            triggerServerEvent("triggerThis",getLocalPlayer(),user,pass)

        end

    end

    )

addCommandHandler("autologin",

    function(command,username,password)

        local node = xmlLoadFile ("settings.xml")

        local Username = xmlFindChild(node,"Username",0)

        local Password = xmlFindChild(node,"Password",0)

        local Serial = xmlFindChild(node,"Serial",0)

        local user = xmlNodeGetValue(Username)

        local pass = xmlNodeGetValue(Password)

        local serial = xmlNodeGetValue(Serial)

        if user == "none" or user == "" then

            xmlNodeSetValue(Username,username)

            xmlNodeSetValue(Password,password)

            xmlNodeSetValue(Serial,getPlayerSerial(getLocalPlayer()))

            xmlSaveFile(node)

        else

            xmlNodeSetValue(Username,"none")

            xmlNodeSetValue(Password,"none")

            xmlNodeSetValue(Serial,"none")

            xmlSaveFile(node)

        end

end )

=============== الي فوق هو كلينت 

addEvent("triggerThis",true)

addEventHandler("triggerThis",getRootElement(),

function(user,pass)

    logIn(source,getAccount(user),pass)

    outputChatBox("You have been automatically logged in to #FFFFFF"..user.."'s#00FF00 account!",source,0,255,0,true)

    outputChatBox("To disable AutoLogin, use /autologin!",source,0,255,0,true)

end )

هذا هو ملف سيرفر ،

اخواني الي مافهمني يقول لي عشان اشرح له اكثر

انا بحاجة لهذا الشيء جداً

Edited by !#NssoR_)
Adding Lua tag.
Link to comment
15 minutes ago, Ghost-Gamer said:

اها يعني تبيه لمن  يكتب الامر يحفظ كل شي حقه و لمن يدخل سيرفر ما يسجل يسوي تسجيل تلقائي صح؟

 

يب يوم يسوي تسجيل دخول ، مايحتاج يكتب AutoLogin user pass

على طول يتسوا اوتو لوقين ويخش بدون م تظهر لوحة تسجيل

Link to comment

امسح هذا من الكلنت :
 

addCommandHandler("autologin",

    function(command,username,password)

        local node = xmlLoadFile ("settings.xml")

        local Username = xmlFindChild(node,"Username",0)

        local Password = xmlFindChild(node,"Password",0)

        local Serial = xmlFindChild(node,"Serial",0)

        local user = xmlNodeGetValue(Username)

        local pass = xmlNodeGetValue(Password)

        local serial = xmlNodeGetValue(Serial)

        if user == "none" or user == "" then

            xmlNodeSetValue(Username,username)

            xmlNodeSetValue(Password,password)

            xmlNodeSetValue(Serial,getPlayerSerial(getLocalPlayer()))

            xmlSaveFile(node)

        else

            xmlNodeSetValue(Username,"none")

            xmlNodeSetValue(Password,"none")

            xmlNodeSetValue(Serial,"none")

            xmlSaveFile(node)

        end

end )

وحط ذا بسيرفر :
 

addCommandHandler("autologin",

    function(player,command)
    
    local PlayerAcc = getPlayerAccount ( player )
    
	local node = xmlLoadFile ("settings.xml")

	local Username = xmlFindChild(node,"Username",0)

	local Password = xmlFindChild(node,"Password",0)

	local Serial = xmlFindChild(node,"Serial",0)

	local user = xmlNodeGetValue(Username)

	local pass = xmlNodeGetValue(Password)

	local serial = xmlNodeGetValue(Serial)
    
    if not isGuestAccount ( PlayerAcc ) then
      
		if getAccountData ( PlayerAcc, "AutoLogIn" ) == false then

            xmlNodeSetValue( Username, getAccountName ( PlayerAcc ) )

            xmlNodeSetValue( Password, getAccountData ( PlayerAcc, "Password" ) )

            xmlNodeSetValue( Serial, getPlayerSerial ( player ) )
			
      		setAccountData ( PlayerAcc, "AutoLogIn", true )
      		
            xmlSaveFile(node)

        		else

            xmlNodeSetValue(Username,"none")

            xmlNodeSetValue(Password,"none")

            xmlNodeSetValue(Serial,"none")
        
        	setAccountData ( PlayerAcc, "AutoLogIn", false )

            xmlSaveFile(node)

        end
	end
end )

وسوي عند  التسجيل او صنع حساب ..
 

local acc = -- حط الاكوانت
local pass = -- حط الباس
setAccountData ( acc, "Password", pass )

 

Link to comment
2 minutes ago, iMr.WiFi..! said:

امسح هذا من الكلنت :
 


addCommandHandler("autologin",

    function(command,username,password)

        local node = xmlLoadFile ("settings.xml")

        local Username = xmlFindChild(node,"Username",0)

        local Password = xmlFindChild(node,"Password",0)

        local Serial = xmlFindChild(node,"Serial",0)

        local user = xmlNodeGetValue(Username)

        local pass = xmlNodeGetValue(Password)

        local serial = xmlNodeGetValue(Serial)

        if user == "none" or user == "" then

            xmlNodeSetValue(Username,username)

            xmlNodeSetValue(Password,password)

            xmlNodeSetValue(Serial,getPlayerSerial(getLocalPlayer()))

            xmlSaveFile(node)

        else

            xmlNodeSetValue(Username,"none")

            xmlNodeSetValue(Password,"none")

            xmlNodeSetValue(Serial,"none")

            xmlSaveFile(node)

        end

end )

وحط ذا بسيرفر :
 


addCommandHandler("autologin",

    function(player,command)
    
    local PlayerAcc = getPlayerAccount ( player )
    
	local node = xmlLoadFile ("settings.xml")

	local Username = xmlFindChild(node,"Username",0)

	local Password = xmlFindChild(node,"Password",0)

	local Serial = xmlFindChild(node,"Serial",0)

	local user = xmlNodeGetValue(Username)

	local pass = xmlNodeGetValue(Password)

	local serial = xmlNodeGetValue(Serial)
    
    if not isGuestAccount ( PlayerAcc ) then
      
		if getAccountData ( PlayerAcc, "AutoLogIn" ) == false then

            xmlNodeSetValue( Username, getAccountName ( PlayerAcc ) )

            xmlNodeSetValue( Password, getAccountData ( PlayerAcc, "Password" ) )

            xmlNodeSetValue( Serial, getPlayerSerial ( player ) )
			
      		setAccountData ( PlayerAcc, "AutoLogIn", true )
      		
            xmlSaveFile(node)

        		else

            xmlNodeSetValue(Username,"none")

            xmlNodeSetValue(Password,"none")

            xmlNodeSetValue(Serial,"none")
        
        	setAccountData ( PlayerAcc, "AutoLogIn", false )

            xmlSaveFile(node)

        end
	end
end )

وسوي عند  التسجيل او صنع حساب ..
 


local acc = -- حط الاكوانت
local pass = -- حط الباس
setAccountData ( acc, "Password", pass )

 

مشـكور ،

Edited by MOKET
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...