eldelahoz Posted August 24, 2013 Posted August 24, 2013 Hola como lo dice el titulo quisiera saber como puedo hacer para que una puerta se mueva por un solo comando ya tengo para que se mueva automatica pero quiero saber que ago para ponerla por comando me ayudarian por favor objeto1 = createObject ( 980, 1067.3994140625, 1362, 12.300000190735, 0, 0, 0 ) x,y,z = getElementPosition (objeto1) Zona1 = createColCuboid(1060.5809326172, 1353.7885742188, 10, 14.25, 16.5, 4.75) function Funcion1 (source) if ( getElementData ( source, "gang" ) == "Clan" ) then moveObject ( objeto1, 2000, 1067.3994140625, 1362, 18, 0, 0, 0 ) outputChatBox ( "Bienvenido", source, 0, 255, 0, true ) else outputChatBox ( "Tu no eres de Clan!", source, 255, 0, 0, true ) end end addEventHandler ( "onColShapeHit", Zona1, Funcion1 ) function Funcion2 () moveObject ( objeto1, 2000, 1067.3994140625, 1362, 12.300000190735, 0, 0, 0 ) outputChatBox ( "Abandonando Base!", source, 0, 255, 0, true ) end addEventHandler ( "onColShapeLeave", Zona1, Funcion2 )
eldelahoz Posted August 24, 2013 Author Posted August 24, 2013 mmm si yo se pero que orden usaria asi objeto1 = createObject ( 980, 1067.3994140625, 1362, 12.300000190735, 0, 0, 0 ) function Funcion1 (source) if ( getElementData ( source, "gang" ) == "Clan" ) then moveObject ( objeto1, 2000, 1067.3994140625, 1362, 18, 0, 0, 0 ) outputChatBox ( "Bienvenido", source, 0, 255, 0, true ) else outputChatBox ( "Tu no eres de Clan!", source, 255, 0, 0, true ) end end addEventHandler ( "onColShapeHit", Funcion1 ) addCommandHandler ("abrir", Funcion1 ) function Funcion2 () moveObject ( objeto1, 2000, 1067.3994140625, 1362, 12.300000190735, 0, 0, 0 ) outputChatBox ( "Abandonando Base!", source, 0, 255, 0, true ) end addEventHandler ( "onColShapeLeave", Funcion2 ) addCommandHandler ("abrir", Funcion2 ) o asi objeto1 = createObject ( 980, 1067.3994140625, 1362, 12.300000190735, 0, 0, 0 ) addCommandHandler ("abrir", function Funcion1 (source) if ( getElementData ( source, "gang" ) == "Clan" ) then moveObject ( objeto1, 2000, 1067.3994140625, 1362, 18, 0, 0, 0 ) outputChatBox ( "Bienvenido", source, 0, 255, 0, true ) else outputChatBox ( "Tu no eres de Clan!", source, 255, 0, 0, true ) end end addEventHandler ( "onColShapeHit", Funcion1 ) ) addCommandHandler ("abrir", function Funcion2 () moveObject ( objeto1, 2000, 1067.3994140625, 1362, 12.300000190735, 0, 0, 0 ) outputChatBox ( "Abandonando Base!", source, 0, 255, 0, true ) end addEventHandler ( "onColShapeLeave", Funcion2 ) )
eldelahoz Posted August 24, 2013 Author Posted August 24, 2013 me dice Bad argument @"addEventHandler" [Expected element at argument 2, got funcion
Castillo Posted August 24, 2013 Posted August 24, 2013 objeto1 = createObject ( 980, 1067.3994140625, 1362, 12.300000190735, 0, 0, 0 ) function Funcion1 ( source ) if ( getElementData ( source, "gang" ) == "Clan" ) then moveObject ( objeto1, 2000, 1067.3994140625, 1362, 18, 0, 0, 0 ) outputChatBox ( "Bienvenido", source, 0, 255, 0, true ) else outputChatBox ( "Tu no eres de Clan!", source, 255, 0, 0, true ) end end addCommandHandler ( "abrir", Funcion1 ) function Funcion2 ( ) moveObject ( objeto1, 2000, 1067.3994140625, 1362, 12.300000190735, 0, 0, 0 ) outputChatBox ( "Abandonando Base!", source, 0, 255, 0, true ) end addCommandHandler ( "abrir", Funcion2 )
eldelahoz Posted August 24, 2013 Author Posted August 24, 2013 tengo un problema uso el mismo comando y no se baja
Castillo Posted August 24, 2013 Posted August 24, 2013 Ambos comandos son el mismo, cambia uno a "cerrar" o crea una variable para definir el estado de la puerta.
eldelahoz Posted August 24, 2013 Author Posted August 24, 2013 es para mover por un solo comando como ago la variable
Castillo Posted August 24, 2013 Posted August 24, 2013 local objeto1 = createObject ( 980, 1067.3994140625, 1362, 12.300000190735, 0, 0, 0 ) local state = false function Funcion1 ( source ) if ( getElementData ( source, "gang" ) == "Clan" ) then if ( not state ) then moveObject ( objeto1, 2000, 1067.3994140625, 1362, 18, 0, 0, 0 ) outputChatBox ( "Bienvenido", source, 0, 255, 0, true ) state = true else moveObject ( objeto1, 2000, 1067.3994140625, 1362, 12.300000190735, 0, 0, 0 ) outputChatBox ( "Abandonando Base!", source, 0, 255, 0, true ) state = false end else outputChatBox ( "Tu no eres de Clan!", source, 255, 0, 0, true ) end end addCommandHandler ( "abrir", Funcion1 )
eldelahoz Posted August 24, 2013 Author Posted August 24, 2013 No aparece ningun error pero no se mueve la puerta ._.
eldelahoz Posted August 24, 2013 Author Posted August 24, 2013 Lo tengo asi por que le quite los mensajes local objeto4 = createObject ( 980, 1037.3000488281, 1304.0999755859, 22.5, 0, 0, 180 ) local state1 = false function Funcion7 ( source ) if ( getElementData ( source, "gang" ) == "Clan" ) then if ( not state1 ) then moveObject ( objeto4, 2000, 1037.3000488281, 1304.0999755859, 28.5, 0, 0, 0 ) else state1 = true moveObject ( objeto4, 2000, 1037.3000488281, 1304.0999755859, 22.5, 0, 0, 0 ) state1 = false end end end addCommandHandler ( "LGTentradap", Funcion7 )
Castillo Posted August 24, 2013 Posted August 24, 2013 Ahi tenes el problema, al cambiar el codigo, le cambiaste de posicion a una de las variables.
Castillo Posted August 24, 2013 Posted August 24, 2013 local objeto4 = createObject ( 980, 1037.3000488281, 1304.0999755859, 22.5, 0, 0, 180 ) local state1 = false function Funcion7 ( source ) if ( getElementData ( source, "gang" ) == "Clan" ) then if ( not state1 ) then moveObject ( objeto4, 2000, 1037.3000488281, 1304.0999755859, 28.5, 0, 0, 0 ) state1 = true -- Habias movido esta variable. else moveObject ( objeto4, 2000, 1037.3000488281, 1304.0999755859, 22.5, 0, 0, 0 ) state1 = false end end end addCommandHandler ( "LGTentradap", Funcion7 )
Recommended Posts