Jump to content

Ajuda com script


Recommended Posts

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)

 

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