Jump to content

= [ مشكله ] =


Recommended Posts

لدي مشكله في السكا

لما اطلع وادخل  ماتحفظ الفل

آلآكواد 

addEventHandler('onResourceStart',resourceRoot, 
    function (      ) 
         CreateTable = executeSQLQuery ('CREATE TABLE IF NOT EXISTS  `Save LeveL System` (Account,Data1,Data2) ') 
    end 
) 



exports.scoreboard:addScoreboardColumn('KillS')
exports.scoreboard:addScoreboardColumn('LeVeL')

Tabel = {} 

addEventHandler ( "onPlayerJoin", root,
function() 
setElementData(source, "KillS", 0)
setElementData(source, "LeVeL", 0)
end
)

addEventHandler( 'onPlayerWasted', root,
function(_,Kill)
	if Kill ~= source and getElementType(Kill) == 'player' then
		local Killer = getPlayerAccount(Kill)
			if (Killer) then
				setElementData(Kill, "KillS", (getElementData(Kill, "KillS") or 0) + 1)
				if (getElementData(Kill, "KillS") == 25 ) then
				setElementData(Kill, "LeVeL", (getElementData(Kill, "LeVeL") or 0) + 1)
				end
			end
		end
	end
)

addEventHandler('onPlayerQuit',root, 
    function (  ) 
	

	
    local _LeveL = executeSQLQuery("SELECT * FROM `Save LeveL System` WHERE Account=?",getPlayerAccount(source) ) 
     if ( type ( _LeveL) == "table" and #_LeveL == 0 or not _LeveL ) then 
        executeSQLQuery ( "INSERT INTO `Save Position System` ( Account,Data1,Data2 ) VALUES(?,?,?)",getPlayerAccount(source),getElementData(Kill, "KillS") or 0,getElementData(Kill, "LeVeL") or 0 ) 
    else 
        executeSQLQuery('UPDATE `Save LeveL System` SET Data1 =?, Data2 =? WHERE Account =?',(getElementData(Kill, "KillS") or 0),(getElementData(Kill, "LeVeL") or 0),getPlayerAccount(source) ) 
    end 
end 
) 
addEventHandler('onPlayerLogin',root, 
    function (  ) 
        local _LeveL = executeSQLQuery("SELECT * FROM `Save LeveL System` WHERE Account=?",getPlayerAccount(source) ) 
        if ( type ( _LeveL ) == "table" and #_LeveL == 0 or not _LeveL ) then return end 
		
		  setElementData(source, "KillS", Data1 or 0)
			setElementData(source, "LeVeL", Data2 or 0)
	end
) 





 

Edited by back!_
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...