Jump to content

Entrar dentro da Marcação


Recommended Posts

Bom Dia,

preciso de uma ajuda com um script to tentando fazer com que o player so pode digitar um comando se tiver dentro da marker, mais se tiver outra col perto ele acerta mesmo assim eu queria apenas se tiver dentro da "createColSphere"

---- SERVER.Lua

modelX, modelY, modelZ = 1805.3284,-1131.8,23.1
modelX2, modelY2, modelZ2 = 1835.68,-1122.89,51.85
themarker = createMarker ( modelX, modelY, modelZ , "cylinder", 1.5, 254, 0, 0, 170 )
themarker2 = createMarker ( modelX2, modelY2, modelZ2 , "cylinder", 1.5, 254, 0, 0, 170 )
showLegend = createColSphere ( modelX, modelY, modelZ+1, 1.6 )
showLegend2 = createColSphere ( modelX2, modelY2, modelZ2+1, 1.6 )

addEventHandler("onColShapeHit",getRootElement(),function(hitElement,matchingDimension)
  	if (themarker and showLegend) or (themarker2 and showLegend2) then
		if getElementType(hitElement) == "player" then
			outputChatBox("ENTROU",hitElement)
			setElementData ( hitElement, "playerMarkerBase", true )
			
		end
	end
end)

addEventHandler("onColShapeLeave",getRootElement(),function(hitElement,matchingDimension)
  	if (themarker and showLegend) or (themarker2 and showLegend2) then
		if getElementType(hitElement) == "player" then
			outputChatBox("SAIU",hitElement)
			setElementData ( hitElement, "playerMarkerBase", false )
		end
	end
end)

addCommandHandler("pass", function(player,cmd,type)
	if getElementData(player,"playerMarkerBase") == true then   
		if tonumber(type) == 4222 then ------- DENTRO DA BASE
        	outputChatBox("ATIVO",player)
			setElementPosition ( player,modelX, modelY, modelZ)
	    elseif tonumber(type) == 5222 then --- NO TET
        	outputChatBox("ATIVO 2",player)
			setElementPosition ( player, modelX2, modelY2, modelZ2 )
		end
	end
end)

 

Link to comment
  • Other Languages Moderators

É mais fácil simplesmente verificar se o player está dentro dos markers ao usar o comando.

addCommandHandler ("pass", function (player, cmd, type)
	if (isElementWithinMarker (player, showLegend)) or (isElementWithinMarker (player, showLegend2)) then -- Se o jogador está dentro de um dos markers, então:
		if tonumber(type) == 4222 then ------- DENTRO DA BASE
			outputChatBox ("ATIVO", player)
			setElementPosition (player, modelX, modelY, modelZ)
		elseif tonumber(type) == 5222 then --- NO TET
			outputChatBox ("ATIVO 2", player)
			setElementPosition (player, modelX2, modelY2, modelZ2)
		end
	end
end)

 

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