Jump to content

طلب كود


Recommended Posts

السلام عليكم شباب كيف الحال

اليوم انا حبيت اطلب كود

وهو اللي يحطلي الوقت في جريد لست

وهذي اكواد مود الساعات اللي عندي

 

 

سيرفر

 

 

------------------------------------------------------------------------------------
--  RIGHTS:      All rights reserved by developers
--  DEVELOPERS:  Oscar Ernesto (The'Oskar)
-- Don't Touch This or a Cat will Die D:!!!!!!!!
------------------------------------------------------------------------------------
call ( getResourceFromName ( "scoreboard" ), "scoreboardAddColumn", "Play Time" ) ---Export of ScoreBoard
 
addEventHandler ( "onResourceStart" , resourceRoot ,
    function ( )
        for index , player in ipairs ( getElementsByType ( "player" ) ) do
            local pAccount = getPlayerAccount ( player )
            if not isGuestAccount ( pAccount ) then
                local minutes = getAccountData ( pAccount , "Online.minutes" )
                if minutes then
                    local hours = getAccountData ( pAccount , "Online.hours" )
                    if # tostring ( minutes ) == 1 then
                        minutes = "0" .. minutes
                    end
                    if # tostring ( hours ) == 1 then
                        hours = "0" .. hours
                    end
                    setElementData ( player , "Play Time" , hours .. ":" .. minutes .. "" )
                    local timer = setTimer ( actualizarJugadorOn , 60000 , 1 , player )
                    setElementData ( player , "Online.timer" , timer )
                else
                    setAccountData ( pAccount , "Online.minutes" , 0 )
     
              setAccountData ( pAccount , "Online.hours" , 0 )
                    setElementData ( player , "Play Time" , "00:00 " )
                    local timer = setTimer ( actualizarJugadorOn , 60000 , 1 , player )
                    setElementData ( player , "Online.timer" , timer )
                end
            else
                setElementData ( player , "Play Time" , "N/A" )
            end
        end
    end
)
 
addEventHandler ( "onResourceStop" , resourceRoot ,
    function ( )
        for index , player in ipairs ( getElementsByType ( "player" ) ) do
            local pAccount = getPlayerAccount ( player )
            if not isGuestAccount ( pAccount ) then
                local timer = getElementData ( player , "Online.timer" )
                if isTimer ( timer ) then
                    killTimer ( timer )
                end
            end
        end
    end
)
 
addEventHandler ( "onPlayerLogin" , root ,
    function ( _ , pAccount )
        local minutes = getAccountData ( pAccount , "Online.minutes" )
        if minutes then
            local hours = getAccountData ( pAccount , "Online.hours" )
            if # tostring ( minutes ) == 1 then
                minutes = "0" .. minutes
            end
            if # tostring ( hours ) == 1 then
                hours = "0" .. hours
            end
            setElementData ( source , "Play Time" , hours .. ":" .. minutes .. "" )
            local timer = setTimer ( actualizarJugadorOn , 60000 , 1 , source )
            setElementData ( source , "Online.timer" , timer )
        else
            setAccountData ( pAccount , "Online.minutes" , 0 )
            setAccountData ( pAccount , "Online.hours" , 0 )
            setElementData ( source , "Play Time" , "00:00" )
            local timer = setTimer ( actualizarJugadorOn , 60000 , 1 , source )
            setElementData ( source , "Online.timer" , timer )
        end
    end
)
 
addEventHandler ( "onPlayerLogout" , root ,
    function ( pAccount )
        local timer = getElementData ( source , "Online.timer" )
        if isTimer ( timer ) then
            killTimer ( timer )
        end
    end
)
 
addEventHandler ( "onPlayerJoin" , root ,
    function ( )
        setElementData ( source , "Play Time" , "N/A" )
    end
)
 
addEventHandler ( "onPlayerQuit" , root ,
    function ( )
        local pAccount = getPlayerAccount ( source )
        if not isGuestAccount ( pAccount ) then
            local timer = getElementData ( source , "Online.timer" )
            if isTimer ( timer ) then
                killTimer ( timer )
            end
        end
    end
)
 
function actualizarJugadorOn ( player )
    local pAccount = getPlayerAccount ( player )
    local minutes = getAccountData ( pAccount , "Online.minutes" )
    local hours = getAccountData ( pAccount , "Online.hours" )
    minutes = tostring ( tonumber ( minutes ) + 1 )
    if minutes == "60" then
        hours = tostring ( tonumber ( hours ) + 1 )
        minutes = "00"
    end
    setAccountData ( pAccount , "Online.minutes" , tonumber ( minutes ) )
    setAccountData ( pAccount , "Online.hours" , tonumber ( hours ) )
    if # tostring ( minutes ) == 1 then minutes = "0" .. minutes end
    if # tostring ( hours ) == 1 then hours = "0" .. hours end
    setElementData ( player , "Play Time" , hours .. ":" .. minutes .. "" )
    local timer = setTimer ( actualizarJugadorOn , 60000 , 1 , player )
    setElementData ( player , "Online.timer" , timer )
end

@3NAD 

 

 

اما اكواد التوب تايم

 

كلنت سايد

 

 

local Key = "F7" --- bind key

HD = {
    gridlist = {},
    S3D = {},
    q = {}
}

function centerWindow(center_window)
    local screenW,screenH=guiGetScreenSize()
    local windowW,windowH=guiGetSize(center_window,false)
    local x,y = (screenW-windowW)/2,(screenH-windowH)/2
    guiSetPosition(center_window,x,y,false)
end

HD.wnd = guiCreateWindow(415, 146, 450, 505, "TOP Players", false)
guiWindowSetSizable(HD.wnd, false)
guiSetAlpha(HD.wnd, 1.00)
guiSetProperty(HD.wnd, "CaptionColour", "FF200AF3")
centerWindow(HD.wnd)
HD.gridlist[1] = guiCreateGridList(18, 32, 430, 500, false, HD.wnd)
local column = guiGridListAddColumn(HD.gridlist[1], "Rank", 0.20 ) -- Create a 'rank' column in the list
local column1 = guiGridListAddColumn(HD.gridlist[1], "Player Name", 0.40 )
local column3 = guiGridListAddColumn(HD.gridlist[1], "Time", 0.30 )
 -- Create a 'players' column in the list
local column2 = guiGridListAddColumn(HD.gridlist[1], "Total Drift", 0.30 ) -- Create a 'Total Drift' column in the list
for i = 1,30 do
local row = guiGridListAddRow ( HD.gridlist[1] )
guiGridListSetItemText ( HD.gridlist[1], row, column, "" .. i .. "-", false, false )
guiGridListSetItemText ( HD.gridlist[1], row, column1, "N/A", false, false )
guiGridListSetItemText ( HD.gridlist[1], row, column2, "N/A", false, false )
guiGridListSetItemText ( HD.gridlist[1], row, column3, "N/A", false, false )

guiGridListSetItemColor(HD.gridlist[1], row, column1, 255, 255, 0)
guiGridListSetItemColor(HD.gridlist[1], row, column2, 0, 180, 255)
guiGridListSetItemColor(HD.gridlist[1], row, column, 255, 0, 0)
end
guiSetVisible(HD.wnd, not guiGetVisible(HD.wnd))

bindKey (Key, "down",
	function()
		guiSetVisible(HD.wnd, not guiGetVisible(HD.wnd))
		showCursor(guiGetVisible(HD.wnd))
		triggerServerEvent("getTop", localPlayer)
	end
)

function convertNumber ( number )  
	local formatted = number  
	while true do      
		formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')    
		if ( k==0 ) then      
			break   
		end  
	end  
	return formatted
end

function updateTopList(name, top, i)
local row = guiGridListAddRow ( HD.gridlist[1] )
guiGridListSetItemText ( HD.gridlist[1], row, column, "" .. i .. "-", false, false )
guiGridListSetItemText ( HD.gridlist[1], row, column1, tostring(name), false, false )
guiGridListSetItemText ( HD.gridlist[1], row, column2, convertNumber(top), false, false )
guiGridListSetItemColor(HD.gridlist[1], row, column1, 255, 255, 0)
guiGridListSetItemColor(HD.gridlist[1], row, column2, 0, 180, 255)
guiGridListSetItemColor(HD.gridlist[1], row, column, 255, 0, 0)
end
addEvent("updateTop", true)
addEventHandler("updateTop", root, updateTopList)

function update()
guiGridListClear(HD.gridlist[1])
end
addEvent("deltTop", true)
addEventHandler("deltTop", root, update)

سيرفر سايد

 

 

drift_mejor = 0
addEventHandler( 'onResourceStart', getResourceRootElement(getThisResource()),
	function( )
		
		executeSQLQuery( 'CREATE TABLE IF NOT EXISTS Drift_top_byS3Dd (Owner, Score, Name)' )
	end
)

function getPlayerFromNamePart(name)
    if name then 
        for i, player in ipairs(getElementsByType("player")) do
            if string.find(getPlayerName(player):lower(), tostring(name):lower(), 1, true) then
                return player 
            end
        end
    end
    return false
end

function createTopSystem( player )
	if not isElement( player ) then
		return
	end
	local Top = {}
	local CreatTop = executeSQLQuery( "SELECT * FROM Drift_top_byS3Dd" )
	for i = 1, #CreatTop do
		table.insert(Top,{name = CreatTop[i].Name,score = CreatTop[i].Score})
	end
	if #CreatTop >0 then
		table.sort(Top, function(a,b) return (tonumber(a.score)or 0) > (tonumber(b.score)or 0) end)
	setTimer(
	function()
		for k, data in ipairs(Top) do
			if k == 1 then
				triggerClientEvent (player,"deltTop",player)
			end	
			triggerClientEvent (player,"updateTop",player,tostring(data.name),tostring(data.score),tonumber(k))
			if k == 30 then
					table.remove(Top)
				break
			end
		end
	end,
		500,
	1
	)
	end
end

function setAcontSqlData( player, top, name)
	if not isElement( player ) then
		return
	end
    if isGuestAccount ( getPlayerAccount ( player ) ) then return end
	result = executeSQLQuery("SELECT * FROM `Drift_top_byS3Dd` WHERE `Owner`=?", getAccountName(getPlayerAccount( player )))
	if ( type ( result ) == "table" and #result == 0 ) or not result then
		executeSQLQuery( 'INSERT INTO Drift_top_byS3Dd( Owner, Score , Name) VALUES( ?, ?, ? )', getAccountName(getPlayerAccount( player )), top, name)
	else
		if tonumber ( top ) < tonumber( result[1]["Score"] ) then top = result[1]["Score"] else top = top end
		executeSQLQuery( 'UPDATE Drift_top_byS3Dd SET Score =?,Name =? WHERE Owner =?', top, name, getAccountName(getPlayerAccount( player )))
	end
end

addEvent("driftNuevoRecord", true)
addEventHandler("driftNuevoRecord", root, 
	function(score, name)
		drift_mejor = score
		drift_nombre = getPlayerFromNamePart(name)
		setAcontSqlData( drift_nombre, drift_mejor, name)
	end
)

addEventHandler("onElementDataChange",root,
	function (data)
		if ( data == "Best Drift" ) and getElementType(source) == "player" then
			local drift = getElementData(source,data)
			setAcontSqlData( source, tonumber(drift), string.gsub(getPlayerName(source), "#%x%x%x%x%x%x", ""))
		end			
	end
)

addEvent("getTop", true)
addEventHandler("getTop", root, 
	function()
		createTopSystem( source )
	end
)

@!#NssoR_)

 

Edited by Master_MTA
Link to comment
On ١١‏/٢‏/١٤٣٨ هـ at 1:44 AM, Default said:

انت هنا تبي وقت واشوف التوبات حق سعد

الي هو الدرفت .

يب اخوي ضفت كولم عليه

وسويت اسمه تايم

انا ابي يجيب اوقات اللاعبين مع التوب اتمنى تكون فهمتو علي

@Default

@MR.Mosa

Edited by Master_MTA
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...