Client *
GUIEditor = {
button = {},
window = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
function()
GUIEditor.window[1] = guiCreateWindow(456, 245, 496, 453, "Name", false)
guiWindowSetSizable(GUIEditor.window[1], false)
gridlist = guiCreateGridList(11, 30, 475, 374, false, GUIEditor.window[1])
Column = guiGridListAddColumn(gridlist, "Player", 0.9)
GUIEditor.button[1] = guiCreateButton(277, 408, 170, 35, "طرد", false, GUIEditor.window[1])
guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA")
GUIEditor.button[2] = guiCreateButton(51, 409, 170, 34, "اضافة", false, GUIEditor.window[1])
guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA")
showCursor(true)
end
)
function tNames()
for _,v in ipairs(getElementsByType("player")) do
names = getPlayerName(v)
row = guiGridListAddRow(gridlist)
guiGridListSetItemText ( gridlist, row, Column, names, false, false )
end
end
addEventHandler("onClientResourceStart", resourceRoot,tNames)
addEventHandler("onClientPlayerChangeNick", resourceRoot,tNames)
addEventHandler("onClientPlayerJoin", resourceRoot,tNames)
addEventHandler("onClientPlayerQuit", resourceRoot,tNames)
addEventHandler("onClientGUIClick",root,
function()
if source == GUIEditor.button[2] and gridlist then
rRow, col = guiGridListGetSelectedItem (gridlist)
Item = guiGridListGetItemText(gridlist, rRow, col)
local plrName = getPlayerFromName (Item)
triggerServerEvent ("AddObject", localPlayer, plrName)
elseif source == GUIEditor.button[1] and gridlist then
triggerServerEvent ("RemoveObject", localPlayer, plrName)
end
end)
addEventHandler("onClientGUIClick",root,
function()
if source == GUIEditor.button[1] and gridlist then
rRow, col = guiGridListGetSelectedItem (gridlist)
Item = guiGridListGetItemText(gridlist, rRow, col)
local plrName = getPlayerFromName (Item)
triggerServerEvent ("RemoveObject", localPlayer, plrName)
end
end)
Server *
addEvent("AddObject",true)
addEventHandler("AddObject",root,
function(plrName)
aclGroupAddObject(aclGetGroup("Admin"),"user."..getAccountName((getPlayerAccount(plrName))) )
end)
addEvent("RemoveObject",true)
addEventHandler("RemoveObject",root,
function(plrName)
local acc = getAccountName((getPlayerAccount(plrName)))
if isObjectInACLGroup ("user."..acc, aclGetGroup ( "Admin" ) ) then
aclGroupRemoveObject (aclGetGroup("Admin"), "user."..acc)
else
outputChatBox("Admin هذا اللاعب ليس بقروب ",source)
end
end)