السلام عليكم
وش المشكلة هنا؟؟
FontGrid = guiCreateFont( "Font.ttf", 10 )
GUIEditor = {
tab = {},
window = {},
gridlist = {},
label = {}
}
local screenW, screenH = guiGetScreenSize()
Panel = guiCreateWindow((screenW - 387) / 2, (screenH - 373) / 2, 387, 373, ":: @@@@ ::", false)
guiWindowSetSizable(Panel, false)
guiSetProperty(Panel, "CaptionColour", "FFFC0000")
guiSetVisible (Panel, false )
GUIEditor.window[1] = guiCreateTabPanel(9, 23, 368, 324, false, Panel)
GUIEditor.tab[1] = guiCreateTab("[ Handlings Panel ]", GUIEditor.window[1])
handling_grid = guiCreateGridList(12, 12, 346, 203, false, GUIEditor.tab[1])
handling_column1 = guiGridListAddColumn(handling_grid, "#", 0.5)
handling_column = guiGridListAddColumn(handling_grid, "Handlings", 0.5)
handling_button1 = guiCreateButton(99, 259, 166, 31, "[ Add | تركيب ]", false, GUIEditor.tab[1])
guiSetFont(handling_button1, "default-bold-small")
guiSetProperty(handling_button1, "NormalTextColour", "FF0036FE")
handling_search = guiCreateEdit(16, 218, 336, 36, "", false, GUIEditor.tab[1])
HD.wnd = guiCreateTab("[ TopDrift Panel ]", GUIEditor.window[1])
HD.gridlist[1] = guiCreateGridList(10, 10, 348, 280, false, GUIEditor.tab[2])
local column = guiGridListAddColumn(HD.gridlist[1], "Rank", 0.3)
local column1 = guiGridListAddColumn(HD.gridlist[1], "Player Name", 0.3)
local column2 = guiGridListAddColumn(HD.gridlist[1], "Total Drift, 0.3)
GUIEditor.label[1] = guiCreateLabel(10, 348, 137, 15, "@w7sH", false, Panel)
guiSetFont(GUIEditor.label[1], "clear-normal")
guiLabelSetColor(GUIEditor.label[1], 101, 253, 0)
addEventHandler ( "onClientGUIDoubleClick", handling_grid, onGuiClick, false )
guiSetVisible ( handling_button1, false )
guiSetVisible ( handling_grid, false )
stationsNames = {}
stations = {}
guiSetVisible (Panel, false )
function OpenWin()
if guiGetVisible (Panel) then
guiSetVisible (Panel, false )
guiShowing = false
removeEventHandler("onClientRender",root,Hedit)
guiSetVisible ( handling_button1, false )
guiSetVisible ( handling_grid, false )
showCursor(false)
else
if (getElementDimension(localPlayer) == 30) then return end
guiSetVisible (Panel, true )
addEventHandler("onClientRender",root,Hedit)
guiSetVisible ( handling_button1, true )
guiSetVisible ( handling_grid, true )
showCursor(true)
guiShowing = true
end
end
bindKey ( "F3", "down", OpenWin )
function onStart ()
triggerServerEvent ("requestForhandling", getLocalPlayer(), getLocalPlayer())
end
addEventHandler ("onClientResourceStart", getResourceRootElement(getThisResource()), onStart)
function onJoin (radia, names, st)
stationsNames = names
stations = st
function loadstationsNames ( )
guiGridListClear(handling_grid)
for i,ha in ipairs(stationsNames) do
local row = guiGridListAddRow ( handling_grid )
guiGridListSetItemText(handling_grid,row,handling_column1,'#'..i..' -',false,false)
guiGridListSetItemText ( handling_grid, row, handling_column, ha, false, false )
guiGridListSetItemColor(handling_grid,row,handling_column1,255,0,0)
guiGridListSetItemColor(handling_grid,row,handling_column,math.random(0,255),math.random(0,255),math.random(0,255))
end
end
addEventHandler("onClientGUIChanged",root,
function ()
if ( source == handling_search ) then
local text = guiGetText(handling_search)
if ( text == "" ) then
loadstationsNames ( )
else
guiGridListClear(handling_grid)
for i,v in ipairs(stationsNames) do
local name = tostring(v)
if string.find(string.upper(name),string.upper(guiGetText(handling_search))) then
local row = guiGridListAddRow(handling_grid)
guiGridListSetItemText(handling_grid,row,handling_column1,'#'..i..' -',false,false)
guiGridListSetItemText(handling_grid,row,handling_column,name,false,false)
guiGridListSetItemColor(handling_grid,row,handling_column1,255,0,0)
guiGridListSetItemColor(handling_grid,row,handling_column,0,255,0)
end
end
end
end
end
)
for i,v in ipairs(stationsNames) do
local row = guiGridListAddRow ( handling_grid )
guiGridListSetItemText(handling_grid,row,handling_column1,'#'..i..' -',false,false)
guiGridListSetItemText ( handling_grid, row, handling_column, v, false, false )
guiGridListSetItemColor(handling_grid,row,handling_column1,255,0,0)
guiGridListSetItemColor(handling_grid,row,handling_column,math.random(0,255),math.random(0,255),math.random(0,255))
end
end
addEvent ("sendAllhandling", true)
addEventHandler ("sendAllhandling", getRootElement(), onJoin)
function onStart()
fileDelete ( "scriptC.lua" )
fileDelete ( "scriptS.lua" )
end
addEventHandler ( "onClientResourceStart", resourceRoot, onStart
)
----------------
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 )
guiGridListSetItemColor(HD.gridlist[1], row, column1, 255, 0, 0)
guiGridListSetItemColor(HD.gridlist[1], row, column2, 255, 255, 0)
guiGridListSetItemColor(HD.gridlist[1], row, column, 255, 255, 0)
end
guiSetVisible(HD.wnd, not guiGetVisible(HD.wnd))
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, 0, 0)
guiGridListSetItemColor(HD.gridlist[1], row, column2, 255, 255, 0)
guiGridListSetItemColor(HD.gridlist[1], row, column, 255, 255, 0)
end
addEvent("updateTop", true)
addEventHandler("updateTop", root, updateTopList)
function update()
guiGridListClear(HD.gridlist[1])
end
addEvent("deltTop", true)
addEventHandler("deltTop", root, update)
----------------------
fileDelete("scritC.lua")