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
)