Jump to content

---


Mr.Mostafa

Recommended Posts

سلام عليكم

ابي اجيب افضل 3 لاعبين بالمهمة علي حسب النقاط

يتربتو بالترتيب علي حسب النقاط يعني

وسويت هذة الطريقة وشغالة عادي , لكن ابي طريقة اسهل من هادي

عشان لو ابي مثلا اسويها توب 10 ما احتاج اسوي elseif عشر مرآت


local data1 = getElementData(resourceRoot,"topP1") or "N/A"
local data2 = getElementData(resourceRoot,"topP2") or "N/A"
local data3 = getElementData(resourceRoot,"topP3") or "N/A"
local points1 = getElementData(resourceRoot,"topPo1") or "N/A"
local points2 = getElementData(resourceRoot,"topPo2") or "N/A"
local points3 = getElementData(resourceRoot,"topPo3") or "N/A"

addEventHandler("onClientRender", root,
    function()
        dxDrawLine(10 - 1, 255 - 1, 10 - 1, 442, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(258, 255 - 1, 10 - 1, 255 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(10 - 1, 442, 258, 442, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(258, 442, 258, 255 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawRectangle(10, 255, 248, 187, tocolor(130, 124, 124, 150), false)
        dxDrawText("Top 3 Wins On Mission", 69 + 1, 265 + 1, 200 + 1, 282 + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("Top 3 Wins On Mission", 69, 265, 200, 282, tocolor(0, 254, 245, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ", 10 + 1, 282 + 1, 258 + 1, 300 + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ", 10, 282, 258, 300, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("Players", 55 + 1, 300 + 1, 99 + 1, 318 + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("Players", 55, 300, 99, 318, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("Points", 173 + 1, 300 + 1, 216 + 1, 318 + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("Points", 173, 300, 216, 318, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ", 10 + 1, 318 + 1, 258 + 1, 337 + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ", 10, 318, 258, 337, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
		dxDrawRectangle(125, 293, 2, 150, tocolor(0, 0, 0, 255), false)
        dxDrawText("1 -", 14 + 1, 338 + 1, 31 + 1, 358 + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("1 -", 14, 338, 31, 358, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("2 -", 14 + 1, 374 + 1, 31 + 1, 394 + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("2 -", 14, 374, 31, 394, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("3 -", 14 + 1, 412 + 1, 31 + 1, 432 + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("3 -", 14, 412, 31, 432, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText(""..data1.."", 33 + 1, 339 + 1, 123 + 1, 358 + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText(""..data1.."", 33, 339, 123, 358, tocolor(68, 254, 11, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText(""..data2.."", 33 + 1, 374 + 1, 123 + 1, 393 + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText(""..data2.."", 33, 374, 123, 393, tocolor(255, 255, 0, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText(""..data3.."", 33 + 1, 413 + 1, 123 + 1, 432 + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText(""..data3.."", 33, 413, 123, 432, tocolor(255, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText(""..points1.."", 151 + 1, 339 + 1, 241 + 1, 358 + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText(""..points1.."", 151, 339, 241, 358, tocolor(68, 254, 11, 255), 1.00, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText(""..points2.."", 151 + 1, 374 + 1, 241 + 1, 393 + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText(""..points2.."", 151, 374, 241, 393, tocolor(240, 255, 11, 255), 1.00, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText(""..points3.."", 151 + 1, 413 + 1, 241 + 1, 432 + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "top", false, false, false, false, false)
        dxDrawText(""..points3.."", 151, 413, 241, 432, tocolor(255, 0, 0, 255), 1.00, "default-bold", "center", "top", false, false, false, false, false)
    end
)
-- by rock

addEventHandler ( "onResourceStart" , resourceRoot , function ( ) 
    local players, topPlayers = getElementsByType'player', {};
    for index = 1, #players do
        local data = getAccountData ( getPlayerAccount ( players[index] ) , "missionPoints" ) or 0
		
        if data then
            topPlayers[#topPlayers+1] = {player = players[index], playerData = data};
        end
    end

    table.sort(topPlayers, function(first, second)
        return first.playerData > second.playerData
    end)

    for index = 1, #topPlayers do
	if index == 1 then
		name = string.gsub(getPlayerName(topPlayers[index].player), "#%x%x%x%x%x%x", "")
		setElementData(resourceRoot,"topP1",name)
		setElementData(resourceRoot,"topPo1",getAccountData ( getPlayerAccount ( topPlayers[index].player ) , "missionPoints" ))
	elseif index == 2 then
		name = string.gsub(getPlayerName(topPlayers[index].player), "#%x%x%x%x%x%x", "")
		setElementData(resourceRoot,"topP2",name)
		setElementData(resourceRoot,"topPo2",getAccountData ( getPlayerAccount ( topPlayers[index].player ) , "missionPoints" ))
	elseif index == 3 then
		name = string.gsub(getPlayerName(topPlayers[index].player), "#%x%x%x%x%x%x", "")
		setElementData(resourceRoot,"topP3",name)
		setElementData(resourceRoot,"topPo3",getAccountData ( getPlayerAccount ( topPlayers[index].player ) , "missionPoints" ))
	break
        end
    end
end
)

 

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...