JkR Posted January 23, 2015 Posted January 23, 2015 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 )
Calculador Posted January 24, 2015 Posted January 24, 2015 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.
JkR Posted January 24, 2015 Author Posted January 24, 2015 Y no funciona de que manera? que hace? El objeto se crea, pero al acercarse no se abre
JkR Posted January 24, 2015 Author Posted January 24, 2015 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
Platin Posted January 24, 2015 Posted January 24, 2015 Una respuesta rápida. En vez de: if ( playerTeam ) == Clann then no debería de ser: if ( playerTeam ) == "Clann" then
DBY Posted January 24, 2015 Posted January 24, 2015 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.
Platin Posted January 24, 2015 Posted January 24, 2015 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)?
Tomas Posted January 24, 2015 Posted January 24, 2015 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.
Calculador Posted January 24, 2015 Posted January 24, 2015 Exacto lo que dice Tomás es cierto, por eso le puse player, porque en su script incial él tenía pla como argumento y definía player.
JkR Posted January 25, 2015 Author Posted January 25, 2015 Entonces, cual es el error? porque sigue sin funcionar
Platin Posted January 25, 2015 Posted January 25, 2015 ¿Qué errores te tira en el debugscript? Algun error en el debugscript? ninguno ...
Calculador Posted January 26, 2015 Posted January 26, 2015 ¿Qué errores te tira en el debugscript? Algun error en el debugscript? ninguno ... Me refiero respecto al codigo que yo le pase, no el que tenía inicialmente.
alex17 Posted January 26, 2015 Posted January 26, 2015 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 )
JkR Posted January 26, 2015 Author Posted January 26, 2015 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
JkR Posted January 26, 2015 Author Posted January 26, 2015 ¿Qué errores te tira en el debugscript?Me refiero respecto al codigo que yo le pase, no el que tenía inicialmente. Tampoco tira errores el debugscript con ese
Recommended Posts