gbmv33 Posted May 22, 2019 Share Posted May 22, 2019 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
Jonas^ Posted May 22, 2019 Share Posted May 22, 2019 (edited) 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 May 22, 2019 by Jonas^ Link to comment
Other Languages Moderators Lord Henry Posted May 22, 2019 Other Languages Moderators Share Posted May 22, 2019 (edited) @gbmv33 Onde estiver player troque por source @Jonas^ seu código vai ativar em todos os markers do servidor. Edited May 22, 2019 by Lord Henry Link to comment
DNL291 Posted May 22, 2019 Share Posted May 22, 2019 O parâmetro do "onPlayerMarkerHit" é a marker, player é a source. Link to comment
gbmv33 Posted May 22, 2019 Author Share Posted May 22, 2019 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 Lord Henry Posted May 22, 2019 Other Languages Moderators Share Posted May 22, 2019 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) 1 Link to comment
Jonas^ Posted May 22, 2019 Share Posted May 22, 2019 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. 1 Link to comment
gbmv33 Posted May 22, 2019 Author Share Posted May 22, 2019 ah entendi como funciona agora, obrigado ao em vez de "setElementModel (player, 286)" usar "setElementModel (source, 286). Além de me ajudar com o script, ainda esclareceu minha duvida Amo vcs.@Jonas^ @Lord Henry Link to comment
Other Languages Moderators Lord Henry Posted May 22, 2019 Other Languages Moderators Share Posted May 22, 2019 12 minutes ago, Lord Henry said: Onde estiver player troque por source Foi oq eu disse. Link to comment
Jonas^ Posted May 22, 2019 Share Posted May 22, 2019 (edited) Oque o Lord disse serve apenas para o onPlayerMarkerHit, no caso do meu código ele funciona igual o seu. Edited May 22, 2019 by Jonas^ Link to comment
gbmv33 Posted May 22, 2019 Author Share Posted May 22, 2019 estou com outro problema a function de mudar a skin, está mudando a skin em todos os markers do server. Link to comment
Jonas^ Posted May 22, 2019 Share Posted May 22, 2019 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) 1 Link to comment
gbmv33 Posted May 22, 2019 Author Share Posted May 22, 2019 Agora funcionou 10/10, muito obrigado! Link to comment
Other Languages Moderators Lord Henry Posted May 22, 2019 Other Languages Moderators Share Posted May 22, 2019 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now