Jump to content

[Ayuda] Puerta


Narutimmy

Recommended Posts

Hola bueno ise este script... pero no me crea la puerta... me ayudan??

----------- Puerta 1------------ 
  
objeto1 = createObject ( 13028, -2563.19995, 580.40002, 15.3, 0, 0, 0 ) 
setObjectScale ( objeto1, 5) 
  
  
  
  
  
  
  
  
Estado = true 
  
  
  
  
function Funcion1 (source) 
if ( getElementData ( source, "gang" ) == "XANA" ) and (Estado == true) then 
        moveObject ( objeto1, 2000, -2563.19995, 580.40002, 5, 0, 0, 0 ) 
    outputChatBox ( "Bienvenido", source, 0, 255, 0, true ) 
    Estado = false 
    elseif ( getElementData ( source, "gang" ) == "XANA" ) and (Estado == false) 
    Estado = true 
    moveObject ( objeto1, 2000, -2563.19995, 580.40002, 15.3, 0, 0, 0 ) 
    outputChatBox ( "Cerrando Puerta", source, 255, 0, 0, true ) 
end 
end 
  
 addCommandHandler ( "BS", Funcion1 ) 

Link to comment
  
Funcion1 = createObject ( 13028, -2563.19995, 580.40002, 15.3, 0, 0, 0) 
 isMoved = false 
function Funcion1(player) 
--if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)),aclGetGroup("EJEMPLO")) then ----  ACL si gustas añadirlo 
    if not isMoved then 
         moveObject (objeto1, 2500, -2563.19995, 580.40002, 5, 0, 0, 0) 
      outputChatBox("Bienvenido", player, 255,255,0, true) 
    else 
         moveObject (objeto1, -2563.19995, 580.40002, 15.3, 0, 0, 0) 
      outputChatBox("Cerrando Puerta.", player, 255,255,0, true) 
    end 
    isMoved = not isMoved 
end 
end 
  
      
 addCommandHandler("BS", Funcion1) 
  

seria algo asi no ? :roll:

Link to comment
  
Funcion1 = createObject ( 13028, -2563.19995, 580.40002, 15.3, 0, 0, 0) 
 isMoved = false 
function Funcion1(player) 
--if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)),aclGetGroup("EJEMPLO")) then ----  ACL si gustas añadirlo 
    if not isMoved then 
         moveObject (objeto1, 2500, -2563.19995, 580.40002, 5, 0, 0, 0) 
      outputChatBox("Bienvenido", player, 255,255,0, true) 
    else 
         moveObject (objeto1, -2563.19995, 580.40002, 15.3, 0, 0, 0) 
      outputChatBox("Cerrando Puerta.", player, 255,255,0, true) 
    end 
    isMoved = not isMoved 
end 
end 
  
      
 addCommandHandler("BS", Funcion1) 
  

seria algo asi no ? :roll:

pero para aumentarle la scala al objeto?

Link to comment
  
Funcion1 = createObject ( 13028, -2563.19995, 580.40002, 15.3, 0, 0, 0) 
 isMoved = false 
 setObjectScale ( objeto1, 5 ) 
  
function Funcion1(player) 
--if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)),aclGetGroup("EJEMPLO")) then ----  ACL si gustas añadirlo 
    if not isMoved then 
         moveObject (objeto1, 2500, -2563.19995, 580.40002, 5, 0, 0, 0) 
      outputChatBox("Bienvenido", player, 255,255,0, true) 
    else 
         moveObject (objeto1, 2500,-2563.19995, 580.40002, 15.3, 0, 0, 0) 
      outputChatBox("Cerrando Puerta.", player, 255,255,0, true) 
    end 
    isMoved = not isMoved 
end 
end 
  
      
 addCommandHandler("BS", Funcion1) 

perdón por el fallo puedes intentar con este

Edited by Guest
Link to comment

Tienes un error horrendo al comienzo al llamar a la variable de objeto como "Funcion1", tendría que ser así mira:

objeto1 = createObject ( 13028, -2563.19995, 580.40002, 15.3, 0, 0, 0) 
 isMoved = false 
 setObjectScale ( objeto1, 5 ) 
  
function Funcion1(player) 
--if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)),aclGetGroup("EJEMPLO")) then ----  ACL si gustas añadirlo 
    if not isMoved then 
         moveObject (objeto1, 2500, -2563.19995, 580.40002, 5, 0, 0, 0) 
      outputChatBox("Bienvenido", player, 255,255,0, true) 
    else 
         moveObject (objeto1, 2500,-2563.19995, 580.40002, 15.3, 0, 0, 0) 
      outputChatBox("Cerrando Puerta.", player, 255,255,0, true) 
    end 
    isMoved = not isMoved 
end 
end 
  
      
 addCommandHandler("BS", Funcion1) 

Link to comment
Tienes un error horrendo al comienzo al llamar a la variable de objeto como "Funcion1", tendría que ser así mira:
objeto1 = createObject ( 13028, -2563.19995, 580.40002, 15.3, 0, 0, 0) 
 isMoved = false 
 setObjectScale ( objeto1, 5 ) 
  
function Funcion1(player) 
--if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)),aclGetGroup("EJEMPLO")) then ----  ACL si gustas añadirlo 
    if not isMoved then 
         moveObject (objeto1, 2500, -2563.19995, 580.40002, 5, 0, 0, 0) 
      outputChatBox("Bienvenido", player, 255,255,0, true) 
    else 
         moveObject (objeto1, 2500,-2563.19995, 580.40002, 15.3, 0, 0, 0) 
      outputChatBox("Cerrando Puerta.", player, 255,255,0, true) 
    end 
    isMoved = not isMoved 
end 
end 
  
      
 addCommandHandler("BS", Funcion1) 

sep ,ya note el error jeje , gracias.

Link to comment
  • Administrators

Se soluciona cambiando la logica de la funcion utilizando:

getElementPosition 
  

Y comparando lo que obtiene con tus 2 valores..

Tambien seria util utilizar la funcion(para comprobar si la puerta esta en movimiento y cancelar la ejecucion del comando):

function isElementMoving(theElement) 
    if isElement(theElement)then --First check if the given argument is an element 
        local x, y, z = getElementVelocity(theElement) --Get the velocity of the element given in our argument 
            return x ~= 0 or y ~= 0 or z ~= 0 --When there is a movement on X, Y or Z return true because our element is moving 
    end 
    return false 
end 
  

Asi lo uso yo, y funciona lo mas bien (Funcion Util de aqui: https://wiki.multitheftauto.com/wiki/IsElementMoving

Link to comment
  • Recently Browsing   0 members

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