Jump to content

تعلم الـ SQLite


Recommended Posts

السلام عليكم ورحمه الله وبركاته

آحببت اليوم آن آتعلم ال

SQLite

قرأت بعض الشروحات عنهآ

وقلت آسوي سكربت حفظ فلوس اللاعب ع السيريال بأستخدام SQLite

لاكن ماضبط

  
addEventHandler ("onResourceStart",resourceRoot, 
function (  ) 
local Create = executeSQLQuery("CREATE TABLE IF NOT EXISTS `SAVE_MONEY` (PlayerMoney,PlayerSerial)") 
if ( Create ) then 
outputDebugString ("Create [ SAVE_MONEY ] Started") 
     end 
 end 
) 
  
addEventHandler ("onPlayerQuit",root, 
function (  ) 
local TheMoney = getPlayerMoney ( source ) 
local Select = executeSQLQuery("SELECT * FROM `SAVE_MONEY` WHERE PlayerSerial=?",getPlayerSerial ( source )) 
if ( type ( Select ) == "table" and #Select == 0 or not Select ) then 
executeSQLQuery("INSERT INTO `SAVE_MONEY`(PlayerSerial,PlayerMoney) VALUES(?,?,?)",getPlayerSerial ( source ) , TheMoney) 
else 
executeSQLQuery("UPDATE `SAVE_MONEY` SET PlayerMoney = ? WHERE PlayerSerial=?", TheMoney,getPlayerSerial ( source )) 
end 
end 
) 
  
addEventHandler ("onPlayerLogin",root, 
function (  ) 
local Select = executeSQLQuery("SELECT * FROM `SAVE_MONEY` WHERE PlayerSerial=?",getPlayerSerial ( source )) 
 if ( type ( Results ) == "table" and #Results == 0 or not Results ) then return end 
 setPlayerMoney (source,Select[1]["PlayerMoney"]) 
 end 
 ) 
  
  

لا شيء بالدي بق غير الملاحظة التي وضعتها عند أنشاء التيبل

outputDebugString ("Create [ SAVE_MONEY ] Started") 

^

Link to comment

executeSQLQuery("INSERT INTO `SAVE_MONEY`(PlayerSerial,PlayerMoney) VALUES(?,?,?)",getPlayerSerial ( source ) , TheMoney) 

الى

executeSQLQuery("INSERT INTO `SAVE_MONEY`(PlayerSerial,PlayerMoney) VALUES(?,?)",getPlayerSerial ( source ) , TheMoney) 

+

انت حاطه اذ سجل دخوله يعطيه الفلوس

Link to comment
executeSQLQuery("INSERT INTO `SAVE_MONEY`(PlayerSerial,PlayerMoney) VALUES(?,?,?)",getPlayerSerial ( source ) , TheMoney) 

الى

executeSQLQuery("INSERT INTO `SAVE_MONEY`(PlayerSerial,PlayerMoney) VALUES(?,?)",getPlayerSerial ( source ) , TheMoney) 

ما ضبط

انت حاطه اذ سجل دخوله يعطيه الفلوس

هذا المطلوب

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