Cabrito Posted May 29, 2022 Posted May 29, 2022 Ola,tudo bem? Bom quero criar um script pro meu servidor que quando o jogador passar pelo marker todas as armas dele são retiradas,alguem me ajuda? Obrigado
Doongogar Posted May 29, 2022 Posted May 29, 2022 2 hours ago, Cabrito said: Ola,tudo bem? Bom quero criar um script pro meu servidor que quando o jogador passar pelo marker todas as armas dele são retiradas,alguem me ajuda? Obrigado Marker = createMarker(x, y, z, "cylinder") -- cria o marker function retirarArmas(thePlayer) takeAllWeapons(thePlayer) -- retira todas as armas end addEventHandler("onMarkerHit", Marker, retirarArmas) -- onMarkerHit=quando o player "acertar" o marker
Other Languages Moderators androksi Posted June 1, 2022 Other Languages Moderators Posted June 1, 2022 Sobre o código acima, prefira verificar se o elemento que acertou o marcador foi realmente um player, caso contrário irá dar um aviso no debug. Para isso, use a função getElementType. Para fins de boas práticas de programação, tente sempre colocar bons nomes em variáveis, parâmetros de funções e outros — thePlayer não faz sentido ali, pois o que irá tocar será um elemento, seja ele um player, veículo, objeto, tanto faz. Altere para hitElement.
Doongogar Posted June 1, 2022 Posted June 1, 2022 (edited) On 01/06/2022 at 07:41, androksi said: Sobre o código acima, prefira verificar se o elemento que acertou o marcador foi realmente um player, caso contrário irá dar um aviso no debug. Para isso, use a função getElementType. Para fins de boas práticas de programação, tente sempre colocar bons nomes em variáveis, parâmetros de funções e outros — thePlayer não faz sentido ali, pois o que irá tocar será um elemento, seja ele um player, veículo, objeto, tanto faz. Altere para hitElement. Marker = createMarker(x, y, z, "cylinder") -- cria o marker function retirarArmas(hitElement) if (getElementType(hitElement) == "player") then -- verifica se o elemento é um player takeAllWeapons(hitElement) -- retira todas as armas end end addEventHandler("onMarkerHit", Marker, retirarArmas) -- onMarkerHit = quando o player "acertar" o marker assim né? Edited June 8, 2022 by Lord Henry hitElement
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