iFoReX Posted March 25, 2012 Posted March 25, 2012 I want do a elevator move with a password But I dont know how do ? please help me : local objeto = createObject ( 2669, 1090.67834, -2704.56226, 8.48407, 0, 0, 270) local Col = createColCuboid ( 1088, -2705.56226, 7.5, 5, 2, 4 ) local mover = moveObject local tiempo = setTimer function Elevador(player) local accName = getAccountName ( getPlayerAccount ( player ) ) -- get his account name if isObjectInACLGroup ("user.".. accName, aclGetGroup ( "Everyone" ) ) then mover(objeto ,5000 ,1090.67834, -2704.56226, 18, 0, 0, 0) tiempo (mover, 10000, 1, objeto, 5000, 1090.67834, -2704.56226, 9) end end addEventHandler("onColShapeHit", Col, Elevador) local objeto2 = createObject ( 2669, 1111.05212, -3085.17236, 3.55537, 0, 0, 270) local Col2 = createColCuboid ( 1088, 1111.05212, -3085.17236, 3.55537 ) function Elevador2(player) local accName = getAccountName ( getPlayerAccount ( player ) ) -- get his account name if isObjectInACLGroup ("user.".. accName, aclGetGroup ( "Everyone" ) ) then mover(objeto2 ,5000 ,1111.05212, -3085.17236, 3.55537) tiempo (mover, 10000, 1, objeto2, 5000, 1111.05212, -3085.17236, 3.55537) end end function col2Hit (hitPlayer) if ( hitPlayer == localPlayer ) then guiSetVisible (GUIEditor_Window[1], true) showCursor (true) end end addEventHandler ("onClientColShapeHit", Col2, col2Hit) function crearmygui() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Edit = {} GUIEditor_Window[1] = guiCreateWindow(195,167,372,244,"Gui Sistema De Mover Objetos",false) GUIEditor_Button[1] = guiCreateButton(61,123,231,49,"Mover",false,GUIEditor_Window[1]) GUIEditor_Edit[1] = guiCreateEdit(53,63,256,44,"Porfavor Pon la Contraseña Correcta----",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(60,180,233,52,"Cancelar",false,GUIEditor_Window[1]) end end
Vision Posted March 25, 2012 Posted March 25, 2012 (edited) Password like a command? Edited March 25, 2012 by Guest
drk Posted March 25, 2012 Posted March 25, 2012 This? GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Edit = {} GUIEditor_Window[1] = guiCreateWindow(195,167,372,244,"Gui Sistema De Mover Objetos",false) GUIEditor_Button[1] = guiCreateButton(61,123,231,49,"Mover",false,GUIEditor_Window[1]) GUIEditor_Edit[1] = guiCreateEdit(53,63,256,44,"Porfavor Pon la Contraseña Correcta----",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(60,180,233,52,"Cancelar",false,GUIEditor_Window[1]) guiSetVisible ( GUIEditor_Window[1], false ) local objeto = createObject ( 2669, 1090.67834, -2704.56226, 8.48407, 0, 0, 270) local Col = createColCuboid ( 1088, -2705.56226, 7.5, 5, 2, 4 ) addCommandHandler ( 'yourPassword', function ( ) moveObject ( objecto, 5000, 1090.67834, -2704.56226, 18, 0, 0, 0 ) setTimer ( moveObject, 10000, 1, objecto, 5000, 1090.67834, -2704.56226, 9 ) end ) local objeto2 = createObject ( 2669, 1111.05212, -3085.17236, 3.55537, 0, 0, 270) local Col2 = createColCuboid ( 1088, 1111.05212, -3085.17236, 3.55537 ) addCommandHandler ( 'yourPassword', function ( ) moveObject ( objecto2, 5000, 1111.05212, -3085.17236, 3.55537 ) setTimer ( moveObject, 10000, 1, objecto2, 5000, 1111.05212, -3085.17236, 3.55537 ) end ) addEventHandler ( 'onClientColShapeHit', root, function ( ) if ( source == Col2 ) then guiSetVisible ( GUIEditor_Window[1], true ) showCursor ( true ) end end ) Change yourPassword to the password you want but don't delete ' '.
X-SHADOW Posted March 25, 2012 Posted March 25, 2012 or he can use if something == 'thebjectHere' and password == '1234' then moveObject
iFoReX Posted March 25, 2012 Author Posted March 25, 2012 Dont man I want when he type the password in my edit how said shadow help me please
drk Posted March 25, 2012 Posted March 25, 2012 Like this? GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Edit = {} GUIEditor_Window[1] = guiCreateWindow(195,167,372,244,"Gui Sistema De Mover Objetos",false) GUIEditor_Button[1] = guiCreateButton(61,123,231,49,"Mover",false,GUIEditor_Window[1]) GUIEditor_Edit[1] = guiCreateEdit(53,63,256,44,"Porfavor Pon la Contraseña Correcta----",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(60,180,233,52,"Cancelar",false,GUIEditor_Window[1]) guiSetVisible ( GUIEditor_Window[1], false ) local objeto = createObject ( 2669, 1090.67834, -2704.56226, 8.48407, 0, 0, 270) local Col = createColCuboid ( 1088, -2705.56226, 7.5, 5, 2, 4 ) addCommandHandler ( 'move', function ( move, password ) if ( password == 'yourPassword' ) then moveObject ( objecto, 5000, 1090.67834, -2704.56226, 18, 0, 0, 0 ) setTimer ( moveObject, 10000, 1, objecto, 5000, 1090.67834, -2704.56226, 9 ) else outputChatBox ( 'Incorrect password!' ); end end ) local objeto2 = createObject ( 2669, 1111.05212, -3085.17236, 3.55537, 0, 0, 270) local Col2 = createColCuboid ( 1088, 1111.05212, -3085.17236, 3.55537 ) addCommandHandler ( 'move2', function ( move, password ) if ( password == 'yourPassword' ) then moveObject ( objecto2, 5000, 1111.05212, -3085.17236, 3.55537 ) setTimer ( moveObject, 10000, 1, objecto2, 5000, 1111.05212, -3085.17236, 3.55537 ) else outputChatBox ( 'Incorrect password!' ); end end ) addEventHandler ( 'onClientColShapeHit', root, function ( ) if ( source == Col2 ) then guiSetVisible ( GUIEditor_Window[1], true ) showCursor ( true ) end end ) Example: /move 1234 /move2 1234 You need change yourPassword to your password.
iFoReX Posted March 25, 2012 Author Posted March 25, 2012 Dont man , something like : == 'guieditoredit[1]' and password == 'mypass' then
drk Posted March 25, 2012 Posted March 25, 2012 Ahh.. I forgot this GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Edit = {} GUIEditor_Window[1] = guiCreateWindow(195,167,372,244,"Gui Sistema De Mover Objetos",false) GUIEditor_Button[1] = guiCreateButton(61,123,231,49,"Mover",false,GUIEditor_Window[1]) GUIEditor_Edit[1] = guiCreateEdit(53,63,256,44,"Porfavor Pon la Contraseña Correcta----",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(60,180,233,52,"Cancelar",false,GUIEditor_Window[1]) guiSetVisible ( GUIEditor_Window[1], false ) local objeto = createObject ( 2669, 1090.67834, -2704.56226, 8.48407, 0, 0, 270) local Col = createColCuboid ( 1088, -2705.56226, 7.5, 5, 2, 4 ) addEventHandler ( 'onClientGUIClick', root, function ( ) if ( source == GUIEditor_Button[1] ) then local text = guiGetText ( GUIEditor_Edit[1] ) if ( text == 'yourPassword' ) then moveObject ( objecto, 5000, 1090.67834, -2704.56226, 18, 0, 0, 0 ) setTimer ( moveObject, 10000, 1, objecto, 5000, 1090.67834, -2704.56226, 9 ) else outputChatBox ( 'Incorrect password!' ); end end end ) local objeto2 = createObject ( 2669, 1111.05212, -3085.17236, 3.55537, 0, 0, 270) local Col2 = createColCuboid ( 1088, 1111.05212, -3085.17236, 3.55537 ) addEventHandler ( 'onClientGUIClick', root, function ( ) if ( source == GUIEditor_Button[1] ) then local text = guiGetText ( GUIEditor_Edit[1] ) if ( text == 'yourPassword' ) then moveObject ( objecto2, 5000, 1111.05212, -3085.17236, 3.55537 ) setTimer ( moveObject, 10000, 1, objecto2, 5000, 1111.05212, -3085.17236, 3.55537 ) else outputChatBox ( 'Incorrect password!' ); end end end ) addEventHandler ( 'onClientColShapeHit', root, function ( ) if ( source == Col2 ) then guiSetVisible ( GUIEditor_Window[1], true ) showCursor ( true ) end end )
iFoReX Posted March 25, 2012 Author Posted March 25, 2012 this is the debbugging [2012-03-26 09:11:50] Rejas restarted successfully [2012-03-26 09:12:02] restart: Requested by Console [2012-03-26 09:12:02] restart: Resource restarting... [2012-03-26 09:12:02] Stopping Rejas [2012-03-26 09:12:02] Resource 'Rejas' changed, reloading and starting [2012-03-26 09:12:02] WARNING: Rejas/xD.lua [Server] is encoded in ANSI instead of UTF-8. Please convert your file to UTF-8. [2012-03-26 09:12:02] Some files in 'Rejas' use deprecated functions. [2012-03-26 09:12:02] Use the 'upgrade' command to perform a basic upgrade of resources. [2012-03-26 09:12:02] Starting Rejas [2012-03-26 09:12:02] WARNING: Script 'Rejas\xD.lua' is not encoded in UTF-8. Loading as ANSI... [2012-03-26 09:12:02] ERROR: Rejas\.lua:6: attempt to call global 'GuiCreateWindow' (a nil value) [2012-03-26 09:12:02] Rejas restarted successfully
drk Posted March 25, 2012 Posted March 25, 2012 I'm talking about debugscript not about console log lol
drk Posted March 25, 2012 Posted March 25, 2012 Copy my code again. Maybe you copied old code. I edited it.
iFoReX Posted March 25, 2012 Author Posted March 25, 2012 Ahh.. I forgot this GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Edit = {} GUIEditor_Window[1] = guiCreateWindow(195,167,372,244,"Gui Sistema De Mover Objetos",false) GUIEditor_Button[1] = guiCreateButton(61,123,231,49,"Mover",false,GUIEditor_Window[1]) GUIEditor_Edit[1] = guiCreateEdit(53,63,256,44,"Porfavor Pon la Contraseña Correcta----",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(60,180,233,52,"Cancelar",false,GUIEditor_Window[1]) guiSetVisible ( GUIEditor_Window[1], false ) local objeto = createObject ( 2669, 1090.67834, -2704.56226, 8.48407, 0, 0, 270) local Col = createColCuboid ( 1088, -2705.56226, 7.5, 5, 2, 4 ) addEventHandler ( 'onClientGUIClick', root, function ( ) if ( source == GUIEditor_Button[1] ) then local text = guiGetText ( GUIEditor_Edit[1] ) if ( text == 'yourPassword' ) then moveObject ( objecto, 5000, 1090.67834, -2704.56226, 18, 0, 0, 0 ) setTimer ( moveObject, 10000, 1, objecto, 5000, 1090.67834, -2704.56226, 9 ) else outputChatBox ( 'Incorrect password!' ); end end end ) local objeto2 = createObject ( 2669, 1111.05212, -3085.17236, 3.55537, 0, 0, 270) local Col2 = createColCuboid ( 1088, 1111.05212, -3085.17236, 3.55537 ) addEventHandler ( 'onClientGUIClick', root, function ( ) if ( source == GUIEditor_Button[1] ) then local text = guiGetText ( GUIEditor_Edit[1] ) if ( text == 'yourPassword' ) then moveObject ( objecto2, 5000, 1111.05212, -3085.17236, 3.55537 ) setTimer ( moveObject, 10000, 1, objecto2, 5000, 1111.05212, -3085.17236, 3.55537 ) else outputChatBox ( 'Incorrect password!' ); end end end ) addEventHandler ( 'onClientColShapeHit', root, function ( ) if ( source == Col2 ) then guiSetVisible ( GUIEditor_Window[1], true ) showCursor ( true ) end end ) This post Or Dont ?
drk Posted March 25, 2012 Posted March 25, 2012 (edited) Here: GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Edit = {} GUIEditor_Window[1] = guiCreateWindow(195,167,372,244,"Gui Sistema De Mover Objetos",false) GUIEditor_Button[1] = guiCreateButton(61,123,231,49,"Mover",false,GUIEditor_Window[1]) GUIEditor_Edit[1] = guiCreateEdit(53,63,256,44,"Porfavor Pon la Contraseña Correcta----",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(60,180,233,52,"Cancelar",false,GUIEditor_Window[1]) guiSetVisible ( GUIEditor_Window[1], false ) local objeto = createObject ( 2669, 1090.67834, -2704.56226, 8.48407, 0, 0, 270) local Col = createColCuboid ( 1088, -2705.56226, 7.5, 5, 2, 4 ) addEventHandler ( 'onClientGUIClick', root, function ( ) if ( source == GUIEditor_Button[1] ) then local text = guiGetText ( GUIEditor_Edit[1] ) if ( text == 'yourPassword' ) then moveObject ( objeto, 5000, 1090.67834, -2704.56226, 18, 0, 0, 0 ) setTimer ( moveObject, 10000, 1, objeto, 5000, 1090.67834, -2704.56226, 9 ) else outputChatBox ( 'Incorrect password!' ); end end end ) local objeto2 = createObject ( 2669, 1111.05212, -3085.17236, 3.55537, 0, 0, 270) local Col2 = createColCuboid ( 1088, 1111.05212, -3085.17236, 3.55537 ) addEventHandler ( 'onClientGUIClick', root, function ( ) if ( source == GUIEditor_Button[1] ) then local text = guiGetText ( GUIEditor_Edit[1] ) if ( text == 'yourPassword' ) then moveObject ( objeto2, 5000, 1111.05212, -3085.17236, 3.55537 ) setTimer ( moveObject, 10000, 1, objeto2, 5000, 1111.05212, -3085.17236, 3.55537 ) else outputChatBox ( 'Incorrect password!' ); end end end ) addEventHandler ( 'onClientColShapeHit', root, function ( ) if ( source == Col or source == Col2 ) then guiSetVisible ( GUIEditor_Window[1], true ) showCursor ( true ) end end ) It should work now. Edited March 25, 2012 by Guest
iFoReX Posted March 25, 2012 Author Posted March 25, 2012 1. I change my meta.xml my script to Client-Side 2. Now Appear the objects but dont the GUI
iFoReX Posted March 26, 2012 Author Posted March 26, 2012 draken yeah it work but 2 problems 1. When the elevator Up I dont view Up only the player flying 2. When a player is in a col to all players appear the GUI
Jaysds1 Posted March 26, 2012 Posted March 26, 2012 ok, when you trigger "onClientColShapeHit" you can't specifically tell the script your talking about that colshape, so try triggering it from server-side.
Castillo Posted March 26, 2012 Posted March 26, 2012 @ElMota: You may want to take a look at this tutorial: https://wiki.multitheftauto.com/wiki/Scr ... Tutorial_2 It explains you how to create gates with passwords ( even with a GUI keypad ).
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