Jump to content

[help]password for a door


Castillo

Recommended Posts

It's possible, yes.

Just do something like this server-side:

password[door element here] = "password here"

(or just use a non-synced setElementData, just try not to send it to the clients :P )

And client-side, you have an empty string. And each time a button is pressed, you add a character to the string. Then when the key is hit to send it, send the password to the server and use moveObject to move the door. Don't forget to send the door element too though, or it would be pretty useless.

Probably not the best way, but as long as it's a way, it's a way.

Link to comment

uhm, as i have undestood your first post, you could make an edit field on your gui window and then, when you click on the 'open' button, you check, what's written in this edit field, if it's correct, then your door is opening, if not - then nothing..

something like this:

addEventHandler( 'onClientGUIClick', button_Open,
function()
if guiGetText( passwordEditField ) == 'somePassword' then
triggerServerEvent( 'openDoor', getLocalPlayer() ); --open your door if password is correct
else
outputChatBox( 'Incorrect password' );
end;
end
, false );

Link to comment

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...