Jump to content

Ajuda com script


Recommended Posts

Posted

Preciso de ajuda com um script que tenho, quando o player morre ele não perde nenhum item, porem tem a função, queria que quando o player morrer perder tudo que tem na bag

 

function takeAllItem(element, itemID, itemValue)
	if not mysqlConnection then
		return
	end
	local playerItems = getElementItems(element, element, 0)
	for k, v in ipairs(playerItems["bag"]) do		
		if (tonumber(v["id"]) == itemID) and (tonumber(v["value"]) == itemValue)then
			deleteItem(element, element, v["dbid"])
		end			
	end
	for k, v in ipairs(playerItems["key"]) do
		if (tonumber(v["id"]) == itemID) and (tonumber(v["value"]) == itemValue) then
			deleteItem(element, element, v["dbid"])
		end			
	end
	for k, v in ipairs(playerItems["cards"]) do
		if (tonumber(v["id"]) == itemID) and (tonumber(v["value"]) == itemValue) then
			deleteItem(element, element, v["dbid"])
		end			
	end
	getElementItems(element, element, 1)
end
addEvent("takeAllItem", true)
addEventHandler("takeAllItem", getRootElement(), takeAllItem)

 

  • Moderators
Posted

Formate seu tópico da maneira adequada. Veja as regras aqui:

 

Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanksspacer.png

Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile
Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment
Discord Oficial do MTA: https://mtasa.com/discord
Blacklist e Whitelist de Scripters: Planilha

Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.

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