MisterQuestions Posted July 28, 2014 Share Posted July 28, 2014 Hi all! D: im having problems with my script, im creating a admin panel, i know all the things that i will use, but i dont know how to get a player list, a map list, and how to aply action to selected player of a gridlist, can any one help me? Link to comment
Castillo Posted July 28, 2014 Share Posted July 28, 2014 Well, to get player list, you need to use: getElementsByType guiGridListAddRow guiGridListSetItemText And to get a selected player: guiGridListGetSelectedItem guiGridListGetItemText Link to comment
Et-win Posted July 28, 2014 Share Posted July 28, 2014 And for the maps: exports --( exports.resourcename:codename(argumentsifneeded) ) getResourceInfo Check here for all codes to get maps and gamemodes: https://wiki.multitheftauto.com/wiki/Re ... Mapmanager TIP: Unpack the table of the maps serverside. Link to comment
AboShanab Posted July 28, 2014 Share Posted July 28, 2014 if u need to get resources and maps table getResources getResourceInfo getResourceName getResourceState loop guiGridListAddRow guiGridListSetItemText Link to comment
Bonsai Posted July 28, 2014 Share Posted July 28, 2014 If you are creating an admin panel that atleast shares a few features with the default admin panel, why don't you just check out how its done there? Link to comment
MisterQuestions Posted August 2, 2014 Author Share Posted August 2, 2014 Is this ok? so i can get selected player an aply action of button? local selected = guiGridListGetSelectedItem local itemtext = guiGridListGetItemText Yes? and how to get selected on server-side? This is my full Code.. Client-Side: ---Admin Panel-------- function AdminPanel () admin_window = guiCreateWindow(384, 130, 263, 500, "Admin Panel", false) guiWindowSetSizable(admin_window, false) tab_adminpanel = guiCreateTabPanel(9, 25, 244, 465, false, admin_window) tab_players = guiCreateTab("Players", tab_adminpanel) blow = guiCreateButton(135, 29, 99, 32, "Blow", false, tab_players) kick = guiCreateButton(135, 112, 99, 32, "Kick", false, tab_players) mute = guiCreateButton(135, 70, 99, 32, "Mute", false, tab_players) ban = guiCreateButton(135, 154, 99, 32, "Ban", false, tab_players) label1 = guiCreateLabel(135, 196, 115, 19, "--------------------------", false, tab_players) guiLabelSetColor(label1, 255, 158, 0) rainbow = guiCreateButton(135, 225, 99, 32, "Rainbow", false, tab_players) proximamente = guiCreateButton(135, 267, 99, 32, "More Comming..", false, tab_players) tab_ranks = guiCreateTab("Ranks", tab_adminpanel) trial = guiCreateButton(135, 29, 99, 32, "Trial-Member", false, tab_ranks) member = guiCreateButton(135, 71, 99, 32, "Member", false, tab_ranks) moderator = guiCreateButton(135, 113, 99, 32, "Moderator", false, tab_ranks) mananger = guiCreateButton(135, 197, 99, 32, "Team-Manager", false, tab_ranks) admin = guiCreateButton(135, 155, 99, 32, "Administrator", false, tab_ranks) label2 = guiCreateLabel(130, 239, 107, 21, " ---------------------------", false, tab_ranks) guiLabelSetColor(label2, 255, 158, 0) vip = guiCreateButton(135, 270, 99, 32, "V.I.P", false, tab_ranks) tab_server = guiCreateTab("Server", tab_adminpanel) annedit = guiCreateEdit(7, 24, 227, 34, "", false, tab_server) announce = guiCreateButton(8, 67, 226, 31, "Announce", false, tab_server) teams = guiCreateButton(8, 137, 226, 31, "Team's Management", false, tab_server) label3 = guiCreateLabel(10, 112, 221, 15, "----------------------------------------------------------", false, tab_server) guiLabelSetColor(label3, 255, 158, 0) nametags = guiCreateButton(8, 183, 226, 31, "Nametag status: Show", false, tab_server) end ----Player's Grid's function PlayerList1 () local playerList1 = guiCreateGridList(10, 19, 120, 411, false, tab_players) local column = guiGridListAddColumn( playerList1, "Player", 0.85 ) if ( column ) then for id, player in ipairs(getElementsByType("player")) do local row = guiGridListAddRow ( playerList1 ) guiGridListSetItemText ( playerList1, row, column, getPlayerName ( player ), false, false ) end end end function PlayerList2 () local playerList2 = guiCreateGridList(10, 19, 120, 411, false, tab_ranks) local column = guiGridListAddColumn( playerList2, "Player", 0.85 ) if ( column ) then for id, player in ipairs(getElementsByType("player")) do local row = guiGridListAddRow ( playerList2 ) guiGridListSetItemText ( playerList2, row, column, getPlayerName ( player ), false, false ) end end end ---Selected player local selected = guiGridListGetSelectedItem local itemtext = guiGridListGetItemText --Open panel function toggleGUI() if guiGetVisible(window_panel) == true then guiSetVisible(window_panel,false) showCursor(false) else guiSetVisible(window_panel,true) showCursor(true) end end addEvent(":~",true) addEventHandler(":~",root,toggleGUI) Server-Side: addEventHandler("onResourceStart",resourceRoot, function () for index, player in ipairs(getElementsByType("player")) do bindKey(player,"o","down",showGUI) --- key F3 to open it end end) function showGUI(thePlayer) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)),aclGetGroup("Owner") or ("Team-Mananger") or ("Admin") or ("Moderator") or ("Member") or ) then triggerClientEvent(thePlayer,":~",thePlayer) else outputChatBox("You must be an admin to do this",thePlayer,255,0,0) end end 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