DarkNeSsOak Posted April 19, 2017 Share Posted April 19, 2017 (edited) Hola les agradecería la ayuda, no logro solucionar este warning. WARNING: [Nz]-CokData/puerta1.lua:31: Bad argument @ 'GetPlayerTeam [Expected player at argument 1, got vehicle] Tambien me pasa con la linea 7 ------- Creado por STORMALIXSCRIPTER' ---------- objeto = createObject ( 3115, 1447.6999511719, 664.70001220703, 5.3000001907349, 0, 90, 270 ) x,y,z = getElementPosition (objeto) Zona = createColCircle ( x,y, 5, 5 ) function Funcion (source) playerTeam = getPlayerTeam ( source ) Clann = getTeamFromName ( "*C.O.K*" ) if ( playerTeam ) == Clann then moveObject ( objeto, 2000, 1447.6999511719, 664.70001220703, -0.89999997615814, 0, 0, 0 ) outputChatBox ( "Bienvenido a C.O.K", source, 0, 255, 0, true ) else outputChatBox ( "Tu no eres del clan!", source, 255, 0, 0, true ) end end addEventHandler ( "onColShapeHit", Zona, Funcion ) function Funcion2 () moveObject ( objeto, 3000, 1447.6999511719, 664.70001220703, 5.3000001907349, 0, 0, 0 ) outputChatBox ( "Puerta Cerrandose", source, 0, 255, 0, true ) end addEventHandler ( "onColShapeLeave", Zona, Funcion2 ) -------Puerta2------------Puerta2----------------Puerta2------------------- objeto1 = createObject ( 3115, 1398.1999511719, 730.40002441406, 6.5, 0, 270, 0 ) x,y,z = getElementPosition (objeto1) Zona = createColCircle ( x,y, 5, 5 ) function Funcion (source) playerTeam = getPlayerTeam ( source ) Clann = getTeamFromName ( "*C.O.K*" ) if ( playerTeam ) == Clann then moveObject ( objeto1, 2000, 1398.1999511719, 730.40002441406, 1.2000000476837, 0, 0, 0 ) outputChatBox ( "Bienvenido a C.O.K", source, 0, 255, 0, true ) else outputChatBox ( "Tu no eres del clan!", source, 255, 0, 0, true ) end end addEventHandler ( "onColShapeHit", Zona, Funcion ) function Funcion2 () moveObject ( objeto1, 3000, 1398.1999511719, 730.40002441406, 6.5, 0, 0, 0 ) outputChatBox ( "Puerta Cerrandose", source, 0, 255, 0, true ) end addEventHandler ( "onColShapeLeave", Zona, Funcion2 ) Edited April 19, 2017 by DarkNeSsOak Link to comment
Calculador Posted April 19, 2017 Share Posted April 19, 2017 Lo que pasa es que tienes en argumento de getPlayerTeam al source, que en ese caso es el elemento que entra en la zona (onColShapeHit), pero en este caso estas ingresando un vehículo, por eso te da esa advertencia. Link to comment
DarkNeSsOak Posted April 19, 2017 Author Share Posted April 19, 2017 Lo tendría que reemplazar? por onColShapeHit Link to comment
#Dv^ Posted April 20, 2017 Share Posted April 20, 2017 (edited) Agregá la condición getElementType para que el objecto que entre al colshape sea un jugador y así no te saldrá error sobre otro objecto que no sea un jugador if getElementType(source) == "player" then Edited April 20, 2017 by #Dv^ Link to comment
Sticmy Posted April 20, 2017 Share Posted April 20, 2017 Lo que dijo #Dv^ acá te lo dejo hecho. ------- Creado por STORMALIXSCRIPTER' ---------- objeto = createObject ( 3115, 1447.6999511719, 664.70001220703, 5.3000001907349, 0, 90, 270 ) x,y,z = getElementPosition (objeto) Zona = createColCircle ( x,y, 5, 5 ) function Funcion (hitElement) if (getElementType(hitElement) == "player") then playerTeam = getPlayerTeam ( hitElement ) Clann = getTeamFromName ( "*C.O.K*" ) if ( playerTeam ) == Clann then moveObject ( objeto, 2000, 1447.6999511719, 664.70001220703, -0.89999997615814, 0, 0, 0 ) outputChatBox ( "Bienvenido a C.O.K", hitElement, 0, 255, 0, true ) else outputChatBox ( "Tu no eres del clan!", hitElement, 255, 0, 0, true ) end end end addEventHandler ( "onColShapeHit", Zona, Funcion ) function Funcion2 (leaveElement) if (getElementType(leaveElement) == "player") then moveObject ( objeto, 3000, 1447.6999511719, 664.70001220703, 5.3000001907349, 0, 0, 0 ) outputChatBox ( "Puerta Cerrandose", leaveElement, 0, 255, 0, true ) end end addEventHandler ( "onColShapeLeave", Zona, Funcion2 ) -------Puerta2------------Puerta2----------------Puerta2------------------- objeto1 = createObject ( 3115, 1398.1999511719, 730.40002441406, 6.5, 0, 270, 0 ) x,y,z = getElementPosition (objeto1) Zona = createColCircle ( x,y, 5, 5 ) function Funcion (hitElement) if (getElementType(hitElement) == "player") then playerTeam = getPlayerTeam ( hitElement ) Clann = getTeamFromName ( "*C.O.K*" ) if ( playerTeam ) == Clann then moveObject ( objeto1, 2000, 1398.1999511719, 730.40002441406, 1.2000000476837, 0, 0, 0 ) outputChatBox ( "Bienvenido a C.O.K", hitElement, 0, 255, 0, true ) else outputChatBox ( "Tu no eres del clan!", hitElement, 255, 0, 0, true ) end end addEventHandler ( "onColShapeHit", Zona, Funcion ) function Funcion2 (leaveElement) if (getElementType(leaveElement) == "player") then moveObject ( objeto1, 3000, 1398.1999511719, 730.40002441406, 6.5, 0, 0, 0 ) outputChatBox ( "Puerta Cerrandose", leaveElement, 0, 255, 0, true ) end end addEventHandler ( "onColShapeLeave", Zona, Funcion2 ) Link to comment
DarkNeSsOak Posted April 20, 2017 Author Share Posted April 20, 2017 Gracias @#Dv^ y @MarkFlash Link to comment
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