يب مجربها اقولك الخطأ من البرمجة بس مدري وش هو
------------------------------------------------------------------------------------ \
ذا ملف السيرفر + الديبق ما يقول شئ
-- Login Register System
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("* You Have Been Successfuly Login",source,0,255,0)
exports["notices"]:addNotification(root,"تم تسجيل الدخول بنجاح",'success');
AddPlayer(serial,user,pass)
triggerClientEvent(source,"onCl",source)
else
--outputChatBox("* Worng Username Or Password",source,255,0,0)
exports["notices"]:addNotification(root,"كلمة المرور او اسم المستخدم غير صحيحة",'error');
end
end
)
addEvent("onLogin",true)
addEventHandler("onLogin",root,
function (user,pass)
local acc = getAccount(user,pass)
if acc then
logIn(source,acc,pass)
--outputChatBox("* You Have Been Successfuly Login",source,0,255,0)
exports["notices"]:addNotification(root,"تم تسجيل الدخول بنجاح",'success');
triggerClientEvent(source,"onCl",source)
else
--outputChatBox("* Worng Username Or Password",source,255,0,0)
exports["notices"]:addNotification(root,"كلمة المرور او اسم المستخدم غير صحيحة",'error');
end
end
)
addEvent("onReg",true)
addEventHandler("onReg",root,
function (user,pass)
local acc = getAccount(user,pass)
if acc then
exports.killmessages:outputMessage("* This Account is Already Exist",source,255,0,0)
exports["notices"]:addNotification(root,"هذا الحساب موجود بالفعل",'warning');
else
addAccount(user,pass)
--outputChatBox("* Username = " .. user .. "",source,0,255,0)
--outputChatBox("* Password = " .. pass .. "",source,0,255,0)
exports["notices"]:addNotification(root,"تم تسجيل حساب جديد بنجاح قم بتسجيل الدخول الان",'success');
end
end
)
-- End
addEvent( 'SpawnPlayerInSelectedSettinges', true )
addEventHandler( 'SpawnPlayerInSelectedSettinges', root,
function()
local xSpawn, ySpawn, zSpawn = unpack(getElementData(source, 'POSITION'))
local PlayerSkin = getElementData(source, 'SKIN')
local randomX = math.random(1, 10) - math.random(1, 10)
local randomY = math.random(1, 10) - math.random(1, 10)
spawnPlayer(source, xSpawn + randomX, ySpawn + randomY, zSpawn)
setElementModel(source, PlayerSkin)
fadeCamera(source, true)
end
)
addEventHandler( 'onPlayerWasted', root,
function()
setElementData(source, 'Wasted?', true)
local xSpawn, ySpawn, zSpawn = unpack(getElementData(source, 'POSITION'))
local PlayerSkin = getElementData(source, 'SKIN')
local randomX = math.random(1, 10) - math.random(1, 10)
local randomY = math.random(1, 10) - math.random(1, 10)
spawnPlayer(source, xSpawn + randomX, ySpawn + randomY, zSpawn)
setElementModel(source, PlayerSkin)
setElementData(source, 'Wasted?', false)
end
)
addEvent( 'setPositionData', true )
addEventHandler( 'setPositionData', root,
function(PlaceName, xSpawn, ySpawn, zSpawn)
setElementData(source, 'POSITION', false)
setElementData(source, 'POSITION', {xSpawn, ySpawn, zSpawn})
local PlaceName = string.gsub(PlaceName, '[A-Z-a-z]', '')
exports["notices"]:addNotification(root," المكان الذي قمت بأختياره هو" .. PlaceName .. "",'info');
end
)
addEvent( 'setSkinData', true )
addEventHandler( 'setSkinData', root,
function(SkinID)
setElementData(source, 'SKIN', false)
setElementData(source, 'SKIN', SkinID)
exports["notices"]:addNotification(root," الشخصية الخاصة بك هي " .. SkinID .. "",'info');
end
)