Jump to content

Assembling commands in a single window


Recommended Posts

Posted

Hello again ^^

excuse me for my lack of knowledge of such things , but im learning step by step ^^ 

i have a list of commands that i want to put them in 1 single window . 

let me explain , for example instead of remembering  /command1 , /command2 , /command3  

i want to make 1 command that will bring me a window with 3 buttons (button 1 to execute command 1 and so on....)

i tried many scripts but i never reached my goal , so can anyone help me :) 

Posted (edited)
1 hour ago, pa3ck said:

Hi, post the code you tried, so we will be able to help you.

i have forgotten but the last thing i did was downloading gui editor and trying to make button and assign them to their commands , so i pretty much created just the "look"  wich is this , i just can't figure out how to assign commands to each button


GUIEditor = {
    button = {},
    window = {},
    memo = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
        GUIEditor.window[1] = guiCreateWindow(518, 105, 319, 501, "VIP PANEL BY ZIED FERAH", false)
        guiWindowSetSizable(GUIEditor.window[1], false)
        guiSetAlpha(GUIEditor.window[1], 0.63)
        guiSetProperty(GUIEditor.window[1], "CaptionColour", "FF07D8F8")

        GUIEditor.button[1] = guiCreateButton(22, 51, 261, 55, "Open weapon shop", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFF4FD01")
        GUIEditor.button[2] = guiCreateButton(24, 150, 259, 65, "Reset Health ", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFFD0000")
        GUIEditor.button[3] = guiCreateButton(24, 150, 259, 65, "Reset Health ", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FFFD0000")


        GUIEditor.window[2] = guiCreateWindow(518, 105, 319, 501, "VIP PANEL BY ZIED FERAH", false)
        guiWindowSetSizable(GUIEditor.window[2], false)
        guiSetAlpha(GUIEditor.window[2], 0.63)
        guiSetProperty(GUIEditor.window[2], "CaptionColour", "FF07D8F8")

        GUIEditor.button[4] = guiCreateButton(22, 51, 261, 55, "Open weapon shop", false, GUIEditor.window[2])
        guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FFF4FD01")
        GUIEditor.button[5] = guiCreateButton(24, 150, 259, 65, "Reset Health ", false, GUIEditor.window[2])
        guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FFFD0000")
        GUIEditor.button[6] = guiCreateButton(24, 150, 259, 65, "Reset Health (cost 2000g)", false, GUIEditor.window[2])
        guiSetProperty(GUIEditor.button[6], "NormalTextColour", "FFFD0000")
        GUIEditor.button[7] = guiCreateButton(96, 326, 120, 31, "exit", false, GUIEditor.window[2])
        guiSetProperty(GUIEditor.button[7], "NormalTextColour", "FFAAAAAA")
        GUIEditor.memo[1] = guiCreateMemo(27, 367, 266, 124, "Additional Info : \n\n/shout <player> <msg> : pm player\n/pause : to pause game\n/unpause : to resume game", false, GUIEditor.window[2])    
    end
)

 

Edited by Zie[E]D_)"U.R
Posted
local window = guiCreateWindow(370, 357, 405, 175, "Examle", false)
local btn = guiCreateButton(262, 121, 129, 44, "CLOSE", false, window)

         function guiToggle ( )    
         if ( guiGetVisible ( window ) == true ) 
    			then
         			guiSetVisible ( window, false ) -- if it is visible, you hide it
         	end
         end
		addEventHandler ( "onClientGUIClick", btn, guiToggle, false )
		addCommandHandler ( "togglew", guiToggle )

		
		function visible( )
  		 if ( guiGetVisible ( window ) == false ) 
    			then
         			guiSetVisible ( window, true ) -- if it isn't visible, you show it
 	 		end
 		end
		addCommandHandler ( "toggle", guiToggle )

i didn't test that code,but if it isn't working quote me.

by the way you can't assign a command to a button but you can assign a command to the function that the button is triggered with.it means that the button and the command do the same action.

 

7YwV3kT.png

ℙℝM∀✗

Video Editor --- Images and pictures Editor.

Trial LUA Scripter. 

Scripting Skills 

     ↧ 

26%

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...