Snakegold Posted July 30, 2018 Share Posted July 30, 2018 شباب راح اسوي لوحة فيها أسماء الأدمنية لو في أدمن موجود حاليا بالسيرفر يكون اسمه بالأضر و لو هو روح أوفلااين بيصير إسمه بالأحمر المطلوب ايش لازم استعمل؟ Functions/Events GUIEditor = { gridlist = {} } local screenW, screenH = guiGetScreenSize() wind = guiCreateWindow((screenW - 315) / 2, (screenH - 375) / 2, 315, 375, "Online staffs", false) guiWindowSetSizable(wind, false) guiSetVisible(wind, false) GUIEditor.gridlist[1] = guiCreateGridList(9, 23, 296, 292, false, wind) guiGridListAddColumn(GUIEditor.gridlist[1], "Name", 0.5) guiGridListAddColumn(GUIEditor.gridlist[1], "Rank", 0.5) for i = 1, 2 do guiGridListAddRow(GUIEditor.gridlist[1]) end guiGridListSetItemText(GUIEditor.gridlist[1], 0, 1, "Online Player", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 0, 2, "Admin", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 1, 1, "Offline Player", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 1, 2, "Moderator", false, false) close_btn = guiCreateButton(113, 325, 87, 31, "Close", false, wind) function Open () guiSetVisible(wind, not guiGetVisible(wind)) showCursor(guiGetVisible(wind)) end bindKey("F5","down", Open) addEventHandler("onClientGUIClick",root, function() if source == close_btn then guiSetVisible(wind,false) showCursor(false) end end) Link to comment
#DRAGON!FIRE Posted July 30, 2018 Share Posted July 30, 2018 aclGroupListObjects getAccountPlayer triggerClientEvent Link to comment
Snakegold Posted July 30, 2018 Author Share Posted July 30, 2018 طيب ايش المشكلة؟ Client-- GUIEditor = { gridlist = {} } local screenW, screenH = guiGetScreenSize() wind = guiCreateWindow((screenW - 315) / 2, (screenH - 375) / 2, 315, 375, "Online staffs", false) guiWindowSetSizable(wind, false) guiSetVisible(wind, false) GUIEditor.gridlist[1] = guiCreateGridList(9, 23, 296, 292, false, wind) guiGridListAddColumn(GUIEditor.gridlist[1], "Name", 0.5) guiGridListAddColumn(GUIEditor.gridlist[1], "Rank", 0.5) for i = 1, 2 do guiGridListAddRow(GUIEditor.gridlist[1]) end guiGridListSetItemText(GUIEditor.gridlist[1], 0, 1, "Online Player", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 0, 2, "Admin", false, false) close_btn = guiCreateButton(113, 325, 87, 31, "Close", false, wind) function Open () guiSetVisible(wind, not guiGetVisible(wind)) showCursor(guiGetVisible(wind)) end bindKey("F5","down", Open) addEventHandler("onClientGUIClick",root, function() if source == close_btn then guiSetVisible(wind,false) showCursor(false) end end) -- functions addEvent("client:getOnlineAdmins:callBack",true) addEventHandler("client:getOnlineAdmins:callBack",root, function(admins) outputChatBox(#admins) for k,v in ipairs(admins) do local row = guiGridListAddRow(lp.gridlist) guiGridListSetItemText(lp.gridlist,row,1,v.name,false,false) guiGridListSetItemColor(lp.gridlist,row,1,0,255,0) guiGridListSetItemText(lp.gridlist,row,2,v.rank,false,false) guiGridListSetItemColor(lp.gridlist,row,2,0,255,0) end end triggerServerEvent("server:getOnlineAdmins",localPlayer) Server-- local admins = { "Admin", "Moderator", } addEvent("server:getOnlineAdmins",true) addEventHandler("server:getOnlineAdmins",root, function() local a = {} for k,group in ipairs(admins) do for k,v in ipairs(aclGroupListObjects(aclGetGroup(group))) do if v:find("user.") then local player = getAccountPlayer(getAccount(v:gsub("user.",""),nil)) if player then table.insert(a,{name=getPlayerName(player):gsub("#%x%x%x%x%x%x",""),rank=group}) end end end end triggerClientEvent(client,"client:getOnlineAdmins:callBack",client,a) end ) Link to comment
#DRAGON!FIRE Posted July 30, 2018 Share Posted July 30, 2018 (edited) Client : local screenW, screenH = guiGetScreenSize ( ) GUIEditor = { gridlist = {} } addEventHandler ( "onClientResourceStart", resourceRoot, function ( ) wind = guiCreateWindow((screenW - 315) / 2, (screenH - 375) / 2, 315, 375, "Online staffs", false) guiWindowSetSizable(wind, false) guiSetVisible(wind, false) GUIEditor.gridlist[1] = guiCreateGridList(9, 23, 296, 292, false, wind) guiGridListAddColumn(GUIEditor.gridlist[1], "Name", 0.5) guiGridListAddColumn(GUIEditor.gridlist[1], "Rank", 0.5) close_btn = guiCreateButton(113, 325, 87, 31, "Close", false, wind) end ) function Open ( ) guiSetVisible ( wind, not guiGetVisible(wind) ) showCursor ( guiGetVisible(wind) ) if guiGetVisible ( wind ) then triggerServerEvent ( "getOnlineAdmins", localPlayer ) end end bindKey ( "F5", "down", Open ) addEventHandler ( "onClientGUIClick",root, function ( ) if source == close_btn then guiSetVisible ( wind,false ) showCursor ( false ) end end ) addEvent ( "returnOnlineAdmins",true ) addEventHandler ( "returnOnlineAdmins", root, function ( AdminsTable ) guiGridListClear ( GUIEditor.gridlist[1] ) for k,v in ipairs ( AdminsTable ) do local row = guiGridListAddRow ( GUIEditor.gridlist[1] ) guiGridListSetItemText ( GUIEditor.gridlist[1], row, 1, v.name,false,false ) guiGridListSetItemText ( GUIEditor.gridlist[1],row,2,v.rank,false,false) if v.state == "online" then guiGridListSetItemColor ( GUIEditor.gridlist[1], row, 1, 0, 255, 0 ) else guiGridListSetItemColor ( GUIEditor.gridlist[1], row, 1, 255, 0, 0 ) end end end ) Server : local admins = { "Admin", "Moderator", } function isAccountUserOnline ( accName ) local acc = getAccount ( accName ) if not acc then return "account not found" end local p = getAccountPlayer ( acc ) if ( p ) then return "online" end return "offline" end addEvent ( "getOnlineAdmins",true ) addEventHandler ( "getOnlineAdmins", root, function ( ) local AdminsTable = { } for i = 1,#admins do g_ = aclGetGroup ( admins [ i ] ) if g_ then for k, o in ipairs ( aclGroupListObjects ( g_ ) ) do local Check = gettok( o, 1, string.byte('.') ) if ( Check == "user" ) then local uName = gettok( o, 2, string.byte('.') ) table.insert( AdminsTable, { rank=admins [ i ], name=uName, state=isAccountUserOnline ( uName ) } ) end end end end triggerClientEvent ( source, "returnOnlineAdmins", source, AdminsTable ) end ) Edited July 30, 2018 by #DRAGON!FIRE Link to comment
Snakegold Posted July 30, 2018 Author Share Posted July 30, 2018 #DRAGON!FIRE@ مشكور شغال Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now