#Soking Posted May 29, 2016 Share Posted May 29, 2016 السسلآم عليكم ورحمة الله وبركاتهه , اليوم قررت اسوي كود بسيط للحفظ عبر استخدام SQLite الكود يحفظ لك الاحدثيات + الشخصيه + الففلوس يقدر يساعد اصحاب سيرفرات الزومبي + الهجوله + الحياه الواقعيه وغيره Server Side executeSQLQuery( ' CREATE TABLE IF NOT EXISTS `TablSave` (Serial, Money,Skin,Rotaion, xPos, yPos, zPos) ' ) function onSave( ) local checkData = executeSQLQuery( ' SELECT * FROM `TablSave` WHERE Serial = ? ', getPlayerSerial(source) ) local Money, Skin, Rotaion, xPos ,yPos , zPos = getPlayerMoney(source), getElementModel(source), getPedRotation(source), getElementPosition(source) if ( type ( checkData ) == 'table' and #checkData == 0 or not checkData ) then executeSQLQuery( ' INSERT INTO `TablSave` (Serial, Money, Skin, Rotaion, xPos ,yPos , zPos) VALUES(?, ?, ?, ?, ?, ?, ?) ', getPlayerSerial(source), Money ,Skin ,Rotaion ,xPos ,yPos , zPos) else local Money, Skin, Rotaion, xPos ,yPos , zPos = getPlayerMoney(source), getElementModel(source), getPedRotation(source), getElementPosition(source) executeSQLQuery( ' UPDATE`TablSave` SET Serial = ?, Money = ?, Skin = ?, Rotaion = ?, xPos = ?, yPos = ?, zPos = ? ', getPlayerSerial(source), Money ,Skin ,Rotaion ,xPos ,yPos , zPos) end end addEventHandler('onPlayerQuit',getRootElement(),onSave) addEventHandler('onPlayerLogout',getRootElement(),onSave) addEventHandler( 'onPlayerLogin', root, function( ) local Save = executeSQLQuery( ' SELECT * FROM `TablSave` WHERE Serial = ? ', getPlayerSerial(source) ) if ( type ( Save ) == 'table' and #Save == 0 or not Save ) then return end local Money, Skin, Rotaion, xPos ,yPos ,zPos = Save[1]['Money'],Save[1]['Skin'],Save[1]['Rotaion'],Save[1]['xPos'],Save[1]['yPos'],Save[1]['zPos'] setElementPosition(source,xPos, yPos, zPos) givePlayerMoney( source , Money ) outputChatBox ( 'Welcome',source,255,255,255,true ) setElementModel(source,Skin) setPedRotation( source , Rotaion) removePedFromVehicle(source) end ) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now