Prat Posted September 6, 2013 Share Posted September 6, 2013 Hallo playas today i suggested to make a an admin panel , just to test my skills, but i'm stuck on something , i searched over the wiki , but nothing. the script is an admin panel ; gridlist on the left gets the online players , and search field intop of it. when you select the column of the player name , you can make the actions (there is buttons for actions on the gui), problem is , guiGridListGetItemText is client sided only , and i want the server side to do the actions to the player , here is the gui : GUIEditor = { edit = {}, button = {}, window = {}, label = {}, gridlist = {} } GUIEditor.window[1] = guiCreateWindow(458, 120, 370, 459, "Helpers Panel", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.edit[1] = guiCreateEdit(20, 84, 102, 23, "", false, GUIEditor.window[1]) GUIEditor.gridlist[1] = guiCreateGridList(10, 112, 128, 329, false, GUIEditor.window[1]) GUIEditor.label[1] = guiCreateLabel(20, 55, 152, 24, "Players Search", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[1], "default-bold-small") guiLabelSetColor(GUIEditor.label[1], 51, 115, 203) GUIEditor.button[1] = guiCreateButton(266, 190, 94, 47, "Mute Player", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[1], "default-bold-small") guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FF3373CB") GUIEditor.button[2] = guiCreateButton(265, 254, 95, 47, "Unmute Player", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[2], "default-bold-small") guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FF3373CB") GUIEditor.label[2] = guiCreateLabel(148, 24, 218, 103, "NOTE: While punishing players , it\n would be recommended to\n include screen shots to proof in\n case the helper got complainted\n to a Staff.", false, GUIEditor.window[1]) GUIEditor.button[3] = guiCreateButton(267, 326, 93, 47, "Kick Player", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[3], "default-bold-small") guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FF3373CB") GUIEditor.button[4] = guiCreateButton(267, 394, 93, 47, "Freeze", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[4], "default-bold-small") guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FF3373CB") GUIEditor.button[5] = guiCreateButton(148, 394, 93, 47, "Unfreeze", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[5], "default-bold-small") guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FF3373CB") GUIEditor.button[6] = guiCreateButton(148, 326, 93, 47, "Warp", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[6], "default-bold-small") guiSetProperty(GUIEditor.button[6], "NormalTextColour", "FF3373CB") GUIEditor.button[7] = guiCreateButton(146, 254, 95, 47, "Kill Player", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[7], "default-bold-small") guiSetProperty(GUIEditor.button[7], "NormalTextColour", "FF3373CB") function showGui ( thePlayer) if not guiGetVisible(GUIEditor.window[1]) then guiSetVisible(GUIEditor.window[1], true) showCursor(true) else guiSetVisible(GUIEditor.window[1], false) showCursor(false) end end addCommandHandler ("panil", showGui) local playerList = guiCreateGridList(10, 112, 128, 329, false, GUIEditor.window[1]) -- Create the grid list local column = guiGridListAddColumn( playerList, "Player", 0.85 ) -- Create a 'players' column in the list if ( column ) then -- If the column was successfully created for id, playeritem in ipairs(getElementsByType("player")) do local row = guiGridListAddRow ( playerList ) guiGridListSetItemText ( playerList, row, column, getPlayerName ( playeritem ), false, false ) end end function mutePlayer ( thePlayer) local playerName = guiGridListGetItemText ( playerList, guiGridListGetSelectedItem ( playerList ), 1 ) triggerServerEevent ("onMutePlaya", root) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , mutePlayer) Also, server side "setPlayerMuted" it does mute the player for infinite , and i want it to be 10 minutes. Cheers , hope you guys answer me Link to comment
Castillo Posted September 6, 2013 Share Posted September 6, 2013 Send the player name on the triggerServerEvent function. Link to comment
Prat Posted September 6, 2013 Author Share Posted September 6, 2013 exactly , how to send it to the remote trigger? Link to comment
Castillo Posted September 6, 2013 Share Posted September 6, 2013 triggerServerEvent ( "onMutePlaya", localPlayer, playerName ) Like that, and you can send anything you want. Link to comment
Prat Posted September 6, 2013 Author Share Posted September 6, 2013 would you add it please? :3 here is the server side :- addEvent ("onMutePlaya") addEventHandler ("onMutePlaya", root, function () setPlayerMuted (playerName, true) end ) Also i wannna change "setPlayerMuted" to 10 minutes instead of infinite. Appreciate that man EDIT: localPlayer is the muter or the muted guy ? Link to comment
Castillo Posted September 6, 2013 Share Posted September 6, 2013 You must add the playerName to the function name, like this: function ( playerName ) also, playerName is just a string, not the actual player element, so you must obtain the element using getPlayerFromName. localPlayer is the muter. Link to comment
Prat Posted September 6, 2013 Author Share Posted September 6, 2013 i hate the "getPlayerBlablabla" thingy dingy obama tingy, so please add it for me , i'm so confused now Link to comment
Castillo Posted September 6, 2013 Share Posted September 6, 2013 addEvent ( "onMutePlaya", true ) addEventHandler ( "onMutePlaya", root, function ( playerName ) setPlayerMuted ( getPlayerFromName ( playerName ), true ) end ) Link to comment
Prat Posted September 6, 2013 Author Share Posted September 6, 2013 i'v used this but it ouput a bad arg line in debug msg addEvent ("onMuteNab", true) addEventHandler ("onMuteNab", root, function () victim = getPlayerFromName(playerName) setPlayerMuted (victim, true) outputChatBox ("You have been Muted", victim) end ) Link to comment
Prat Posted September 6, 2013 Author Share Posted September 6, 2013 now it works successfuly , the setPlayerMuted is infinite , i want to time it to 10 seconds. and thanks castillo <3 Link to comment
Castillo Posted September 6, 2013 Share Posted September 6, 2013 To unmute him after 10 seconds, you must use setTimer. Link to comment
Prat Posted September 6, 2013 Author Share Posted September 6, 2013 appreciate that man , thanks. 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