Jump to content

Inventário AJUDA


Recommended Posts

Posted

Boa tarde, eu construi um inventário e quase tudo está funcionando perfeitamente. Porém o inventário está para todo mundo no servidor, todo mundo usa o mesmo inventário e  o que eu queria cada um ter o seu inventário. Não sei o que está errado, o que pode ser? Não dá erros nem nada, desanimei muito.

Obrigado pela ajuda desde já ❤️ 

É assim que abro o inventário

bindKey('i', 'down', function ()
	if isPedDead(localPlayer) then
		outputChatBox("Tu não podes abrir o inventário morto!", 255, 255, 255, true)
		return
	end	
	
	if getElementData(localPlayer, 'charFollow') or false then
		outputChatBox("Não podes abrir o inventário porque alguém te leva!", 255, 255, 255, true)
		return
	end		
	if getElementData(localPlayer, 'timedOut') or false then
		outputChatBox("Só podes abrir o inventário em 5 segundos!", 255, 255, 255, true)
		return
	end	
	
	if getElementData(localPlayer, 'algemado') or false then
		outputChatBox("Não podes abrir o inventário porque estás algemado!", 255, 255, 255, true)
		return
	end
	
	if not startCraft then 
		showInventory = not showInventory
		if showInventory then 
			cursorInSlot = {-1, -1, -1, -1}
			movedItem = {-1, -1, -1, -1}
			openInventory(localPlayer)
			activeInvState = 'bag'
			craftTick = 0
			playSound("files/sounds/open.mp3", false)
			setTimer(function()
				removeEventHandler('onClientRender', root, drawInventory)
				addEventHandler('onClientRender', root, drawInventory, true, 'low-5')						
			end, 50, 1)
			toggleControl ("fire", false)
		else
			bodySearch = true
			showInventory = false
			cursorinInventory = false
			isMove = false
			cursorInSlot = {-1, -1, -1, -1}
			movedItem = {-1, -1, -1, -1}
			itemTable = playerItemTable
			playSound("files/sounds/close.mp3", false)
			setElementData(localPlayer, "playerInUse", false)
			setElementData(localPlayer, 'char >> element', false)
			removeEventHandler('onClientRender', root, drawInventory)
			if getElementType(inventoryElement) == 'vehicle' then 
				setElementData(inventoryElement, "clickToVehicle", 0)
				setElementData(inventoryElement, "inUse", false)
				triggerServerEvent('krtMTA->#doorState', inventoryElement, inventoryElement, 0)
			end
			toggleControl ("fire", true)
			inventoryElement = localPlayer
		end
	end

end)

 

  • Moderators
Posted (edited)

Mesma dúvida que esse cara: 

Parecem até a mesma pessoa. Bem suspeito isso ae.

Edited by Lord Henry
  • Haha 2

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.

Posted
3 minutes ago, Lord Henry said:

Mesma dúvida que esse cara: 

Parecem até a mesma pessoa. Bem suspeito isso ae.

Oxi.. Se fosse a mesma, postaria lá não aqui kkk 

Posted
18 minutes ago, Lord Henry said:

Mesma dúvida que esse cara: 

Parecem até a mesma pessoa. Bem suspeito isso ae.

Amigo  a duvida é a mesma porem não somos a mesma pessoa não ia fazer sentido ne....

Posted

@GodKraken Seu código não ajuda em nada, esse trecho ao meu ver não expõe o problema mencionado. O que eu acho é que as tabelas dos itens estão sendo compartilhadas entre os jogadores em outra parte do código.

Please do not PM me with scripting related question nor support, use the forums instead.

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