Jump to content

n3xt.onOpenInventory bindkey not working


Duff1995

Recommended Posts

function onInventory(source)
    if not isGuestAccount(getPlayerAccount(source)) then
		triggerClientEvent(source, "N3xT.onOpenInventory", source)
	else
		messageS(source, "Você precisa estar logado para abrir o inventário!", "error")
	end
end

function onResStart()
	for index, player in ipairs(getElementsByType("player")) do
		bindKey(player, config.bind, "down", onInventory)
		if not isGuestAccount(getPlayerAccount(player)) then
			local acc = getAccountName(getPlayerAccount(player))
			loadItens(player, acc)
		end
	end
end
addEventHandler("onResourceStart", resourceRoot, onResStart)

function onPlayerJoin()
	bindKey(source, config.bind, "down", onInventory)
end
addEventHandler("onPlayerJoin", getRootElement(), onPlayerJoin)

function cleanAll()
	for index, player in ipairs(getElementsByType("player")) do
		unbindKey(player, config.bind, "down", onInventory)
		bindKey ( player, "F1", "down", onInventory )
  	end
end
addEventHandler("onResourceStop", resourceRoot, cleanAll)

spacer.png

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