DarkNeSsOak

[Ayuda] Warning got vehicle

Recommended Posts

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 by DarkNeSsOak

Share this post


Link to post

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. 

Share this post


Link to post

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 by #Dv^

Share this post


Link to post

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 )

 

Share this post


Link to post

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.