#Heshan||eUNLOCK||

[HELP] password based gate system

Recommended Posts

I maked a Password based gate script with dx and normal gui 

pic :/

ZSToV25.png

 

This resource is working properly but i have a problem 

iwant to setup close butten and gui visible set to marker 

pls help me 

this is client side

GUIEditor = {
    button = {},
    edit = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
        GUIEditor.button[1] = guiCreateButton(534, 370, 265, 54, "OPEN THE GATE", false)


        GUIEditor.button[2] = guiCreateButton(872, 429, 62, 37, "Close", false)


        GUIEditor.edit[1] = guiCreateEdit(463, 269, 250, 43, "", false)    

        addEventHandler ( "onClientGUIClick", GUIEditor.button[1], checkPassword )
        guiEditSetMasked ( GUIEditor.edit[1], true )
    end
)

password = "1234"
function checkPassword ()
        local text = guiGetText ( GUIEditor.edit[1] )     
        if text == password then                
                triggerServerEvent ( "openGate", resourceRoot)
        else
                outputChatBox ( "Password Incorrect!" )
        end
end

 

this is the server side 

local gate = createObject(980,-2423.94385, -609.48846, 132.56250, 0, 0, 0)

function open()
	
	moveObject(gate, 980,-2414.95703, -603.12976, 132.56250, 0, 0, 0)
	
    end
addEvent( "openGate", true )
addEventHandler( "openGate", resourceRoot, open )

 

<meta>

<meta>
    <info  type="script" name="psswd based gate" author="heshan" version="1.0.0"></info>
   
    <script src="my2.lua" type="client" ></script>
    <script src="my2s.lua" type="server" ></script>
</meta>

pls help 

Share this post


Link to post
2 hours ago, #Heshan||eUNLOCK|| said:

I maked a Password based gate script with dx and normal gui 

pic :/

ZSToV25.png

 

This resource is working properly but i have a problem 

iwant to setup close butten and gui visible set to marker 

pls help me 

this is client side


GUIEditor = {
    button = {},
    edit = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
        GUIEditor.button[1] = guiCreateButton(534, 370, 265, 54, "OPEN THE GATE", false)


        GUIEditor.button[2] = guiCreateButton(872, 429, 62, 37, "Close", false)


        GUIEditor.edit[1] = guiCreateEdit(463, 269, 250, 43, "", false)    

        addEventHandler ( "onClientGUIClick", GUIEditor.button[1], checkPassword )
        guiEditSetMasked ( GUIEditor.edit[1], true )
    end
)

password = "1234"
function checkPassword ()
        local text = guiGetText ( GUIEditor.edit[1] )     
        if text == password then                
                triggerServerEvent ( "openGate", resourceRoot)
        else
                outputChatBox ( "Password Incorrect!" )
        end
end

 

this is the server side 


local gate = createObject(980,-2423.94385, -609.48846, 132.56250, 0, 0, 0)

function open()
	
	moveObject(gate, 980,-2414.95703, -603.12976, 132.56250, 0, 0, 0)
	
    end
addEvent( "openGate", true )
addEventHandler( "openGate", resourceRoot, open )

 

<meta>


<meta>
    <info  type="script" name="psswd based gate" author="heshan" version="1.0.0"></info>
   
    <script src="my2.lua" type="client" ></script>
    <script src="my2s.lua" type="server" ></script>
</meta>

pls help 


 

 

you help me with my topics and i will help you!

Share this post


Link to post
3 hours ago, MRThinker said:


 

 

you help me with my topics and i will help you!

i have not better knowledge about scripting somthing i know i will help you.

if you know my problem's answer pls help to improve my knowledge about lua 

Edited by #Heshan||eUNLOCK||

Share this post


Link to post
local password = "1234"
function checkPassword ()
        local text = guiGetText ( GUIEditor.edit[1] )     
        if text == password then                
                triggerServerEvent ( "openGate", resourceRoot)
    			outputChatBox ( "Password Correct!" )
        else
                outputChatBox ( "Password Incorrect!" )
        end
end

Client side.

Share this post


Link to post
13 hours ago, Mohamed Nightmare said:

local password = "1234"
function checkPassword ()
        local text = guiGetText ( GUIEditor.edit[1] )     
        if text == password then                
                triggerServerEvent ( "openGate", resourceRoot)
    			outputChatBox ( "Password Correct!" )
        else
                outputChatBox ( "Password Incorrect!" )
        end
end

Client side.

i knwo but i want to setup close butten function

Share this post


Link to post
addEventHandler("onClientGUIClick",GUIEditor.button[2],replace button with your ones 
        guiSetVisible ( GUIEditor.window[1], false ),
      Replace window  with yours window name
  showCursor(false)
  guiSetInputEnabled(false)
  
  
  End 

For close funcrion Add the above code in your client.lua ,and replace names as I shown in code 

Edited by KINGKHAN
  • Thanks 1

Share this post


Link to post

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.