Marcelo.S Posted July 29, 2019 Posted July 29, 2019 SpawnM = createMarker(-2396.8295898438,-617.03546142578,131.75123596191, "cylinder",1.5, 255, 255, 255, 50) function msg(player) outputChatBox("Você foi congelado até iniciar o Round!!", player, 255, 255, 255,true) end addEventHandler("onMarkerHit", SpawnM, msg) function frozen(source) if isElementWithinMarker(source, SpawnM) then setElementFrozen(source, true) end end addEventHandler("onMarkerHit",root,frozen) Então até ai tá ok. Gostaria só de saber como faço pra quando o mod for desativado o player que esta freezado ser desfreezado.
Other Languages Moderators Lord Henry Posted July 29, 2019 Other Languages Moderators Posted July 29, 2019 Não seria melhor ter feito tudo junto? SpawnM = createMarker (-2396.8295898438, -617.03546142578, 131.75123596191, "cylinder", 1.5, 255, 255, 255, 50) function msg (player) if (player) and (getElementType (player) == "player") then outputChatBox ("Você foi congelado até iniciar o Round!!", player, 255, 255, 255) setElementFrozen (player, true) end end addEventHandler ("onMarkerHit", SpawnM, msg) 1
Marcelo.S Posted July 29, 2019 Author Posted July 29, 2019 é realmente ficou bem melhor, mais gostaria de saber como faz pra quando desativar o mod ele desfrezar o player
Other Languages Moderators Lord Henry Posted July 29, 2019 Other Languages Moderators Posted July 29, 2019 Já tentou com onResourceStop? 1
DNL291 Posted July 29, 2019 Posted July 29, 2019 Coloque isto no seu código: local frozenPlayers = {} addEventHandler( "onResourceStop", resourceRoot, function() for thePlayer in pairs(frozenPlayers) do setElementFrozen( thePlayer, false ) end end ) local SetElementFrozen = setElementFrozen function setElementFrozen( elem, bool ) if not isElement(elem) then return false end if getElementType(elem) == "player" then bool = bool and true or nil frozenPlayers[ elem ] = bool end return SetElementFrozen( elem, bool ) end addEventHandler( "onPlayerQuit", root, function() if frozenPlayers[ source ] then frozenPlayers[ source ] = nil end end ) (não-testado)
Marcelo.S Posted July 29, 2019 Author Posted July 29, 2019 (edited) Não funcionou não. Quando dou stop aparece no debug Linha 30: Bad argument @'setElementFrozen'[Expected bool at argument 2, got nil] Edited July 29, 2019 by Marcelo.S
DNL291 Posted July 29, 2019 Posted July 29, 2019 É por causa da linha 17. Aqui está o código corrigido: Spoiler local frozenPlayers = {} addEventHandler( "onResourceStop", resourceRoot, function() for thePlayer in pairs(frozenPlayers) do setElementFrozen( thePlayer, false ) end end ) local SetElementFrozen = setElementFrozen function setElementFrozen( elem, bool ) if not isElement(elem) then return false end if getElementType(elem) == "player" then frozenPlayers[ elem ] = bool and true or nil end return SetElementFrozen( elem, bool ) end addEventHandler( "onPlayerQuit", root, function() if frozenPlayers[ source ] then frozenPlayers[ source ] = nil end end ) 1
Marcelo.S Posted July 29, 2019 Author Posted July 29, 2019 Ae mano consegui obrigado a todos que me ajudaram. 1
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