abdalbaset Posted February 14, 2014 Posted February 14, 2014 i make this gui panel but i dont know what to use to make whene this panel come out with command and whene player prees any Button song will start GUIEditor = { button = {}, window = {} } function() GUIEditor.window[1] = guiCreateWindow(495, 299, 522, 358, "songs panel", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.button[1] = guiCreateButton(12, 38, 198, 69, "SONG1", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[1], "clear-normal") guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFF90522") GUIEditor.button[2] = guiCreateButton(278, 9, 201, 27, "", false, GUIEditor.button[1]) guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA") GUIEditor.button[3] = guiCreateButton(3, 126, 162, 16, "", false, GUIEditor.button[1]) guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FFAAAAAA") GUIEditor.button[4] = guiCreateButton(330, 42, 176, 65, "SONG2", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FF1FF409") GUIEditor.button[5] = guiCreateButton(18, 156, 192, 71, "SONG3", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FF0622F6") GUIEditor.button[6] = guiCreateButton(334, 160, 172, 67, "SONG4", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[6], "NormalTextColour", "FFF803EF") GUIEditor.button[7] = guiCreateButton(23, 290, 197, 58, "stop", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[7], "sa-header") guiSetProperty(GUIEditor.button[7], "NormalTextColour", "FFAAAAAA") GUIEditor.button[8] = guiCreateButton(338, 286, 168, 62, "close", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[8], "sa-header") guiSetProperty(GUIEditor.button[8], "NormalTextColour", "FFAAAAAA") end )
Anubhav Posted February 14, 2014 Posted February 14, 2014 use bindKey or addCommandHandler guiSetVisible playSound play3DSound
abdalbaset Posted February 14, 2014 Author Posted February 14, 2014 so i make it like this to make the gui open ? this code is working can you help me to fix it GUIEditor = { button = {}, window = {} } function() songsgui = guiCreateWindow(495, 299, 522, 358, "songs panel", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.button[1] = guiCreateButton(12, 38, 198, 69, "SONG1", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[1], "clear-normal") guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFF90522") GUIEditor.button[2] = guiCreateButton(278, 9, 201, 27, "", false, GUIEditor.button[1]) guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA") GUIEditor.button[3] = guiCreateButton(3, 126, 162, 16, "", false, GUIEditor.button[1]) guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FFAAAAAA") GUIEditor.button[4] = guiCreateButton(330, 42, 176, 65, "SONG2", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FF1FF409") GUIEditor.button[5] = guiCreateButton(18, 156, 192, 71, "SONG3", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FF0622F6") GUIEditor.button[6] = guiCreateButton(334, 160, 172, 67, "SONG4", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[6], "NormalTextColour", "FFF803EF") GUIEditor.button[7] = guiCreateButton(23, 290, 197, 58, "stop", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[7], "sa-header") guiSetProperty(GUIEditor.button[7], "NormalTextColour", "FFAAAAAA") GUIEditor.button[8] = guiCreateButton(338, 286, 168, 62, "close", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[8], "sa-header") guiSetProperty(GUIEditor.button[8], "NormalTextColour", "FFAAAAAA") end ) function songo() guiSetVisible ( GUIEditor.window[1], true ) end bindKey("F7","down",songo)
abdalbaset Posted February 14, 2014 Author Posted February 14, 2014 i cant see it i think i made a mistack over there
Karuzo Posted February 14, 2014 Posted February 14, 2014 (edited) Here you go: GUIEditor = { button = {}, window = {} } GUIEditor.window[1] = guiCreateWindow(495, 299, 522, 358, "Songs panel", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.button[1] = guiCreateButton(12, 38, 198, 69, "SONG1", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[1], "clear-normal") guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFF90522") GUIEditor.button[2] = guiCreateButton(278, 9, 201, 27, "", false, GUIEditor.button[1]) guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA") GUIEditor.button[3] = guiCreateButton(3, 126, 162, 16, "", false, GUIEditor.button[1]) guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FFAAAAAA") GUIEditor.button[4] = guiCreateButton(330, 42, 176, 65, "SONG2", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FF1FF409") GUIEditor.button[5] = guiCreateButton(18, 156, 192, 71, "SONG3", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FF0622F6") GUIEditor.button[6] = guiCreateButton(334, 160, 172, 67, "SONG4", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[6], "NormalTextColour", "FFF803EF") GUIEditor.button[7] = guiCreateButton(23, 290, 197, 58, "Stop", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[7], "sa-header") guiSetProperty(GUIEditor.button[7], "NormalTextColour", "FFAAAAAA") GUIEditor.button[8] = guiCreateButton(338, 286, 168, 62, "Close", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[8], "sa-header") guiSetProperty(GUIEditor.button[8], "NormalTextColour", "FFAAAAAA") function songo() guiSetVisible ( GUIEditor.window[1], true ) end bindKey("F7","down",songo) function Close() guiSetVisible(GUIEditor.window[1], false) end addEventHandler("onClientGUIClick", GUIEditor.button[8],Close, false) addEventHandler("onClientGUIClick", root, function () if ( source == GUIEditor.button[1] ) then if isElement(sound3) then destroyElement(sound3) end if isElement(sound2) then destroyElement(sound2) end if isElement(sound4) then destroyElement(sound4) end if isElement(sound1) then destroyElement(sound1) end sound1 = playSound( "song1.mp3", false ) elseif ( source == GUIEditor.button[4] ) then if isElement(sound3) then destroyElement(sound3) end if isElement(sound1) then destroyElement(sound1) end if isElement(sound4) then destroyElement(sound4) end if isElement(sound2) then destroyElement(sound2) end sound2 = playSound( "song2.mp3", false ) elseif ( source == GUIEditor.button[5] ) then if isElement(sound1) then destroyElement(sound1) end if isElement(sound2) then destroyElement(sound2) end if isElement(sound4) then destroyElement(sound4) end if isElement(sound3) then destroyElement(sound3) end sound3 = playSound( "song3.mp3", false ) elseif ( source == GUIEditor.button[6] ) then if isElement(sound1) then destroyElement(sound1) end if isElement(sound2) then destroyElement(sound2) end if isElement(sound3) then destroyElement(sound3) end if isElement(sound4) then destroyElement(sound4) end sound4 = playSound( "song4.mp3", false ) elseif ( source == GUIEditor.button[7] ) then if isElement(sound1) then destroyElement(sound1) end if isElement(sound2) then destroyElement(sound2) end if isElement(sound3) then destroyElement(sound3) end if isElement(sound4) then destroyElement(sound4) end end end ) Edited February 14, 2014 by Guest
abdalbaset Posted February 14, 2014 Author Posted February 14, 2014 lal can you tell me what you did?
Karuzo Posted February 14, 2014 Posted February 14, 2014 Well you had songsgui =, and setted GUIEditor.window[1] to true(i mean the visibility). That's why it didn't worked. And the Close function just set's the Window visibility to false. The onClientGUIClick Event/Function just check which button was clicked, and if the button was pressed it checks if another song is playing at this moment, if so , it will stop the sound. If not, it will start the song. And if you press on "Stop" it will check if a song is playing at this moment and will stop it. Hope you understood me.
abdalbaset Posted February 14, 2014 Author Posted February 14, 2014 thanx man 10/10 you helped me more by explining that
abdalbaset Posted February 14, 2014 Author Posted February 14, 2014 One more thing where I open the panel I can't see the mouse why?
Karuzo Posted February 14, 2014 Posted February 14, 2014 (edited) Put showCursor(true) in the songo function, and showCursor(false) in Close function Edited February 14, 2014 by Guest
Moderators Citizen Posted February 14, 2014 Moderators Posted February 14, 2014 Put showChat(true) in the songo function, and showCursor(false) in Close function You did a typo in the first lua tag, you probably wanted to write showCursor(true)
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