Jump to content

[Help/Ayuda] Puerta automatica


JkR

Recommended Posts

Hola estoy intentando hacer una puerta automanica que se abra cuando estes dentro de un colshape y este privatizada por team, este es mi script pero no funciona, espero que ustedes me puedan dar una solucion, gracias

col  = createColTube (145.69999694824, 1917, 20.7, 2, 3) 
root = getRootElement () 
  
othergate1 = createObject ( 980, 145.69999694824, 1917, 20.7, 0, 0, 90)  
                                  
function Open ( pla ) 
    if getElementType ( player ) == "player" then 
        playerTeam = getPlayerTeam ( source ) 
          Clann = getTeamFromName ( "Rebeldes" ) 
            if ( playerTeam ) == Clann then 
            moveObject (othergate1, 1000, 145.69, 1904.4000244141, 20.7)  
end  
end 
end  
addEventHandler ( "onColShapeHit", col, Open) 
  
function Close ( pla ) 
    if getElementType ( player ) == "player" then 
        playerTeam = getPlayerTeam ( source ) 
          Clann = getTeamFromName ( "Rebeldes" ) 
            if ( playerTeam ) == Clann then 
            moveObject (othergate1, 1000, 145.69999694824, 1917, 20.7)  
end 
end 
end 
addEventHandler ( "onColShapeLeave", col, Close ) 
  

Link to comment

Prueba así, dime que ocurre:

  
col  = createColTube (145.69999694824, 1917, 20.7, 2, 3) 
root = getRootElement () 
  
othergate1 = createObject ( 980, 145.69999694824, 1917, 20.7, 0, 0, 90) 
                                  
function Open ( player ) 
    if getElementType ( player ) == "player" then 
        playerTeam = getPlayerTeam ( player ) 
          Clann = getTeamFromName ( "Rebeldes" ) 
            if ( playerTeam ) == Clann then 
            moveObject (othergate1, 1000, 145.69, 1904.4000244141, 20.7) 
end 
end 
end 
addEventHandler ( "onColShapeHit", col, Open) 
  
function Close ( player ) 
    if getElementType ( player ) == "player" then 
        playerTeam = getPlayerTeam ( player ) 
          Clann = getTeamFromName ( "Rebeldes" ) 
            if ( playerTeam ) == Clann then 
            moveObject (othergate1, 1000, 145.69999694824, 1917, 20.7) 
end 
end 
end 
addEventHandler ( "onColShapeLeave", col, Close ) 
  

PSD: Sin probar.

Link to comment
Prueba así, dime que ocurre:
  
col  = createColTube (145.69999694824, 1917, 20.7, 2, 3) 
root = getRootElement () 
  
othergate1 = createObject ( 980, 145.69999694824, 1917, 20.7, 0, 0, 90) 
                                  
function Open ( player ) 
    if getElementType ( player ) == "player" then 
        playerTeam = getPlayerTeam ( player ) 
          Clann = getTeamFromName ( "Rebeldes" ) 
            if ( playerTeam ) == Clann then 
            moveObject (othergate1, 1000, 145.69, 1904.4000244141, 20.7) 
end 
end 
end 
addEventHandler ( "onColShapeHit", col, Open) 
  
function Close ( player ) 
    if getElementType ( player ) == "player" then 
        playerTeam = getPlayerTeam ( player ) 
          Clann = getTeamFromName ( "Rebeldes" ) 
            if ( playerTeam ) == Clann then 
            moveObject (othergate1, 1000, 145.69999694824, 1917, 20.7) 
end 
end 
end 
addEventHandler ( "onColShapeLeave", col, Close ) 
  

PSD: Sin probar.

Sigue sin funcionar

Link to comment
Una respuesta rápida. En vez de:
if ( playerTeam ) == Clann then 

no debería de ser:

if ( playerTeam ) == "Clann" then 

No, porque 'Clann' es una variable.

¿Y los

if getElementType ( player ) == "player" then 

por

if getElementType ( source ) == "player" then 

Porque, si sabes que es player, ¿para que lo quieres re-saber (no me sale la palabra)?

Link to comment
Una respuesta rápida. En vez de:
if ( playerTeam ) == Clann then 

no debería de ser:

if ( playerTeam ) == "Clann" then 

No, porque 'Clann' es una variable.

¿Y los

if getElementType ( player ) == "player" then 

por

if getElementType ( source ) == "player" then 

Porque, si sabes que es player, ¿para que lo quieres re-saber (no me sale la palabra)?

No, realmente no se sabe que 'player' es un player, a la colshape puede entrar un ped, un vehiculo, una colshape, un objeto, etc... por eso la comparación.

Link to comment

prueva con esto

othergate1= createObject ( 980, 2309.6000976563, 555.09997558594, 12.199999809265, 0 ,0 ,0 ) 
x,y,z = getElementPosition (othergate1) 
col = createColCircle ( x,y, 10, 10 ) 
  
function Open () 
        if getElementType ( source ) == "player" then 
            playerTeam = getPlayerTeam ( source ) 
              Clann = getTeamFromName ( "Rebeldes" ) 
        if ( playerTeam ) == Clann then 
            moveObject (othergate1, 1000, 145.69, 1904.4000244141, 20.7) 
          end 
       end 
    end 
addEventHandler ( "onColShapeHit", col, Open ) 
  
  
function Close () 
        if getElementType ( source ) == "player" then 
            playerTeam = getPlayerTeam ( source ) 
              Clann = getTeamFromName ( "Rebeldes" ) 
        if ( playerTeam ) == Clann then 
                moveObject (othergate1, 1000, 145.69999694824, 1917, 20.7) 
          end 
       end 
    end 
addEventHandler ( "onColShapeLeave", col, Close ) 

Link to comment
prueva con esto
othergate1= createObject ( 980, 2309.6000976563, 555.09997558594, 12.199999809265, 0 ,0 ,0 ) 
x,y,z = getElementPosition (othergate1) 
col = createColCircle ( x,y, 10, 10 ) 
  
function Open () 
        if getElementType ( source ) == "player" then 
            playerTeam = getPlayerTeam ( source ) 
              Clann = getTeamFromName ( "Rebeldes" ) 
        if ( playerTeam ) == Clann then 
            moveObject (othergate1, 1000, 145.69, 1904.4000244141, 20.7) 
          end 
       end 
    end 
addEventHandler ( "onColShapeHit", col, Open ) 
  
  
function Close () 
        if getElementType ( source ) == "player" then 
            playerTeam = getPlayerTeam ( source ) 
              Clann = getTeamFromName ( "Rebeldes" ) 
        if ( playerTeam ) == Clann then 
                moveObject (othergate1, 1000, 145.69999694824, 1917, 20.7) 
          end 
       end 
    end 
addEventHandler ( "onColShapeLeave", col, Close ) 

Con eso ni si quiera crea el objeto y no manda ningun mensaje el debug

Link to comment
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...