GUIEditor = {
checkbox = {},
staticimage = {},
edit = {},
button = {},
window = {},
label = {},
gridlist = {}
}
--addEventHandler("onClientRender", root,
function GUIEditor.window[1] ()
dxDrawRectangle(238, 68, 802, 623, tocolor(1, 0, 0, 255), false)
dxDrawRectangle(238, 13, 798, 55, tocolor(6, 67, 66, 255), false)
end
)
function ()
GUIEditor.gridlist[1] = guiCreateGridList(241, 74, 407, 607, false, GUIEditor.window[1])
local PlayerName = guiGridListAddColumn(GUIEditor.gridlist[1], "آسـم الاعــب", 0.4)
local PlayerTime = guiGridListAddColumn(GUIEditor.gridlist[1], "ســآعآآت", 0.4)
GUIEditor.edit[1] = guiCreateEdit(812, 538, 111, 48, "", false, GUIEditor.window[1])
GUIEditor.label[1] = guiCreateLabel(741, 409, 112, 25, "عدد الساعات :", false, GUIEditor.window[1])
GUIEditor.checkbox[1] = guiCreateCheckBox(648, 282, 98, 31, "تــحــديــد آلــكــل", false, false, GUIEditor.window[1])
GUIEditor.button[1] = guiCreateButton(822, 465, 96, 45, "إعطاء ساعات", false, GUIEditor.window[1])
guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FF00FF00")
GUIEditor.button[2] = guiCreateButton(675, 465, 96, 45, "ســحــب ساعات", false, GUIEditor.window[1])
guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFFF0000")
GUIEditor.edit[2] = guiCreateEdit(675, 93, 351, 42, "بــحــث ....", false, GUIEditor.window[1])
GUIEditor.label[2] = guiCreateLabel(695, 100, 302, 25, "_______________________________________________________________________________________________________________________", false, GUIEditor.window[1])
guiSetFont(GUIEditor.label[2], "default-bold-small")
guiLabelSetColor(GUIEditor.label[2], 255, 0, 0)
GUIEditor.label[3] = guiCreateLabel(665, 545, 100, 31, "كـلمـة التوزيع", false, GUIEditor.window[1])
GUIEditor.edit[3] = guiCreateEdit(660, 538, 111, 48, "", false, GUIEditor.window[1])
GUIEditor.label[4] = guiCreateLabel(815, 544, 98, 32, "آلــســآآعــآآت :", false, GUIEditor.window[1])
GUIEditor.edit[4] = guiCreateEdit(812, 538, 111, 48, "", false, GUIEditor.window[1])
GUIEditor.button[3] = guiCreateButton(749, 592, 95, 46, "مـوآفــق", false, GUIEditor.window[1])
guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FF00FF00")
GUIEditor.edit[5] = guiCreateEdit(751, 643, 98, 43, "", false, GUIEditor.window[1])
GUIEditor.label[5] = guiCreateLabel(755, 647, 84, 34, "مـددة الـتوزيـع....", false, GUIEditor.window[1])
GUIEditor.staticimage[1] = guiCreateStaticImage(776, 176, 221, 158, "logo.png", false, GUIEditor.window[1])
end
addEventHandler("onClientResourceStart", resourceRoot,cr)
addEventHandler("onClientGUIClick",root,
function ()
if source == GUIEditor.checkbox[1] then
if guiCheckBoxGetSelected(source) then
guiGridListSetSelectedItem(GUIEditor.gridlist[1],-1,-1)
end
elseif source == GUIEditor.gridlist[1] then
if guiCheckBoxGetSelected(GUIEditor.checkbox[1]) then
guiCheckBoxSetSelected(GUIEditor.checkbox[1],false)
end
elseif source == GUIEditor.edit[2] then
if guiGetText(source) == "بــحــث ...." then
guiSetText(source,"")
end
elseif source == GUIEditor.button[1] and guiGetText(GUIEditor.edit[1]) ~= "" and tonumber(guiGetText(GUIEditor.edit[1])) then
if guiCheckBoxGetSelected(GUIEditor.checkbox[1]) then
triggerServerEvent("addTime",root,"all",tonumber(guiGetText(GUIEditor.edit[1])))
else
triggerServerEvent("addTime",root,guiGridListGetItemText(GUIEditor.gridlist[1],guiGridListGetSelectedItem(GUIEditor.gridlist[1]),1),tonumber(guiGetText(GUIEditor.edit[1])))
end
elseif source == GUIEditor.button[2] and guiGetText(GUIEditor.edit[1]) ~= "" and tonumber(guiGetText(GUIEditor.edit[1])) then
showCursor(not guiGetVisible(GUIEditor.window[1]))
guiSetVisible(GUIEditor.window[1],not guiGetVisible(GUIEditor.window[1]))
if guiCheckBoxGetSelected(GUIEditor.checkbox[1]) then
triggerServerEvent("removeTime",root,"all",tonumber(guiGetText(GUIEditor.edit[1])))
else
triggerServerEvent("removeTime",root,guiGridListGetItemText(GUIEditor.gridlist[1],guiGridListGetSelectedItem(GUIEditor.gridlist[1]),1),tonumber(guiGetText(GUIEditor.edit[1])))
end
elseif source == GUIEditor.button[3] and guiGetText(GUIEditor.label[3]) ~= "" and guiGetText(GUIEditor.label[4]) ~= "" and guiGetText(GUIEditor.label[5]) ~= "" then
triggerServerEvent("ToServer",root,guiGetText(GUIEditor.edit[3]),guiGetText(GUIEditor.edit[4]),guiGetText(GUIEditor.edit[5]))
showCursor(not guiGetVisible(GUIEditor.window[1]))
guiSetVisible(GUIEditor.window[1],not guiGetVisible(GUIEditor.window[1]))
end
end
)
addEventHandler("onClientGUIChanged",root,
function ()
if source == GUIEditor.edit[2] then
searchgd(GUIEditor.gridlist[1],guiGetText(source))
end
end
)
function getPlayerTime(plr)
return getElementData(plr,"PlayTime")
end
function SetPlayersInGD( GridList )
if GridList then
if getElementType ( GridList ) == "gui-gridlist" then
if guiGridListClear ( GridList ) then
for i, v in next, getElementsByType ( "player" ) do
local Row = guiGridListAddRow ( GridList )
guiGridListSetItemText ( GridList, Row, 1, getPlayerName ( v ), false, false )
guiGridListSetItemText ( GridList, Row, 2, getPlayerTime( v ), false, false )
end
end
end
end
end
function searchgd(GridList,name)
if guiGridListClear ( GridList ) then
for i, v in next, getElementsByType ( "player" ) do
if not string.find(getPlayerName(v),name) then return end
local Row = guiGridListAddRow ( GridList )
guiGridListSetItemText ( GridList, Row, 1, getPlayerName ( v ), false, false )
guiGridListSetItemText ( GridList, Row, 2, getPlayerTime( v ), false, false )
end
end
end
addEvent('openn',true)
addEventHandler('openn',root,
function ()
showCursor(not guiGetVisible(GUIEditor.window[1]))
guiSetVisible(GUIEditor.window[1],not guiGetVisible(GUIEditor.window[1]))
SetPlayersInGD(GUIEditor.gridlist[1])
guiSetText(GUIEditor.edit[1],"")
guiSetText(GUIEditor.edit[2],"بــحــث ....")
guiSetText(GUIEditor.edit[3],"")
guiSetText(GUIEditor.edit[4],"")
guiSetText(GUIEditor.edit[5],"")
end
)