Jump to content

Estou tendo problemas com setElementData


Recommended Posts

eu fiz um sistema de /pro, so que quando o player morre ele continua com o pro, eu ja tentei desativar com o evento "onPlayerWasted" mas nao funciona.

 

function godCommand(player)
local conta = getAccountName ( getPlayerAccount ( player ) )
	if isObjectInACLGroup ("user."..conta, aclGetGroup ( "Staff" ) ) then
	if getElementData(player,"onProt") then
	setElementData(player,"onProt",false)
        setElementModel(player, 0)
	outputChatBox("O staff "..getPlayerName(player).." esta OFF",root,255,255,0,true)
	else
	setElementData(player,"onProt",true)
        setElementModel(player, 10)
	outputChatBox("O staff "..getPlayerName(player).." esta ON",root,255,255,0,true)
	end
	end
end

addCommandHandler("pro",godCommand)

eu queria colocar o onProt no false quando o player morrer.

Link to comment
  • 2 months later...

Ea í, @MKZ não sei como você fez, mas para quando o player morrer e quer tirar um elementData dele, utilizamos onPlayerWasted mesmo. Pode fazer desta forma:

 

addEventHandler('onPlayerWasted', root, function()
	if not getElementData(source, 'onProt') then -- Se o player que morreu não ter o elementData de key `onProt` não executará.
		return false
	end

	removeElementData(source, 'onProt') -- Remove o elementData de key `onProt` do player.
end)
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...