Jump to content

Ajuda Criar marker com teleporte


Recommended Posts

Posted (edited)

Boa Noite 

Vim Aqui pedir uma ajuda queria saber como colocar um marker no chao teleportando para um interior alguem pode ajudar ?

 

Edited by kazhxie
Posted (edited)
  • Primeiro você tem que obter as coordenadas do marker de entrar/saida.
  • Depois pegar as coordenadas do local onde quer que o jogador teleporte quando colidir no marker de entrada.
  • Depois pegar as coordenadas do local onde quer que o jogador teleporte quando colidir no marker de saida.
  • Fiz este script de exemplo pra você, teste e vê se funciona, se der erro deixe aqui em baixo, aonde tem x,y,z coloque as coordenadas do local.
  • Comentei o código para você entender melhor.

 

local entrarInterior = createMarker(x, y, z, 'cylinder', 1.0, 0, 255, 255, 0 ) -- Local onde o marker de entrada ira ser criado.
local sairInterior = createMarker(x, y, z, 'cylinder', 1.0, 0, 255, 255, 0 ) -- Local onde o marker de saida ira ser criado.
--/--
function entrarLocal ( hitElement, matchingDimension )
    if getElementType( hitElement ) == "player" and not isPedInVehicle(hitElement) then -- Se o elemento que colidir for um player e não um veículo então: 
        setElementPosition(hitElement, x, y, z) -- Posição que o jogador ira teleportar quando entrar.    
	end
end
addEventHandler( "onMarkerHit", entrarInterior , entrarLocal ) 
--/--
function sairLocal ( hitElement, matchingDimension )
    if getElementType( hitElement ) == "player" and not isPedInVehicle(hitElement) then  -- Se o elemento que colidir for um player e não um veículo então:  
		setElementPosition(hitElement, x, y, z) -- Posição que o player ira teleportar para sair.    
	end
end
addEventHandler( "onMarkerHit", sairInterior , sairLocal ) 

 

Edited by OverKILL
  • Thanks 1
Posted (edited)

Fiz uma alteração no código:

O marker não estava criando arrumei o tamanho :

local entrarInterior = createMarker(x, y, z, 'cylinder', 1.5, 255, 255, 0, 170 ) -- Local onde o marker de entrada ira ser criado.
local sairInterior = createMarker(x,y,z, 'cylinder', 1.5, 255, 255, 0, 170 ) -- Local onde o marker de saida ira ser criado.
--/--
function entrarLocal ( hitElement, matchingDimension )
    if getElementType( hitElement ) == "player" and not isPedInVehicle(hitElement) then -- Se o elemento que colidir for um player e não estiver em um veículo então: 
        setElementPosition(hitElement, x, y, z) -- Posição que o jogador ira teleportar quando entrar.    
	end
end
addEventHandler( "onMarkerHit", entrarInterior , entrarLocal ) 
--/--
function sairLocal ( hitElement, matchingDimension )
    if getElementType( hitElement ) == "player" and not isPedInVehicle(hitElement) then  -- Se o elemento que colidir for um player e não estiver em um veículo então:  
		setElementPosition(hitElement, x, y, z) -- Posição que o player ira teleportar para sair.    
	end
end
addEventHandler( "onMarkerHit", sairInterior , sairLocal ) 

Pra enviar o jogador para um interior use :

setElementInterior

 

Tente isso para teleportar para o interior:

local entrarInterior = createMarker(x, y, z, 'cylinder', 1.5, 255, 255, 0, 170 ) -- Local onde o marker de entrada ira ser criado.
local sairInterior = createMarker(x, y, z, 'cylinder', 1.5, 255, 255, 0, 170 ) -- Local onde o marker de saida ira ser criado.
--/--
function entrarLocal ( hitElement, matchingDimension )
    if getElementType( hitElement ) == "player" and not isPedInVehicle(hitElement) then -- Se o elemento que colidir for um player e não estiver em um veículo então:
		setElementPosition(hitElement, x, y, z) -- Posição Do Interior
        setElementInterior ( hitElement, ID INTERIOR ) -- Interior ID
	end
end
addEventHandler( "onMarkerHit", entrarInterior , entrarLocal ) 
--/--
function sairLocal ( hitElement, matchingDimension )
    if getElementType( hitElement ) == "player" and not isPedInVehicle(hitElement) then  -- Se o elemento que colidir for um player e não estiver em um veículo então:  
		setElementPosition(hitElement, x, y, z) -- Posição Do Interior
        setElementInterior ( hitElement, ID INTERIOR ) -- Interior ID  
	end
end
addEventHandler( "onMarkerHit", sairInterior , sairLocal ) 

Aqui esta a lista de interiores/posições x,y,z deles. só substituir no script que te passei

Lista de Interiores

Edited by OverKILL
  • Thanks 1
Posted

Des de já agradeço pela ajuda que me tens dado mas eu ainda estou com um problema e que mesmo adicionando Id´s ou coordenadas ele teleporta-me para o céu e não para o id ou coordenada que eu adicionei 

Comprimentos 

Posted (edited)
4 minutes ago, kazhxie said:

Des de já agradeço pela ajuda que me tens dado mas eu ainda estou com um problema e que mesmo adicionando Id´s ou coordenadas ele teleporta-me para o céu e não para o id ou coordenada que eu adicionei 

Comprimentos 

Eu testei aqui e funcionou, você deve ir no site e pegar as coordenadas e o respectivo ID de cada interior, e substituir no script 

Ex: Na posição do interior você vai colocar  a posição x, y , z do interior que você também encontra no site que eu passei.

Já no ID interior você vai por o ID que esta do lado da posição x,y,z eu adicionei um novo código sobre teleportar para o interior, atualize a página pode ser que você esteja usando o antigo.

Edited by OverKILL
Posted (edited)
local entrarInterior = createMarker(2424,-1742,14, 'cylinder', 1.5, 255, 255, 0, 170 ) -- Local onde o marker de entrada ira ser criado.
local sairInterior = createMarker(-27,-31,1004, 'cylinder', 1.5, 255, 255, 0, 170 ) -- Local onde o marker de saida ira ser criado.
--/--
function entrarLocal ( hitElement, matchingDimension )
    if getElementType( hitElement ) == "player" and not isPedInVehicle(hitElement) then -- Se o elemento que colidir for um player e não estiver em um veículo então:
        setElementPosition(hitElement, -26.691598,-55.714897,1003.546875) -- Posição Do Interior
        setElementInterior ( hitElement, 6 ) -- Interior ID
    end
end
addEventHandler( "onMarkerHit", entrarInterior , entrarLocal ) 
--/--
function sairLocal ( hitElement, matchingDimension )
    if getElementType( hitElement ) == "player" and not isPedInVehicle(hitElement) then  -- Se o elemento que colidir for um player e não estiver em um veículo então:  
        setElementPosition(hitElement, -26.691598,-55.714897,1003.546875) -- Posição Do Interior
        setElementInterior ( hitElement, 6 ) -- Interior ID  
    end
end
addEventHandler( "onMarkerHit", sairInterior , sairLocal ) 

Eu estou usando o codigo desta maneira mesmo assim ele teleportame para o céu estou a colocar alguma coisa de errado ?

Edited by kazhxie
Posted (edited)
16 minutes ago, kazhxie said:

local entrarInterior = createMarker(2424,-1742,14, 'cylinder', 1.5, 255, 255, 0, 170 ) -- Local onde o marker de entrada ira ser criado.
local sairInterior = createMarker(-27,-31,1004, 'cylinder', 1.5, 255, 255, 0, 170 ) -- Local onde o marker de saida ira ser criado.
--/--
function entrarLocal ( hitElement, matchingDimension )
    if getElementType( hitElement ) == "player" and not isPedInVehicle(hitElement) then -- Se o elemento que colidir for um player e não estiver em um veículo então:
        setElementPosition(hitElement, -26.691598,-55.714897,1003.546875) -- Posição Do Interior
        setElementInterior ( hitElement, 6 ) -- Interior ID
    end
end
addEventHandler( "onMarkerHit", entrarInterior , entrarLocal ) 
--/--
function sairLocal ( hitElement, matchingDimension )
    if getElementType( hitElement ) == "player" and not isPedInVehicle(hitElement) then  -- Se o elemento que colidir for um player e não estiver em um veículo então:  
        setElementPosition(hitElement, -26.691598,-55.714897,1003.546875) -- Posição Do Interior
        setElementInterior ( hitElement, 6 ) -- Interior ID  
    end
end
addEventHandler( "onMarkerHit", sairInterior , sairLocal ) 

Eu estou usando o codigo desta maneira mesmo assim ele teleportame para o céu estou a colocar alguma coisa de errado ?

Sim você está usando as mesmas coordenadas/interior pra entrar e sair, na função sair você coloca interior 0 e a posição aonde você quer que o jogador apareça quando sair do interior aconselho por um pouco pra frente do marker de entrada

Edited by OverKILL
Posted

Alterei o id e as coordenadas mas ele agora nao me me mostra o marker para sair mas dai fiz o /debugscript ele deu este erro no final 

 

 

 

Quote

 


local entrarInterior = createMarker(2424,-1742,14, 'cylinder', 1.5, 255, 255, 0, 170 ) -- Local onde o marker de entrada ira ser criado.
local sairInterior = createMarker(-27.23025894165,-57.432193756104,1003.546875, 'cylinder', 1.5, 255, 255, 0, 170 ) -- Local onde o marker de saida ira ser criado.
--/--
function entrarLocal ( hitElement, matchingDimension )
    if getElementType( hitElement ) == "player" and not isPedInVehicle(hitElement) then -- Se o elemento que colidir for um player e não estiver em um veículo então:
        setElementPosition(hitElement, -26.691598,-55.714897,1003.546875) -- Posição Do Interior
        setElementInterior ( hitElement, 6 ) -- Interior ID
    end
end
addEventHandler( "onMarkerHit", entrarInterior , entrarLocal ) 
--/--
function sairLocal ( hitElement, matchingDimension )
    if getElementType( hitElement ) == "player" and not isPedInVehicle(hitElement) then  -- Se o elemento que colidir for um player e não estiver em um veículo então:  
        setElementPosition(hitElement, 2422,-1740,14) -- Posição Do Interior
        setElementInterior ( hitElement, 0 ) -- Interior ID  
    end
end
addEventHandler( "onMarkerHit", sairInterior , sairLocal ) 

Gjv8OmR.png

 

 


  • Other Languages Moderators
Posted

Se você olhar na Wiki do guiLabelSetHorizontalAlign, verá que os parâmetros possíveis são somente "left", "center" e "right".

Você não deve tentar traduzir a Wiki pois a programação não é feita em português.

Posted (edited)
2 hours ago, kazhxie said:

Alterei o id e as coordenadas mas ele agora nao me me mostra o marker para sair mas dai fiz o /debugscript ele deu este erro no final 

 

 

 

 

 


Isso não tem nada ver com o script do marker, é sobre GUI, o marker não usa nem uma função GUI

Altere 'Centro' por center 

Bom encontrei alguns erros no código e os corrigi, agora esta 100%, já configurei seu marker aonde você queria só copiar e testar.

SERVER-SIDE

-- Entrada/Saida do marker 
local entrarInterior = createMarker (2423.2094726563, -1741.76171875, 13.546875, "cylinder", 1.0, 255, 0, 0, 255 )
local sairInterior = createMarker (-27.316999435425, -57.005474090576, 1003.546875, "cylinder", 1.0, 255, 0, 0, 255 ) 
--/-- INTERIOR
setElementInterior( sairInterior, 6 ) -- Seta o marker de saida no interior 6 no caso a loja.
--
function entrarLocal(thePlayer)
	if getElementType( thePlayer ) == "player" and not isPedInVehicle(thePlayer) then -- Se o elemento que colidir for um player e não estiver em um veículo então:
		if source == entrarInterior then
			setElementPosition(thePlayer, -26.718338012695, -55.58829498291, 1003.546875 ) -- Posição de Entrada no interior
			setElementInterior ( thePlayer, 6 ) -- Interior ID
		end	
	end
end
addEventHandler("onMarkerHit", getRootElement(), entrarLocal)

function sairLocal(thePlayer)
	if getElementType( thePlayer ) == "player" and not isPedInVehicle(thePlayer) then -- Se o elemento que colidir for um player e não estiver em um veículo então:
		if source == sairInterior then
			setElementPosition(thePlayer, 2420.1950683594, -1738.2489013672, 13.3828125 ) -- Posição de saida do interior
			setElementInterior ( thePlayer, 0 ) -- Interior ID
		end	
	end
end
addEventHandler("onMarkerHit", getRootElement(), sairLocal)

Qualquer coisa me avise, teste com debug ativado.

-EDIT - Como o LORD citou acima, quando estiver fazendo algum script usando a wiki, quando for copiar algo desative o tradutor da página, pois se colocar palavras em português onde não deve com certeza ira causar erros no seu script e não vai funcionar.

 

Edited by OverKILL
Posted

De alguma maneira os markers ficaram voando, eu corrigi isso, copie e cole a entrada/saida do marker.

-- Entrada/Saida do marker 
local entrarInterior = createMarker (2423.2094726563, -1741.76171875, 12.65, "cylinder", 1.0, 255, 0, 0, 255 )
local sairInterior = createMarker (-27.316999435425, -57.005474090576, 1002.60, "cylinder", 1.0, 255, 0, 0, 255 ) 

 

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.
×
×
  • Create New...