ماجربته بس جرب ورد خبر
Time = {1000,20000,30000}
local screenW, screenH = guiGetScreenSize()
window = guiCreateWindow(10, (screenH - 344) / 2, 216, 344, "لوحة اللاعبين", false)
guiWindowSetSizable(window, false)
guiSetAlpha(window, 1.00)
local X,Y = guiGetPosition(window, false)
gridlist = guiCreateGridList(9, 23, 197, 308, false, window)
guiGridListAddColumn(gridlist, "اللاعبين", 0.9)
button1 = guiCreateButton(9, 334, 197, 32, "سجن اللاعب", false, window)
for _, player in ipairs(getElementsByType("player")) do
local row = guiGridListAddRow (gridlist)
guiGridListSetItemText (gridlist, row,1, getPlayerName ( player ), false, false )
end
window2 = guiCreateWindow(226,128, 216, 241, "لوحة السجن", false)
guiWindowSetSizable(window2, false)
guiSetAlpha(window2, 1.00)
gridlist2 = guiCreateGridList(9, 23, 197, 140, false, window2)
guiGridListAddColumn(gridlist2, "مدة السجن", 0.9)
edit = guiCreateEdit(9, 183, 197, 25, "", false, window2)
button1 = guiCreateButton(9, 208, 148, 23, "سجن اللاعب", false, window2)
button2 = guiCreateButton(160, 208, 46, 23, "X", false, window2)
label = guiCreateLabel(87, 164, 36, 19, "السبب", false, window2)
guiSetFont(label, "default-bold-small")
addEventHandler("onClientGUIMove",window,function ()
X,Y = guiGetPosition(window, false)
guiSetPosition (window2,X+216,Y+1, false )
end, false)
for _, v in ipairs(Time) do
local row = guiGridListAddRow (gridlist2)
guiGridListSetItemText (gridlist2, row,1,v, false, false )
end
------
addEventHandler("onClientGUIClick",button1,function()
if (guiGridListGetSelectedItem(gridlist) == -1) then return outputChatBox('Please Selected Player Name',255,0,0,true) end
if (guiGridListGetSelectedItem(gridlist2) == -1) then return outputChatBox('Please Selected Time',255,0,0,true) end
if guiGetText ( edit )~= '' then
local Players = guiGridListGetItemText(gridlist, guiGridListGetSelectedItem(gridlist),1)
local Time = guiGridListGetItemText(gridlist2, guiGridListGetSelectedItem(gridlist2),1)
triggerServerEvent("Jail",localPlayer,Players,Time,guiGetText ( edit ))
else
end
outputChatBox('Please Add reason',255,0,0,true)
end,false)
guiSetVisible (window, false)
guiSetVisible (window2, false)
key = function ()
getVisible = guiGetVisible (window)
if (getVisible == true) then
guiSetVisible (window, false)
guiSetVisible (window2, false)
showCursor (false)
end
if (getVisible == false) then
guiSetVisible (window, true)
guiSetVisible (window2, true)
showCursor (true)
end
end
bindKey ("F2", "down", key)
function JailPlayers(elem,x,y,z,int,Dim)
setElementPosition(elem,x,y,z)
setElementInterior (elem,int)
setElementDimension (elem,Dim)
end
------
addEvent("Jail",true)
addEventHandler("Jail",root,function (who,min,reason)
local Name = getPlayerFromName (who)
if Name then
JailPlayers(Name,263,77,1001,6,600)
outputChatBox(reason .. ' بسبب '..getPlayerName (source).. ' تم سجنك من قبل' ,Name,255,255,0,true)
setTimer ( function(source)
JailPlayers(source,0,0,4,0,800)
outputChatBox('تم انتهاء مدة سجنك' ,Name,255,255,0,true)
end, min,1,source)
else
outputChatBox('هذا اللاعب ليس موجود',source,255,0,0,true)
end
end)