Jump to content

Ajuda com marker


Recommended Posts

Estou tentando fazer um marker que ao player entrar nesse Marker ganhasse a skin de policial mas apenas se ele fizer parte da ACL.

já tentei de diversos jeitos mas n consegui fazer esse script funcionar ;-;

 

local skinmarker = createMarker(1565.1999511719, -1690.1999511719, 14.800000190735, 'cylinder', 2.0, 195, 107, 35, 202)

function MarkerHit(markerHit,matchingDimension)
	local account = getAccountName( getPlayerAccount ( player ) )
	if isObjectInACLGroup ("user." ..account, aclGetGroup ( "Policia" ) ) then
		setElementModel(Player, 286)
		outputChatBox("[PMERJ] Agora voce esta uniformizado para o trabalho!", player, 0, 255, 0, false)
		else
		outputChatBox("Você não é um policial", player, 255, 0, 0, false)
	  end
end
addEventHandler( "onPlayerMarkerHit",getRootElement(),MarkerHit)

 

Link to comment

Elemento player não existe.

Faça assim:

local skinmarker = createMarker (1565.1999511719, -1690.1999511719, 14.800000190735, 'cylinder', 2.0, 195, 107, 35, 202)

addEventHandler ("onMarkerHit", root, function (hitElement, matchingDimension)
	if hitElement and getElementType (hitElement) == "player" and matchingDimension then
		if isObjectInACLGroup ("user."..getAccountName(getPlayerAccount (hitElement)), aclGetGroup ("Policia")) then
			setElementModel (hitElement, 286)
			outputChatBox ("[PMERJ] Agora voce esta uniformizado para o trabalho!", hitElement, 0, 255, 0)
		else
			outputChatBox ("Você não é um policial", hitElement, 255, 0, 0)
		end
	end
end)

 

Edited by Jonas^
Link to comment

Com base o script do @Jonas^ troquei o Player do hitElement por "source" funcionará??
 

local skinmarker = createMarker (1565.1999511719, -1690.1999511719, 14.800000190735, 'cylinder', 2.0, 195, 107, 35, 202)

addEventHandler ("onMarkerHit", root, function (hitElement, matchingDimension)
	if hitElement and getElementType (hitElement) == "source" and matchingDimension then
		if isObjectInACLGroup ("user."..getAccountName(getPlayerAccount (hitElement)), aclGetGroup ("Policia")) then
			setElementModel (hitElement, 286)
			outputChatBox ("[PMERJ] Agora voce esta uniformizado para o trabalho!", hitElement, 0, 255, 0)
		else
			outputChatBox ("Você não é um policial", hitElement, 255, 0, 0)
		end
	end
end

 

realmente o script do @Jonas^ não funcionou. ;-;

agora nem o marker aparece

Link to comment
  • Other Languages Moderators

Pq não usa seu próprio script corrigido?

local skinmarker = createMarker (1565.1999511719, -1690.1999511719, 14.800000190735, 'cylinder', 2.0, 195, 107, 35, 202)

function MarkerHit(markerHit,matchingDimension)
	local account = getAccountName (getPlayerAccount (source))
	if isObjectInACLGroup ("user."..account, aclGetGroup ("Policia")) then
		setElementModel (source, 286)
		outputChatBox ("[PMERJ] Agora você está uniformizado para o trabalho!", source, 0, 255, 0, false)
	else
		outputChatBox ("Você não é um policial", source, 255, 0, 0, false)
	end
end
addEventHandler ("onPlayerMarkerHit", getRootElement(), MarkerHit)

 

  • Thanks 1
Link to comment
4 minutes ago, gbmv33 said:

Com base o script do @Jonas^ troquei o Player do hitElement por "source" funcionará??
 


local skinmarker = createMarker (1565.1999511719, -1690.1999511719, 14.800000190735, 'cylinder', 2.0, 195, 107, 35, 202)

addEventHandler ("onMarkerHit", root, function (hitElement, matchingDimension)
	if hitElement and getElementType (hitElement) == "source" and matchingDimension then
		if isObjectInACLGroup ("user."..getAccountName(getPlayerAccount (hitElement)), aclGetGroup ("Policia")) then
			setElementModel (hitElement, 286)
			outputChatBox ("[PMERJ] Agora voce esta uniformizado para o trabalho!", hitElement, 0, 255, 0)
		else
			outputChatBox ("Você não é um policial", hitElement, 255, 0, 0)
		end
	end
end

 

realmente o script do @Jonas^ não funcionou. ;-;

agora nem o marker aparece

Eu já tinha corrigido, só colocar ) no último end, ou copia o código de novo.

  • Thanks 1
Link to comment

Verifique se o jogador esta no marker certo, assim:

local skinmarker = createMarker (1565.1999511719, -1690.1999511719, 14.800000190735, 'cylinder', 2.0, 195, 107, 35, 202)

addEventHandler ("onMarkerHit", root, function (hitElement, matchingDimension)
	if hitElement and getElementType (hitElement) == "player" and matchingDimension then
		if isElementWithinMarker (hitElement, skinmarker) then -- Se o jogador estiver no marker 'skinmarker', então:
			if isObjectInACLGroup ("user."..getAccountName(getPlayerAccount (hitElement)), aclGetGroup ("Policia")) then
				setElementModel (hitElement, 286)
				outputChatBox ("[PMERJ] Agora voce esta uniformizado para o trabalho!", hitElement, 0, 255, 0)
			else
				outputChatBox ("Você não é um policial", hitElement, 255, 0, 0)
			end
		end
	end
end)

 

  • Thanks 1
Link to comment
  • Other Languages Moderators
18 hours ago, Lord Henry said:

@gbmv33 Onde estiver player troque por source

@Jonas^ seu código vai ativar em todos os markers do servidor.

 

4 hours ago, gbmv33 said:

estou com outro problema a function de mudar a skin, está mudando a skin em todos os markers do server.

Interessante que era só ler desde o começo.

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