Jump to content

Entro no marker mas nada acontece


Recommended Posts

Estou começando a programar, então resolvi criar um script besta mas nem assim funcionou.

 

marker = createMarker(2101.368, -1801.239, 12.5, "cylinder", 1, 0, 255, 0, 200 )

function startJob()
	carro = createVehicle(448, 2097.831, -1801.282, 13.383)
end
addEventHandler("onPlayerMarkerHit", marker, startJob)

Testei trocar o OnPlayerMarkerHit por onMarkerHit e também não funcionou.

Script é do servidor e no meta eu coloquei type="server"

Estou assistindo um vídeo aqui e o cara fez EXATAMENTE assim, porém aqui não funciona :/

Link to comment

Você colocou a posição Z baixa demais.

Para o marker funcionar perfeitamente geralmente ele fica um pouco acima do chão, então eu geralmente crio 2 markers, um que fica abaixo, e só serve para deixar mais bonito, e outro que é acionado no evento, e que eu deixo invisível.

  • Thanks 1
Link to comment
  • Other Languages Moderators

Isso é bug da colisão do marker. Eu geralmente deixo ele um pouco mais alto.

54 minutes ago, Gaimo said:

Eii... tu sabe como faz aquelas marker listrada?

Se vc estiver se referindo aqueles checkpoints com quadriculado de corrida, só funcionam no gamemode race.

Se vc estiver se referindo a outro, não sei de qual vc está se referindo.

  • Like 1
Link to comment
3 hours ago, Lord Henry said:

Isso é bug da colisão do marker. Eu geralmente deixo ele um pouco mais alto.

Se vc estiver se referindo aqueles checkpoints com quadriculado de corrida, só funcionam no gamemode race.

Se vc estiver se referindo a outro, não sei de qual vc está se referindo.

Não tenho print aqui dele, mas ele posso tentar explicar ele, imagine 5 marker do tipo cylinder cada um com um tamanho pequeno de altura bem fino 10px digamos, ficando assim um sim e um não:


---- marker
espaço em branco
-----marker

espaço em branco

-----marker

espaço em branco

-----marker

espaço em branco

-----marker

é basicamente o cylinder mas listrado, só que em vez de ter outra cor é transparente.

 

Link to comment
  • Other Languages Moderators
30 minutes ago, Gaimo said:

Não tenho print aqui dele, mas ele posso tentar explicar ele, imagine 5 marker do tipo cylinder cada um com um tamanho pequeno de altura bem fino 10px digamos, ficando assim um sim e um não:


---- marker
espaço em branco
-----marker

espaço em branco

-----marker

espaço em branco

-----marker

espaço em branco

-----marker

é basicamente o cylinder mas listrado, só que em vez de ter outra cor é transparente.

 

O que você quer são shader de markers, ou seja, texturizar um marcador. Eu tenho um aqui: mShader. Não é o listrado, mas é fácil de editar, se souber mexer com design.
Print/vídeo do marker: YouTube

@EDIT: Ah, já ia me esquecendo de falar sobre o seu script. Ele está quase correto, o problema realmente é o tamanho e a altura dele que, em server-side, a colisão é meio bugada, digamos assim. É sempre bom verificar o tipo de elemento que o marcador está recebendo, então sempre utilize o parâmetro 'hitElement' ou do jeito que você quiser, tipo assim:

local theMarker = createMarker( x, y, z, "cylinder", 1.25, 0, 171, 0, 220 );

function someFunction( hitElement, d )
	if ( getElementType( hitElement ) == "player" ) and ( d ) then -- getElementType() verifica o tipo de elemento. A letra "d" serve para verificar se o jogador está na mesma dimensão que o marker.
		local playerPos = { getElementPosition( hitElement ) };
		
		someVeh = createVehicle( 411, playerPos[ 1 ], playerPos[ 2 ], playerPos[ 3 ] + 0.5 );
		warpPedIntoVehicle( hitElement, someVeh );
	end
end
addEventHandler( "onMarkerHit", theMarker, someFunction )

 

Edited by asrzk
  • Like 1
  • Thanks 1
Link to comment

Só uma observação, o código que ele postou não deveria funcionar nem mesmo corrigindo a altura/tamanho, pois o onPlayerMarkerHit é um evento relacionado ao ‘player’, e para que o evento seja acionado devemos anexá-lo à tal. A variável pré-definida ‘root’ engloba todos os elementos, inclusive os players (fonte), então no caso o correto seria assim:

marker = createMarker(2101.368, -1801.239, 12.5, "cylinder", 1, 0, 255, 0, 200 )

function startJob(markerHit)
	if (markerHit == marker) then
		carro = createVehicle(448, 2097.831, -1801.282, 13.383)
	end
end
addEventHandler("onPlayerMarkerHit", root, startJob)

(claro, ai ajusta novamente a altura/tamanho para que consiga a colisão)

Usando o onMarkerHit como mostrado pelo @asrzk, ai sim podemos declarar o marker criado no 2º parâmetro do addEventHandler, pois esse evento relaciona-se com elementos do tipo “marker”.

  • Thanks 1
Link to comment
  • Other Languages Moderators
10 minutes ago, MaligNos said:

Só uma observação, o código que ele postou não deveria funcionar nem mesmo corrigindo a altura/tamanho, pois o onPlayerMarkerHit é um evento relacionado ao ‘player’, e para que o evento seja acionado devemos anexá-lo à tal. A variável pré-definida ‘root’ engloba todos os elementos, inclusive os players (fonte), então no caso o correto seria assim:


marker = createMarker(2101.368, -1801.239, 12.5, "cylinder", 1, 0, 255, 0, 200 )

function startJob(markerHit)
	if (markerHit == marker) then
		carro = createVehicle(448, 2097.831, -1801.282, 13.383)
	end
end
addEventHandler("onPlayerMarkerHit", root, startJob)

(claro, ai ajusta novamente a altura/tamanho para que consiga a colisão)

Usando o onMarkerHit como mostrado pelo @asrzk, ai sim podemos declarar o marker criado no 2º parâmetro do addEventHandler, pois esse evento relaciona-se com elementos do tipo “marker”.

Obrigado por explicar. Estou há 8 ou 9 anos jogando e programando, mas nunca percebi que 'onPlayerMarkerHit' era um evento. :P Agora eu sei!

  • Like 1
  • Thanks 1
Link to comment



Okay agora estou com um problema na tabela :/

 

table = {}
marker = createMarker(1366.15, -1275.507, 12.6, "cylinder", 1, 255, 0, 0, 255)
createBlip(1366.15, -1275.507, 11.5, 42)

function showPanel(markerHit,Dim)
	if (Dim) then 
		triggerClientEvent(root, "showPanel", root)
	end
end
addEventHandler("onPlayerMarkerHit",getRootElement(),showPanel)

function startJob(player)
	if not table[player] then
		table[player] = {} -- table index is nill  | SCRIPT não passa daqui
		table[player]["car"] = createVehicle(482, 1360.201, -1274.34, 13.383)
		outputChatBox("Cheguei aqui")
	else
		outputChatBox("você tem uma table")
	end
end
addEvent("start", true)
addEventHandler("start", root, startJob)

Imagino que estou fazendo merda com o startJob(player)

Quero fazer igual eu vi em um script, se o carro do player que entrar na marker é o que foi criado para ele.
Assim: VVVV

function FinalDaMissao(element, dim)
	if element and isElement(element) and getElementType(element) == "vehicle" and dim then
		player = getVehicleOccupant( element, 0 )
		if player and table[player] and table[player]["Carro"] and element == table[player]["Carro"] then
			destroyElement(element)
			destroyElement(table[player]["Marker"])
			table[player]["Carro"] = nil
			table[player]["Marker"] = nil
			table[player] = nil
			givePlayerMoney(player, 50)
			outputChatBox("Você concluiu seu trabalho é recebeu !", player, 0, 255, 0, false)
		else
			outputChatBox("Este não é o carro da empresa !", player, 255, 0, 0, false)
		end
	end
end

Vou ler o manual da lua sobre tabela para ver se consigo detectar o erro, mas se alguém identificar o erro e estiver disposto a dizer a solução, fico muito grato haha

Link to comment
table = {}
marker = createMarker(1366.15, -1275.507, 12.6, "cylinder", 1, 255, 0, 0, 255)
createBlip(1366.15, -1275.507, 11.5, 42)

function showPanel(player, dim)
    if player and isElement(player) and getElementType(player) == "player" and dim and not table.player then
        triggerClientEvent(root, "showPanel", root)
    elseif table.player then
        outputChatBox("Você já está trabalhando.")
    end
end
addEventHandler("onMarkerHit", marker, showPanel)

function startJob(player)
    if not table.player then
        table.player = {}
        table.player["car"] = createVehicle(482, 1360.201, -1274.34, 13.383)
        table.player["marker"] = createMarker(1360.126, -1256.776, 13.383, "cylinder", 2.5, 255, 0, 0, 255, player)
        table.player["blip"] = createBlip(1360.126, -1256.776, 13.383, 43, player)
        addEventHandler("onMarkerHit", table.player["marker"], job)
    end
end
addEvent("start", true)
addEventHandler("start", root, startJob)

function job(element, dim)
    if element and isElement(element) and getElementType(element) == "vehicle" and dim then
        player = getVehicleOccupant( element, 0 )
        if player and element == table.player["car"] then
            outputChatBox("sou eu kkkk")
        else
            outputChatBox("esse não é o veículo.")
        end
    end
end

Alguém só me confirma uma coisa, realmente vai criar um index para cada jogador ? Ou eles vão usar o mesmo e eu fiz cagada kkkkkk

Link to comment
  • Moderators

Parece estar certo o código, só que a função startJob seria mais correta desta forma:

function startJob()
	local player = client
	if not player then return end
	--
	if not table.player then
		table.player = {}
	end
	table.player["car"] = createVehicle(482, 1360.201, -1274.34, 13.383)
	table.player["marker"] = createMarker(1360.126, -1256.776, 13.383, "cylinder", 2.5, 255, 0, 0, 255, player)
	table.player["blip"] = createBlip(1360.126, -1256.776, 13.383, 43, player)
	addEventHandler("onMarkerHit", table.player["marker"], job)
end
addEvent("start", true)
addEventHandler("start", root, startJob)

E o trigger o no lado client:

triggerServerEvent( "start", localPlayer )

E a parte da otimização para remover os elementos vinculados ao jogador:

addEventHandler( "onPlayerQuit", root,
	function()
		if table[source] then
			for k,v in pairs(table[source]) do
				if isElement(v) then destroyElement(v) end
			end
			table[source] = nil
		end
	end
)

 

  • Thanks 1
Link to comment

Tem algum exemplo de como posso fazer um sistema random de entregas, tipo quero ter 10 pontos de entrega, mas que quando o jogador iniciar ele pegue um aleatoriamente. Enquanto isso vou finalizar o script

Uma ajudinha pra melhorar o código kkkkk to repetindo muita coisa, acho que tenho que começar a usar loop

 

table = {}
marker = createMarker(1366.15, -1275.507, 12.6, "cylinder", 1, 255, 0, 0, 255)
createBlip(1366.15, -1275.507, 11.5, 42)

function showPanel(player, dim)
	if player and isElement(player) and getElementType(player) == "player" and dim and not table.player then
		triggerClientEvent(root, "showPanel", root)
	elseif table.player then
		outputChatBox("Você já está trabalhando.")
	end
end
addEventHandler("onMarkerHit", marker, showPanel)

function startJob()
	local player = client
	if not player then return end
	if not table.player then
		table.player = {}
	end
	table.player["car"] = createVehicle(482, 1360.201, -1274.34, 13.383)
	table.player["marker"] = createMarker(1360.126, -1256.776, 13.383, "cylinder", 2.5, 255, 0, 0, 255, player)
	table.player["blip"] = createBlip(1360.126, -1256.776, 13.383, 43, player)
	addEventHandler("onMarkerHit", table.player["marker"], job)
end
addEvent("start", true)
addEventHandler("start", root, startJob)

function job(element, dim)
	if element and isElement(element) and getElementType(element) == "vehicle" and dim then
		player = getVehicleOccupant( element, 0 )
		if player and element == table.player["car"] then
			table.player["marker"] = createMarker(-258.438, -2182.637, 29.004, "cylinder", 2.5, 255, 0, 0, 255, player)
			table.player["blip"] = createBlip(-258.438, -2182.637, 29.004, 43, player)
			addEventHandler("onMarkerHit", table.player["marker"], endJob)
		else
			outputChatBox("Esse não é o veículo que você recebeu!")
		end
	end
end

function endJob()
	if element and isElement(element) and getElementType(element) == "vehicle" and dim then
		player = getVehicleOccupant( element, 0 )
		if player and element == table.player["car"] then
			table.player["marker"] = createMarker(1365.174, -1283.855, 13.547, "cylinder", 2.5, 255, 0, 0, 255, player)
			table.player["blip"] = createBlip(1365.174, -1283.855, 13.547, 43, player)
		else
			outputChatBox("Esse não é o veículo que você recebeu!")
		end
	end
end

addEventHandler( "onPlayerQuit", root,
	function()
		if table[source] then
			for k,v in pairs(table[source]) do
				if isElement(v) then destroyElement(v) end
			end
			table[source] = nil
		end
	end
)

Sim ainda não arrumei para o jogador receber dinheiro vamos por partes ehhehe

Link to comment
  • Other Languages Moderators

Sobre as posições aleatórias, você pode usar math.random. No entanto pode ocorrer de repetir o número seguido. Gerar o mesmo número várias vezes seguidas.

Também dá pra usar a função útil que eu inventei math.randomDiff que nunca repete o mesmo número duas vezes seguidas. O próximo valor a ser gerado sempre será diferente.

Edited by Lord Henry
  • Like 1
Link to comment
table = {}

routes = {
	{1345.973, -1243.223, 13.488},
	{1371.559, -1234.667, 13.547},
	{1389.106, -1246.985, 13.547},
}


marker = createMarker(1366.15, -1275.507, 12.6, "cylinder", 1, 255, 0, 0, 35)
createBlip (1366.15, -1275.507, 13, 42, 2, 255, 255, 255, 255,  0, 350)
createObject (1210, 1366.15, -1275.507, 13, 1, 0, 0, true)
addEventHandler("onMarkerHit", marker, 
	function()
		triggerClientEvent(root, "showPanel", root)
	end)

function startJob(element, dim)
	local element = client
	if not element then return end
	if not table[element] then
		table[element] = {}

		local rndR = routes[ math.random( #routes ) ]

		table[element]["car"] = createVehicle(482, 1361.106, -1277.579, 13.383)
		table[element]["marker"] = createMarker(rndR[1], rndR[2], rndR[3]-0.5, "cylinder", 1.5, 255, 0, 0, 255, element)
		createBlip(rndR[1], rndR[2], rndR[3], 53, 2, 255, 255, 255, 255,  0, 350, element)
		addEventHandler("onMarkerHit", table[element]["marker"], job)
	elseif table[element] then
		outputChatBox("Você já está trabalhando !", element, 255, 255, 255, false)
	end
end
addEvent("start", true)
addEventHandler("start", root, startJob)

-- AQUI TA O ERRO
-- Não consigo detectar o que entra no marker, testei com element e source mas não foi.

function job( element )
	if element and isElement(element) and getElementType(element) == "vehicle" and dim then
		player = getVehicleOccupant( element, 0 )
		if player and table[player] and table[player]["car"] and element == table[player]["car"] then
			outputChatBox("sucess")
		else
			outputChatBox("error")
		end
	else
		outputChatBox("error1")
	end
end
-----------------------------------------------------------
function endJob(element, dim)
	if element and isElement(element) and getElementType(element) == "vehicle" and dim then
		player = getVehicleOccupant( element, 0 )
		if player and table[player] and table[player]["car"] and element == table[player]["car"] then
			destroyElement(element)
			destroyElement(table[player]["marker"])
			table[player]["car"] = nil
			table[player]["marker"] = nil
			table[player] = nil
			givePlayerMoney(player, 50)
			outputChatBox("Você concluiu seu trabalho é recebeu !", player, 0, 255, 0, false)
		else
			outputChatBox("Este não é o carro da empresa !", player, 255, 0, 0, false)
		end
	end
end

addEventHandler( "onPlayerQuit", root,
	function()
		if table[source] then
			for k,v in pairs(table[source]) do
				if isElement(v) then destroyElement(v) end
			end
			table[source] = nil
		end
	end
)

Testei isso também:
 

function job( source )
	if source and isElement(source) and getElementType(source) == "vehicle" and dim then
		outputChatBox("sucess")
	else
		outputChatBox("error")
	end
end



Quando eu passo no table[element]["marker"], ele aparece o "error" 2 vezes, imagino que seja por causa que ele detecta o player e o veículo, só não sei como posso filtrar isso pra que seja o player que pegou o trabalho, com o carro que ele ganhou e passou no marker dele.

Usar source ou element não funciona, imagino que estou fazendo o uso altamente errado, mas não consigo identificar o erro. :/

Link to comment
  • Moderators

Tem alguns erros no código. Use o comando debugscript 3 para ativar o debugmode e ver os possíveis erros.

  • Você está usando triggerClientEvent em root, isso vai chamar a função para todos, use isto no lugar:
addEventHandler( "onPlayerMarkerHit", root,
	function ( m )
		if m == marker then
			triggerClientEvent(source, "showPanel", source)
		end
	end
)
  • Função startJob, tente isto:
function startJob()
	if client ~= source then return end
	--
	if not table[source] then
		table[source] = {}
	elseif table[source] then
		return outputChatBox("Você já está trabalhando !", source, 255, 255, 255)
	end

	local rndR = routes[ math.random( #routes ) ]

	table[source]["car"] = createVehicle(482, 1361.106, -1277.579, 13.383)
	table[source]["marker"] = createMarker(rndR[1], rndR[2], rndR[3]-0.5, "cylinder", 1.5, 255, 0, 0, 255, source)
	
	setElementParent(
		createBlip(rndR[1], rndR[2], rndR[3], 53, 2, 255, 255, 255, 255,  0, 350, source),
		table[source]["marker"]
	)
	
	addEventHandler("onMarkerHit", table[source]["marker"], job)
end
addEvent("start", true)
addEventHandler("start", root, startJob)
  • Na função job você não definiu o parâmetro dim, então o escopo da verificação não será executado. Tente o seguinte:
function job( hitElement, dim )
	if getElementType(hitElement) == "vehicle" and dim then
		local player = getVehicleOccupant( hitElement, 0 )
		if table[player] and table[player]["car"] and hitElement == table[player]["car"] then
			outputChatBox("sucess")
		else
			outputChatBox("error")
		end
	else
		outputChatBox("error1")
	end
end

 

Link to comment
function startJob()
	outputChatBox("cheguei aqui")
	if client ~= source then outputChatBox("cheguei aqui1") return end --script para aqui, no debugscript 3 não aparece nada.

	if not table[source] then
		table[source] = {}
		outputChatBox("cheguei aqui2")
	elseif table[source] then
		return outputChatBox("Você já está trabalhando !", source, 255, 255, 255)
	end

	local rndR = routes[ math.random( #routes ) ]

	table[source]["car"] = createVehicle(482, 1361.106, -1277.579, 13.383)
	table[source]["marker"] = createMarker(rndR[1], rndR[2], rndR[3]-0.5, "cylinder", 1.5, 255, 0, 0, 255, source)
	
	setElementParent(
		createBlip(rndR[1], rndR[2], rndR[3], 53, 2, 255, 255, 255, 255,  0, 350, source),
		table[source]["marker"]
	)

	addEventHandler("onMarkerHit", table[source]["marker"], job)
end
addEvent("start", true)
addEventHandler("start", root, startJob)

    if client ~= source then outputChatBox("cheguei aqui1") return end       |  Chega só até aqui :/

Pra não ficar te sugando ksksks vou praticando em outros scripts bem simples esse tá complicado pra mim.

Link to comment

é um botão no client

-- o que acontece quando aperta cada botão
addEventHandler ("onClientGUIClick",root, function ()
	if (source == bAccept) then
		triggerServerEvent ( "start", root)
		guiSetVisible ( mainWindow, false )
        showCursor ( false )

    elseif (source == bCancel) then
    	guiSetVisible ( mainWindow, false )
        showCursor ( false )
    end
end)

 

Link to comment
  • Moderators

Tente isto:

-- o que acontece quando aperta cada botão
addEventHandler ("onClientGUIClick",guiRoot, function ()
	if (source == bAccept) then
		triggerServerEvent ( "start", localPlayer)
		guiSetVisible ( mainWindow, false )
        showCursor ( false )

    elseif (source == bCancel) then
    	guiSetVisible ( mainWindow, false )
        showCursor ( false )
    end
end)

 

Link to comment
table = {}

-- Rotas que o jogador pode receber.
routes = {
	{1345.973, -1243.223, 13.488},
	{1371.559, -1234.667, 13.547},
	{1389.106, -1246.985, 13.547},
}

-- Local onde pega o trabalho.
marker = createMarker(1366.15, -1275.507, 12.6, "cylinder", 1, 255, 0, 0, 35)
createBlip (1366.15, -1275.507, 13, 42, 2, 255, 255, 255, 255,  0, 350)
createObject (1210, 1366.15, -1275.507, 13, 1, 0, 0, true)
addEventHandler( "onPlayerMarkerHit", root,
	function ( m )
		if m == marker then
			triggerClientEvent(source, "showPanel", source)
		end
	end
)
-- Quando o jogador aceita o trabalho.
function startJob()
	if client ~= source then return end

	if not table[source] then
		table[source] = {}
	elseif table[source] then
		return outputChatBox("Você já está trabalhando !", source, 255, 255, 255)
	end

	local rndR = routes[ math.random( #routes ) ]

	-- Cria um veículo e um destino para o jogador.
	table[source]["car"] = createVehicle(482, 1364.5539550781,-1266.3664550781,13.55)
	table[source]["marker"] = createMarker(rndR[1], rndR[2], rndR[3]-0.5, "cylinder", 1.5, 255, 0, 0, 255, source)
	
	setElementParent(
		createBlip(rndR[1], rndR[2], rndR[3], 53, 2, 255, 255, 255, 255,  0, 350, source),
		table[source]["marker"]
	)

	addEventHandler("onMarkerHit", table[source]["marker"], job)
end
addEvent("start", true)
addEventHandler("start", root, startJob)

-- Segunda parte do trabalho.
function job( hitElement, dim )
	if getElementType(hitElement) == "vehicle" and dim then
		local player = getVehicleOccupant( hitElement, 0 )
		if table[player] and table[player]["car"] and hitElement == table[player]["car"] then
			destroyElement(table[player]["marker"])

			-- Como eu posso recriar a marker para o jogador voltar para o ammu-nation??

			--[[
			Isso não funcionou :/

			table[hitElement]["marker"] = createMarker(1364.7564697266, -1285.5583496094, 13, "cylinder", 2, 255, 0, 0, 255, source)
			outputChatBox("Volte para o ammu-nation")
			addEventHandler("onMarkerHit", table[source]["marker"], endJob)

			]]


		else
			outputChatBox("Este não é o veículo que você recebeu!!")
		end
	end
end

-- Final do trabalho.
function endJob(hitElement, dim)
	if getElementType(hitElement) == "vehicle" and dim then
		local player = getVehicleOccupant( hitElement, 0 )
		if table[player] and table[player]["car"] and hitElement == table[player]["car"] then
			destroyElement(hitElement)
			destroyElement(table[player]["marker"])
			table[player]["car"] = nil
			table[player]["marker"] = nil
			table[player] = nil
			givePlayerMoney(player, 500)
			outputChatBox("Você concluiu a entrega com sucesso!")
		else
			outputChatBox("Este não é o veículo que você recebeu!!")
		end
	end
end

addEventHandler( "onPlayerQuit", root,
	function()
		if table[source] then
			for k,v in pairs(table[source]) do
				if isElement(v) then destroyElement(v) end
			end
			table[source] = nil
		end
	end
)

Não consigo recriar o marker do player ou criar um novo marker para ele.


a ideia do script, Jogador chega no local para pegar o trabalho, abre o painel e confirma ou cancela... até aqui tudo funcionando....

Ele recebe uma rota aleatória, aparece um marker e um blip só para ele... até aqui tudo funcionando.....

Ele chega nessa marker, ela some e eu não sei como recriar essa marker e blip, no local que é pra ele voltar....
 

 

Link to comment
  • Moderators
-- Segunda parte do trabalho.
function job( hitElement, dim )
	if getElementType(hitElement) == "vehicle" and dim then
		local player = getVehicleOccupant( hitElement, 0 )
		if table[player] and table[player]["car"] and hitElement == table[player]["car"] then
			destroyElement(table[player]["marker"])

			-- Como eu posso recriar a marker para o jogador voltar para o ammu-nation??

			--[[
			Isso não funcionou :/

			table[hitElement]["marker"] = createMarker(1364.7564697266, -1285.5583496094, 13, "cylinder", 2, 255, 0, 0, 255, source)
			outputChatBox("Volte para o ammu-nation")
			addEventHandler("onMarkerHit", table[source]["marker"], endJob)

			]]


		else
			outputChatBox("Este não é o veículo que você recebeu!!")
		end
	end
end

hitElement -> veículo

Erro:

table[hitElement]["marker"] = createMarker(1364.7564697266, -1285.5583496094, 13, "cylinder", 2, 255, 0, 0, 255, source)

Aonde está hitElement deveria ser player. E em source também.

addEventHandler("onMarkerHit", table[source]["marker"], endJob)

Aqui também, source vai retornar a fonte do evento que é a marker.

  • Thanks 1
Link to comment

MUITOOOOO OBRIGADOOOOOOOOO MANOO ta funcionando perfeitamente, agora é só colocar umas frescura e ser feliz!!!

Só não fecha o tópico ainda pq como vou arrumar umas frescura pode ser que eu consiga quebrar o script e ele parar de funfa kaksskks

  • Like 1
Link to comment
function startJob()
	if client ~= source then return end

	if not table[source] then
		table[source] = {}
	elseif table[source] then
		return exports.dxmsgs:outputDx(source, "Você já está trabalhando!", "error")
	end

	local rndR = routes[ math.random( #routes ) ]

	fadeCamera ( source, false, 1.0)
	
	--[[
	setTimer ( function(source)
		fadeCamera ( source, true, 1.0)
	end, 5000, 1 )
    ]]



	-- Cria um veículo e um destino para o jogador.
	table[source]["car"] = createVehicle(482, 1364.5539550781,-1266.3664550781,13.55)
	table[source]["marker"] = createMarker(rndR[1], rndR[2], rndR[3]-0.5, "cylinder", 2.5, 255, 0, 0, 255, source)
	
	setElementParent(
		createBlip(rndR[1], rndR[2], rndR[3], 53, 2, 255, 255, 255, 255,  0, 350, source),
		table[source]["marker"]
	)

	addEventHandler("onMarkerHit", table[source]["marker"], job)
end
addEvent("start", true)
addEventHandler("start", root, startJob)

 

Como eu posso fazer um fazer um fade in e fade out com a câmera?
No debug script diz que está esperando o primeiro argumento do fadeCamera, o que eu fiz de errado pra ele não reconhecer o player?

    fadeCamera ( source, false, 1.0)
    
    --[[
    setTimer ( function(source)
        fadeCamera ( source, true, 1.0)
    end, 5000, 1 )
    ]]

 

Link to comment

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...