Jump to content

مساعدة بلوحة تسجيل دخول


Recommended Posts

السلام عليكم

الحين مسوي لوحة تسجيل دخول

بس المشكلة لو الرقم السري والباس خطأ اللوحة تختفي

انا مابيها تختفي الا لو المعلومات حقة صح

ككلنت

 

triggerServerEvent("onGetSave",localPlayer)
showCursor ( true )


addEvent("onPutSave",true)
addEventHandler("onPutSave",root,
	function (puser,ppass)
		guiSetText(user,puser)
		guiSetText(pass,ppass)
	end
)


addEventHandler("onClientGUIClick",root,
	function ()
		local user = guiGetText(user)
		local pass = guiGetText(pass)
		if ( source == btn.login ) then
			if user ~= "" and pass ~= "" then
				if guiCheckBoxGetSelected(remember) then
					triggerServerEvent("onLoginWith",localPlayer,user,pass)
				else
					triggerServerEvent("onLogin",localPlayer,user,pass)
				end
			else
				outputChatBox("* You Must Write Username Or Password",255,0,0)
			end
		elseif ( source == btn.reg ) then
			if user ~= "" and pass ~= "" then
				triggerServerEvent("onReg",localPlayer,user,pass)
			else
				outputChatBox("* You Must Write Username Or Password",255,0,0)
			end
		end
	end
)

----------------------------------------------------------------------------
addEventHandler ( "onClientGUIClick", resourceRoot, function (    )
    if ( source == btn.login ) then
        guiSetVisible ( main, false )
        showCursor ( false )
    end
end )
addEventHandler ( "onClientGUIClick", resourceRoot, function (    )
    if ( source == gust ) then
        guiSetVisible ( main, false )
        showCursor ( false )
    end
end )

 

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

يسوي تسجيل دخول تلقائي ولو ابغا الغية 

اسوي مثلا

unauto في اف8

لو ابي ارجعة

auto وشكرااا

Link to comment

بالنسبة لمشكلتك حقت تختفي , تفضل

triggerServerEvent("onGetSave",localPlayer)
showCursor ( true )


addEvent("onPutSave",true)
addEventHandler("onPutSave",root,
	function (puser,ppass)
		guiSetText(user,puser)
		guiSetText(pass,ppass)
	end
)


addEventHandler("onClientGUIClick",root,
	function ()
		local user = guiGetText(user)
		local pass = guiGetText(pass)
		if ( source == btn.login ) then
			if user ~= "" and pass ~= "" then
				if guiCheckBoxGetSelected(remember) then
					triggerServerEvent("onLoginWith",localPlayer,user,pass)
				else
					triggerServerEvent("onLogin",localPlayer,user,pass)
				end
			else
				outputChatBox("* You Must Write Username Or Password",255,0,0)
			end
		elseif ( source == btn.reg ) then
			if user ~= "" and pass ~= "" then
				triggerServerEvent("onReg",localPlayer,user,pass)
			else
				outputChatBox("* You Must Write Username Or Password",255,0,0)
			end
		end
	end
)

----------------------------------------------------------------------------
addEventHandler ( "onClientGUIClick", resourceRoot, function (    )
    if ( source == gust ) then
        guiSetVisible ( main, false )
        showCursor ( false )
    end
end )

لكن ’ لازمني اكواد سيرفر عشان كذا حتى لو سجلت دخولك راح اللوحة تظل ظاهره " إطرح اكواد سيرفر

أما مشكلتك الثانية مافهمتها صراحة ,

أها فهمت طلبك الثاني , طيب إرسل اكواد سيرفر وأسويه لك ;) 

Link to comment

AbU - W6N
 



executeSQLQuery("CREATE TABLE IF NOT EXISTS players_save( serial TEXT, user TEXT, pass TEXT)")

function AddPlayer(serial,user,pass)
	executeSQLQuery("INSERT INTO players_save(serial,user,pass) VALUES(?,?,?)",serial,user,pass)
end

function isPlayerSave(serial)
	local sel = executeSQLQuery("SELECT serial FROM players_save WHERE serial=?",serial)
	if sel == 0 then
		return false
	else
		return true
	end
end

function getUserAndPass(serial)
	local user,pass = "",""
	if isPlayerSave(serial) then
		local sel = executeSQLQuery("SELECT * FROM players_save WHERE serial=?",serial)
		for i,player in ipairs(sel) do
			if i == 1 then
				user = player.user
				pass = player.pass
			end
		end
		return user,pass
	end
	return false
end

addEvent("onGetSave",true)
addEventHandler("onGetSave",root,
	function ()
		local serial = getPlayerSerial(source)
		if isPlayerSave(serial) then
			local user,pass = getUserAndPass(serial)
			triggerClientEvent(source,"onPutSave",source,user,pass)
		end
	end
)

addEvent("onLoginWith",true)
addEventHandler("onLoginWith",root,
	function (user,pass)
		local acc = getAccount(user,pass)
		local serial = getPlayerSerial(source)
		if acc then
			logIn(source,acc,pass)
			outputChatBox("* تم بنجاح تسجيل دخول",source,0,255,0)
			AddPlayer(serial,user,pass)
			triggerClientEvent(source,"onCl",source)
		else
			outputChatBox("* الحساب او كلمة المرور خطأ",source,255,0,0)
		end
	end
)

addEvent("onLogin",true)
addEventHandler("onLogin",root,
	function (user,pass)
		local acc = getAccount(user,pass)
		if acc then
			logIn(source,acc,pass)
			outputChatBox("* تم بنجاح تسجيل دخول",source,0,255,0)
			triggerClientEvent(source,"onCl",source)
		else
			outputChatBox("* الحساب او كلمة مرور خطأ",source,255,0,0)
		end
	end
)

addEvent("onReg",true)
addEventHandler("onReg",root,
	function (user,pass)
		local acc = getAccount(user,pass)
		if acc then
			outputChatBox("* هذا الحساب مستخدم من قبل",source,255,0,0)
		else
			addAccount(user,pass)
			outputChatBox("* Username = " .. user .. "",source,0,255,0)
			outputChatBox("* Password = " .. pass .. "",source,0,255,0)
		end
	end
)
Edited by SAM!!
Link to comment

Client :-
 

triggerServerEvent("onGetSave",localPlayer)
showCursor ( true )


addEvent("onPutSave",true)
addEventHandler("onPutSave",root,
	function (puser,ppass)
		guiSetText(user,puser)
		guiSetText(pass,ppass)
	end
)


addEventHandler("onClientGUIClick",root,
	function ()
		local user = guiGetText(user)
		local pass = guiGetText(pass)
		if ( source == btn.login ) then
			if user ~= "" and pass ~= "" then
				if guiCheckBoxGetSelected(remember) then
					triggerServerEvent("onLoginWith",localPlayer,user,pass)
				else
					triggerServerEvent("onLogin",localPlayer,user,pass)
				end
			else
				outputChatBox("* You Must Write Username Or Password",255,0,0)
			end
		elseif ( source == btn.reg ) then
			if user ~= "" and pass ~= "" then
				triggerServerEvent("onReg",localPlayer,user,pass)
			else
				outputChatBox("* You Must Write Username Or Password",255,0,0)
			end
		end
	end
)

----------------------------------------------------------------------------
addEventHandler ( "onClientGUIClick", resourceRoot, function (    )
    if ( source == gust ) then
        guiSetVisible ( main, false )
        showCursor ( false )
    end
end )

addEvent("onCl",true);
addEventHandler("onCl",root,function()
guiSetVisible(main,false)
showCursor(false)
end
)

بالنسبة لـ حق التسجيل التلقائي , بروح الحمام وأجي اسويه xDxD

لآ تنسى اللايك "

Edited by AbU - W6N
  • Like 1
  • Thanks 1
  • Haha 1
Link to comment

Server :-
 

executeSQLQuery("CREATE TABLE IF NOT EXISTS players_auto( serialx TEXT, userx TEXT, passx TEXT)")

executeSQLQuery("CREATE TABLE IF NOT EXISTS players_save( serial TEXT, user TEXT, pass TEXT)")

function AddPlayer(serial,user,pass)
	executeSQLQuery("INSERT INTO players_save(serial,user,pass) VALUES(?,?,?)",serial,user,pass)
end
function addPlayerxz(serial,user,pass)
	executeSQLQuery("INSERT INTO players_auto(serialx,userx,passx) VALUES(?,?,?)",serial,user,pass)
end

function isPlayerSave(serial)
	local sel = executeSQLQuery("SELECT serial FROM players_save WHERE serial=?",serial)
	if sel == 0 then
		return false
	else
		return true
	end
end
function isPlayerSavedAuto(serial)
	local sel = executeSQLQuery("SELECT serial FROM players_auto WHERE serialx=?",serial)
	if sel == 0 then
		return false
	else
		return true
	end
end

function getUserAndPass(serial)
	local user,pass = "",""
	if isPlayerSave(serial) then
		local sel = executeSQLQuery("SELECT * FROM players_save WHERE serial=?",serial)
		for i,player in ipairs(sel) do
			if i == 1 then
				user = player.user
				pass = player.pass
			end
		end
		return user,pass
	end
	return false
end

function getUsernameAndPassword(serial)
	local user,pass = "",""
	if isPlayerSavedAuto(serial) then
		local sel = executeSQLQuery("SELECT * FROM players_auto WHERE serialx=?",serial)
		for i,player in ipairs(sel) do
			if i == 1 then
				userx = player.userx
				passx = player.passx
			end
		end
		return userx,passx
	end
	return false
end

addEvent("onGetSave",true)
addEventHandler("onGetSave",root,
	function ()
		local serial = getPlayerSerial(source)
		if isPlayerSave(serial) then
			local user,pass = getUserAndPass(serial)
			triggerClientEvent(source,"onPutSave",source,user,pass)
		end
    if isPlayerSavedAuto(serial) then
    local user,pass = getUsernameAndPassword(serial)
    logIn(source,user,pass)
    triggerClientEvent(source,"onCl",source)
    end
	end
)

addEvent("onLoginWith",true)
addEventHandler("onLoginWith",root,
	function (user,pass)
		local acc = getAccount(user,pass)
		local serial = getPlayerSerial(source)
		if acc then
			logIn(source,acc,pass)
			outputChatBox("* تم بنجاح تسجيل دخول",source,0,255,0)
			AddPlayer(serial,user,pass)
			triggerClientEvent(source,"onCl",source)
		else
			outputChatBox("* الحساب او كلمة المرور خطأ",source,255,0,0)
		end
	end
)

addEvent("onLogin",true)
addEventHandler("onLogin",root,
	function (user,pass)
		local acc = getAccount(user,pass)
		if acc then
			logIn(source,acc,pass)
			outputChatBox("* تم بنجاح تسجيل دخول",source,0,255,0)
			triggerClientEvent(source,"onCl",source)
            setElementData(source,"Password",""..pass.."")
		else
			outputChatBox("* الحساب او كلمة مرور خطأ",source,255,0,0)
		end
	end
)

addEvent("onReg",true)
addEventHandler("onReg",root,
	function (user,pass)
		local acc = getAccount(user,pass)
		if acc then
			outputChatBox("* هذا الحساب مستخدم من قبل",source,255,0,0)
		else
			addAccount(user,pass)
			outputChatBox("* Username = " .. user .. "",source,0,255,0)
			outputChatBox("* Password = " .. pass .. "",source,0,255,0)
		end
	end
)

addCommandHandler("auto",function(p)
local acc = getPlayerAccount(p)
if (  not isGuestAccount(acc) ) then
local serial = getPlayerSerial(p)
if ( not isPlayerSavedAuto(serial) ) then
local Data = getElementData(p,"Password")
addPlayerxz(serial,acc,Data)
outputChatBox("* تم تفعيل الميزة",p,0,255,0)
else
ouputChatBox("* لقد قمت بتفعيل الميزة من قبل",p,255,0,0)
end
else
outputChatBox("* عليك ان تسجل دخولك أولاً",p,255,0,0)
end
end )
addCommandHandler("unauto",function(p)
local acc = getPlayerAccount(p)
if (  not isGuestAccount(acc) ) then
local serial = getPlayerSerial(p)
if ( isPlayerSavedAuto(serial) ) then
executeSQLQuery("DELETE FROM players_auto WHERE serialx=?", serial)
outputChatBox("* تم إلغاء تفعيل الميزة",p,0,255,0)
else
outputChatBox("* هذه الميزة غير مفعلة",p,255,0,0)
end
else
outputChatBox("* عليك ان تسجل دخولك أولاً",p,255,0,0)
end
end )

بالتوفيق وأعتذر عالتأخير

Link to comment

AbU - W6N

اخي عرفت منين المشاكل وسويتها كنت انت كاتب حرف خطأ

الحين ظهرت اللوحة بس لما  اخرج وادخل من السيرفر تظهرلي تاني

معا العلم اني كتبت في اف8 auto

Link to comment
1 minute ago, SAM!! said:

AbU - W6N

اخي عرفت منين المشاكل وسويتها كنت انت كاتب حرف خطأ

الحين ظهرت اللوحة بس لما  اخرج وادخل من السيرفر تظهرلي تاني

معا العلم اني كتبت في اف8 auto

لآ مو كاتب حرف غلط , وين الحرف الغلط !!؟

سجل دخولك , بعدين اكتب باف8
auto
واطلع من السيرفر , وارجع ادخل وشوف شيصير , و شوف الدي بق من لوق السيرفر لو يطلع شي.

Link to comment
addEvent("onGetSave",true)
addEventHandler("onGetSave",root,
	function ()
		local serial = getPlayerSerial(source)
		if isPlayerSave(serial) then
			local user,pass = getUserAndPass(serial)
			triggerClientEvent(source,"onPutSave",source,user,pass)
		end
    if isPlayerSavedAuto(serial) then
    local user,pass = getUsernameAndPassword(serial)
    logIn(source,user,pass)-------------	ذا الي انت معطهولي شوف كاتب logIn لهيك مايشتغل بس سويتها login اشتغل
    triggerClientEvent(source,"onCl",source)
    end
	end
)


-------
  login(source,user,pass)---سويتها هيك

 

Link to comment

كيف سويتها كلها سمول واشتغل ؟ !!! يعني تسوقها !!!!!!!!!؟؟؟ مو موجودة بالويكي وهذا مو فنكشن أصلاً وراح يجيبلك بلدي بق
nil
تسوقها!

Just now, SAM!! said:

AbU - W6N

يب سويت الاوت بوت

------------

الدي بق كامل

attempt to call global 'login' (anil value)

Database query faild: no such column: serial

Database query faild: no such column: serial

جاك كذا لانك غيرتها لسمول!
 

Link to comment
Just now, SAM!! said:

attempt to call global 'login' (anil value)

دي في السطر ذا

logIn(source,user,pass)

AbU - W6N

لما كانت كابتل المود ماكان يشتغل

 

دامك تعرف تطرح موضوع ليه ؟
+ لا تستهبل لأنه ماينفع سمول! مافي فنكشن كذا

Link to comment

AbU - W6N

وش ياخي انا ماعرف وش يععني مو فاهم والله؟

AbU - W6N

والله رجعتها logIn

بس المود كلة وقت

ذا الديبق سويتها مثل مانت تبي

69:Bad argument @ 'login' [Expected account at argument 2, got nill]

Database query faild: no such column: serial

ماتيجي اللوحة اصلا الحين

 

Link to comment

Try,

executeSQLQuery("CREATE TABLE IF NOT EXISTS players_auto( serialx TEXT, userx TEXT, passx TEXT)")

executeSQLQuery("CREATE TABLE IF NOT EXISTS players_save( serial TEXT, user TEXT, pass TEXT)")

function AddPlayer(serial,user,pass)
	executeSQLQuery("INSERT INTO players_save(serial,user,pass) VALUES(?,?,?)",serial,user,pass)
end
function addPlayerxz(serial,user,pass)
	executeSQLQuery("INSERT INTO players_auto(serialx,userx,passx) VALUES(?,?,?)",serial,user,pass)
end

function isPlayerSave(serial)
	local sel = executeSQLQuery("SELECT serial FROM players_save WHERE serial=?",serial)
	if sel == 0 then
		return false
	else
		return true
	end
end
function isPlayerSavedAuto(serial)
	local sel = executeSQLQuery("SELECT serial FROM players_auto WHERE serialx=?",serial)
	if sel == 0 then
		return false
	else
		return true
	end
end

function getUserAndPass(serial)
	local user,pass = "",""
	if isPlayerSave(serial) then
		local sel = executeSQLQuery("SELECT * FROM players_save WHERE serial=?",serial)
		for i,player in ipairs(sel) do
			if i == 1 then
				user = player.user
				pass = player.pass
			end
		end
		return user,pass
	end
	return false
end

function getUsernameAndPassword(serial)
	local user,pass = "",""
	if isPlayerSavedAuto(serial) then
		local sel = executeSQLQuery("SELECT * FROM players_auto WHERE serialx=?",serial)
		for i,player in ipairs(sel) do
			if i == 1 then
				userx = player.userx
				passx = player.passx
			end
		end
		return userx,passx
	end
	return false
end

addEvent("onGetSave",true)
addEventHandler("onGetSave",root,
	function ()
		local serial = getPlayerSerial(source)
		if isPlayerSave(serial) then
			local user,pass = getUserAndPass(serial)
			triggerClientEvent(source,"onPutSave",source,user,pass)
		end
    if isPlayerSavedAuto(serial) then
    local user,pass = getUsernameAndPassword(serial)
    logIn(source,user,pass)
    triggerClientEvent(source,"onCl",source)
    end
	end
)

addEvent("onLoginWith",true)
addEventHandler("onLoginWith",root,
	function (user,pass)
		local acc = getAccount(user,pass)
		local serial = getPlayerSerial(source)
		if acc then
			logIn(source,acc,pass)
			outputChatBox("* تم بنجاح تسجيل دخول",source,0,255,0)
			AddPlayer(serial,user,pass)
			triggerClientEvent(source,"onCl",source)
		else
			outputChatBox("* الحساب او كلمة المرور خطأ",source,255,0,0)
		end
	end
)

addEvent("onLogin",true)
addEventHandler("onLogin",root,
	function (user,pass)
		local acc = getAccount(user,pass)
		if acc then
			logIn(source,acc,pass)
			outputChatBox("* تم بنجاح تسجيل دخول",source,0,255,0)
			triggerClientEvent(source,"onCl",source)
            setElementData(source,"Password",""..pass.."")
		else
			outputChatBox("* الحساب او كلمة مرور خطأ",source,255,0,0)
		end
	end
)

addEvent("onReg",true)
addEventHandler("onReg",root,
	function (user,pass)
		local acc = getAccount(user,pass)
		if acc then
			outputChatBox("* هذا الحساب مستخدم من قبل",source,255,0,0)
		else
			addAccount(user,pass)
			outputChatBox("* Username = " .. user .. "",source,0,255,0)
			outputChatBox("* Password = " .. pass .. "",source,0,255,0)
		end
	end
)

addCommandHandler("auto",function(p)
local acc = getPlayerAccount(p)
if (  not isGuestAccount(acc) ) then
local serial = getPlayerSerial(p)
if ( not isPlayerSavedAuto(serial) ) then
local Data = getElementData(p,"Password")
local user = tostring(acc)
addPlayerxz(serial,user,Data)
outputChatBox("* تم تفعيل الميزة",p,0,255,0)
else
ouputChatBox("* لقد قمت بتفعيل الميزة من قبل",p,255,0,0)
end
else
outputChatBox("* عليك ان تسجل دخولك أولاً",p,255,0,0)
end
end )
addCommandHandler("unauto",function(p)
local acc = getPlayerAccount(p)
if (  not isGuestAccount(acc) ) then
local serial = getPlayerSerial(p)
if ( isPlayerSavedAuto(serial) ) then
executeSQLQuery("DELETE FROM players_auto WHERE serialx=?", serial)
outputChatBox("* تم إلغاء تفعيل الميزة",p,0,255,0)
else
outputChatBox("* هذه الميزة غير مفعلة",p,255,0,0)
end
else
outputChatBox("* عليك ان تسجل دخولك أولاً",p,255,0,0)
end
end )

 

جرب إلي فوق , ولو ماضبط جرب هذا
 

executeSQLQuery("CREATE TABLE IF NOT EXISTS players_auto( serialx TEXT, userx TEXT, passx TEXT)")

executeSQLQuery("CREATE TABLE IF NOT EXISTS players_save( serial TEXT, user TEXT, pass TEXT)")

function AddPlayer(serial,user,pass)
	executeSQLQuery("INSERT INTO players_save(serial,user,pass) VALUES(?,?,?)",serial,user,pass)
end
function addPlayerxz(serial,user,pass)
	executeSQLQuery("INSERT INTO players_auto(serialx,userx,passx) VALUES(?,?,?)",serial,user,pass)
end

function isPlayerSave(serial)
	local sel = executeSQLQuery("SELECT serial FROM players_save WHERE serial=?",serial)
	if sel == 0 then
		return false
	else
		return true
	end
end
function isPlayerSavedAuto(serial)
	local sel = executeSQLQuery("SELECT serial FROM players_auto WHERE serialx=?",serial)
	if sel == 0 then
		return false
	else
		return true
	end
end

function getUserAndPass(serial)
	local user,pass = "",""
	if isPlayerSave(serial) then
		local sel = executeSQLQuery("SELECT * FROM players_save WHERE serial=?",serial)
		for i,player in ipairs(sel) do
			if i == 1 then
				user = player.user
				pass = player.pass
			end
		end
		return user,pass
	end
	return false
end

function getUsernameAndPassword(serial)
	local user,pass = "",""
	if isPlayerSavedAuto(serial) then
		local sel = executeSQLQuery("SELECT * FROM players_auto WHERE serial=?",serial)
		for i,player in ipairs(sel) do
			if i == 1 then
				userx = player.userx
				passx = player.passx
			end
		end
		return userx,passx
	end
	return false
end

addEvent("onGetSave",true)
addEventHandler("onGetSave",root,
	function ()
		local serial = getPlayerSerial(source)
		if isPlayerSave(serial) then
			local user,pass = getUserAndPass(serial)
			triggerClientEvent(source,"onPutSave",source,user,pass)
		end
    if isPlayerSavedAuto(serial) then
    local user,pass = getUsernameAndPassword(serial)
    logIn(source,user,pass)
    triggerClientEvent(source,"onCl",source)
    end
	end
)

addEvent("onLoginWith",true)
addEventHandler("onLoginWith",root,
	function (user,pass)
		local acc = getAccount(user,pass)
		local serial = getPlayerSerial(source)
		if acc then
			logIn(source,acc,pass)
			outputChatBox("* تم بنجاح تسجيل دخول",source,0,255,0)
			AddPlayer(serial,user,pass)
			triggerClientEvent(source,"onCl",source)
		else
			outputChatBox("* الحساب او كلمة المرور خطأ",source,255,0,0)
		end
	end
)

addEvent("onLogin",true)
addEventHandler("onLogin",root,
	function (user,pass)
		local acc = getAccount(user,pass)
		if acc then
			logIn(source,acc,pass)
			outputChatBox("* تم بنجاح تسجيل دخول",source,0,255,0)
			triggerClientEvent(source,"onCl",source)
            setElementData(source,"Password",""..pass.."")
		else
			outputChatBox("* الحساب او كلمة مرور خطأ",source,255,0,0)
		end
	end
)

addEvent("onReg",true)
addEventHandler("onReg",root,
	function (user,pass)
		local acc = getAccount(user,pass)
		if acc then
			outputChatBox("* هذا الحساب مستخدم من قبل",source,255,0,0)
		else
			addAccount(user,pass)
			outputChatBox("* Username = " .. user .. "",source,0,255,0)
			outputChatBox("* Password = " .. pass .. "",source,0,255,0)
		end
	end
)

addCommandHandler("auto",function(p)
local acc = getPlayerAccount(p)
if (  not isGuestAccount(acc) ) then
local serial = getPlayerSerial(p)
if ( not isPlayerSavedAuto(serial) ) then
local Data = getElementData(p,"Password")
local user = tostring(acc)
addPlayerxz(serial,user,Data)
outputChatBox("* تم تفعيل الميزة",p,0,255,0)
else
ouputChatBox("* لقد قمت بتفعيل الميزة من قبل",p,255,0,0)
end
else
outputChatBox("* عليك ان تسجل دخولك أولاً",p,255,0,0)
end
end )
addCommandHandler("unauto",function(p)
local acc = getPlayerAccount(p)
if (  not isGuestAccount(acc) ) then
local serial = getPlayerSerial(p)
if ( isPlayerSavedAuto(serial) ) then
executeSQLQuery("DELETE FROM players_auto WHERE serialx=?", serial)
outputChatBox("* تم إلغاء تفعيل الميزة",p,0,255,0)
else
outputChatBox("* هذه الميزة غير مفعلة",p,255,0,0)
end
else
outputChatBox("* عليك ان تسجل دخولك أولاً",p,255,0,0)
end
end )

NOTE : جرب الأول بعدين جرب الثاني

Link to comment

AbU - W6N

اخي لا الاول ولا الثاني ظبط :(

لما ادخل يجي لوحة التسجيل من تاني

+ لو ضغطت علي auto

يقول تم تفعيل الميزة من قبل

unauto يلغي الميزة 

اضغط auto تاني 

يقولي مفعلة من قبل وانا مافعلتها!

---------------------------------------------------------

الكود الاول يخلي اللوحة ماتيجي اصلا

دي بق

69:Bad argument @ 'login' [Expected account at argument 2, got nill]

Database query faild: no such column: serial

------------------------------------------------------------------------------------------------------

الكود الثاني اللوحة تيجي بس مافي auto

دي بق

bad argument #1 to 'ipairs' (table expected, got string)

Database query faild: no such column: serial

Database query faild: no such column: serial

Edited by SAM!!
Link to comment

MR.TOUNSI

محاولتي؟

خذ

executeSQLQuery("CREATE TABLE IF NOT EXISTS players_auto( serialx TEXT, userx TEXT, passx TEXT)")
executeSQLQuery("CREATE TABLE IF NOT EXISTS players_save( serial TEXT, user TEXT, pass TEXT)")
function AddPlayer(serial,user,pass)
	executeSQLQuery("INSERT INTO players_save(serial,user,pass) VALUES(?,?,?)",serial,user,pass)
end
function addPlayerxz(serial,user,pass)
	executeSQLQuery("INSERT INTO players_auto(serialx,userx,passx) VALUES(?,?,?)",serial,user,pass)
end
function isPlayerSave(serial)
	local sel = executeSQLQuery("SELECT serial FROM players_save WHERE serial=?",serial)
	if sel == 0 then
		return false
	else
		return true
	end
end
function isPlayerSavedAuto(serial)
	local sel = executeSQLQuery("SELECT serial FROM players_auto WHERE serialx=?",serial)
	if sel == 0 then
		return false
	else
		return true
	end
end
function getUserAndPass(serial)
	local user,pass = "",""
	if isPlayerSave(serial) then
		local sel = executeSQLQuery("SELECT * FROM players_save WHERE serial=?",serial)
		for i,player in ipairs(sel) do
			if i == 1 then
				user = player.user
				pass = player.pass
			end
		end
		return user,pass
	end
	return false
end
function getUsernameAndPassword(serial)
	local user,pass = "",""
	if isPlayerSavedAuto(serial) then
		local sel = executeSQLQuery("SELECT * FROM players_auto WHERE serial=?",serial)
		for i,player in ipairs(sel) do
			if i == 1 then
				userx = player.userx
				passx = player.passx
			end
		end
		return userx,passx
	end
	return false
end
addEvent("onGetSave",true)
addEventHandler("onGetSave",root,
	function ()
		local serial = getPlayerSerial(source)
		if isPlayerSave(serial) then
			local user,pass = getUserAndPass(serial)
			triggerClientEvent(source,"onPutSave",source,user,pass)
		end
    if isPlayerSavedAuto(serial) then
    local user,pass = getUsernameAndPassword(serial)
    logIn(source,user,pass)
    triggerClientEvent(source,"onCl",source)
    end
	end
)
addEvent("onLoginWith",true)
addEventHandler("onLoginWith",root,
	function (user,pass)
		local acc = getAccount(user,pass)
		local serial = getPlayerSerial(source)
		if acc then
			logIn(source,acc,pass)
			outputChatBox("* تم بنجاح تسجيل دخول",source,0,255,0)
			AddPlayer(serial,user,pass)
			triggerClientEvent(source,"onCl",source)
		else
			outputChatBox("* الحساب او كلمة المرور خطأ",source,255,0,0)
		end
	end
)
addEvent("onLogin",true)
addEventHandler("onLogin",root,
	function (user,pass)
		local acc = getAccount(user,pass)
		if acc then
			logIn(source,acc,pass)
			outputChatBox("* تم بنجاح تسجيل دخول",source,0,255,0)
			triggerClientEvent(source,"onCl",source)
            setElementData(source,"Password",""..pass.."")
		else
			outputChatBox("* الحساب او كلمة مرور خطأ",source,255,0,0)
		end
	end
)
addEvent("onReg",true)
addEventHandler("onReg",root,
	function (user,pass)
		local acc = getAccount(user,pass)
		if acc then
			outputChatBox("* هذا الحساب مستخدم من قبل",source,255,0,0)
		else
			addAccount(user,pass)
			outputChatBox("* Username = " .. user .. "",source,0,255,0)
			outputChatBox("* Password = " .. pass .. "",source,0,255,0)
		end
	end
)
addCommandHandler("auto",function(p)
local acc = getPlayerAccount(p)
if (  not isGuestAccount(acc) ) then
local serial = getPlayerSerial(p)
if ( not isPlayerSavedAuto(serial) ) then
local Data = getElementData(p,"Password")
local user = tostring(acc)
addPlayerxz(serial,user,Data)
outputChatBox("* تم تفعيل الميزة",p,0,255,0)
else
ouputChatBox("* لقد قمت بتفعيل الميزة من قبل",p,255,0,0)
end
else
outputChatBox("* عليك ان تسجل دخولك أولاً",p,255,0,0)
end
end )
addCommandHandler("unauto",function(p)
local acc = getPlayerAccount(p)
if (  not isGuestAccount(acc) ) then
local serial = getPlayerSerial(p)
if ( isPlayerSavedAuto(serial) ) then
executeSQLQuery("DELETE FROM players_auto WHERE serialx=?", serial)
outputChatBox("* تم إلغاء تفعيل الميزة",p,0,255,0)
else
outputChatBox("* هذه الميزة غير مفعلة",p,255,0,0)
end
else
outputChatBox("* عليك ان تسجل دخولك أولاً",p,255,0,0)
end
end )

وريني؟

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...