المود شغال وكل شي بسس ما يحفظ تسجيل دخول تلقائي
function guiCreateWindow( x2, y2, width2, height2, titleBarText2, relative2 )
mainBackground = guiCreateStaticImage ( x2, y2, width2, height2, "1.png", relative2 )
local mainBackgroundLabel = guiCreateLabel ( 0, 0, 250, 100, titleBarText2, false, mainBackground )
guiSetEnabled ( mainBackgroundLabel, false )
return mainBackground
end
GUIEditor_Button = {}
GUIEditor_Checkbox = {}
GUIEditor_Label = {}
GUIEditor_Edit = {}
GUIEditor_Image = {}
fadeCamera( false )
showChat( false )
showCursor(true)
wnd = guiCreateWindow(1,1,799,600,"",false)
guiSetAlpha(wnd,1)
GUIEditor_Image[2] = guiCreateStaticImage(10,24,781,449,"2.png",false,wnd)
GUIEditor_Edit[1] = guiCreateEdit(299,484,166,27,"",false,wnd)
GUIEditor_Edit[2] = guiCreateEdit(299,520,166,27,"",false,wnd)
guiEditSetMasked(GUIEditor_Edit[2],true)
GUIEditor_Label[1] = guiCreateLabel(238,487,106,18,"username",false,wnd)
GUIEditor_Label[2] = guiCreateLabel(238,521,106,18,"password",false,wnd)
GUIEditor_Button[1] = guiCreateButton(279,559,78,24,"login",false,wnd)
GUIEditor_Button[2] = guiCreateButton(432,559,78,24,"register",false,wnd)
GUIEditor_Checkbox[1] = guiCreateCheckBox(474,522,123,22,"تذكرني",false,false,wnd)
addEventHandler("onClientGUIClick",getRootElement(),
function ()
local user = guiGetText(GUIEditor_Edit[1])
local pass = guiGetText(GUIEditor_Edit[2])
if ( source == GUIEditor_Button[1] ) then
guiSetVisible( wnd, false )
showChat( true )
fadeCamera( true )
showCursor( false )
if ( guiCheckBoxGetSelected ( GUIEditor_Checkbox[1] ) ) then
local file = xmlLoadFile("account.xml") or xmlCreateFile("account.xml","login")
xmlNodeSetValue(xmlCreateChild(file,"name"),""..user.."")
xmlNodeSetValue(xmlCreateChild(file,"pass"),""..pass.."")
xmlNodeSetAttribute(file,"username",tostring(guiGetText(GUIEditor_Edit[1])))
xmlNodeSetAttribute(file,"password",tostring(guiGetText(GUIEditor_Edit[2])))
xmlSaveFile(file)
xmlUnloadFile(file)
triggerServerEvent('onlogin',localPlayer,user,pass)
end
addEvent("load",true)
addEventHandler("load",root,function()
local xml = xmlLoadFile ( "account.xml" )
local n1 = xmlFindChild ( xml, "name", 0 )
local n2 = xmlFindChild ( xml, "pass", 0 )
guiSetText(GUIEditor_Edit[1],xmlNodeGetValue ( n1 ))
guiSetText(GUIEditor_Edit[2],xmlNodeGetValue ( n2 ))
end)
elseif ( source == GUIEditor_Button[2] ) then
triggerServerEvent('onRegister',localPlayer,user,pass)
end
end
)
addEvent('onlogin',true)
addEventHandler('onlogin',getRootElement(),
function (user,pass)
local account = getAccount(user,pass)
if ( account ) then
logIn(source,account,pass)
else
outputChatBox("* Worng Username Or Password",source,255,0,0)
end
end
)
addEventHandler("onPlayerJoin",root,function()
triggerClientEvent(source,"load",source)
end)
addEvent('onRegister',true)
addEventHandler('onRegister',root,
function (user,pass)
local account = getAccount(user,pass)
if ( account ) then
logIn(source,account,pass)
outputChatBox("* This Account is Already Used",source,255,0,0)
else
addAccount(user,pass)
outputChatBox("UserName: " .. user .. " PassWord : " .. pass,source,0,150,255)
end
end
)