Jump to content
Sign in to follow this  
e1mer

Просмотр содержимого рюкзака

Recommended Posts

Функция позволяет чекнуть каждый слот рюкзака, и вернуть значение, применение можно найти самое разное, от поиска нужной вещи, до блокировки игрока на определенное действие если в инвентаре лежит N-ый предмет(-ы).

function Inventory (role)
	for pos=0, 47, 1 do
		Inventory = GetChaItem (role, 2, pos)
		Item_Type = GetItemType(Inventory)
		Item_ID = GetItemID(Inventory)
		SystemNotice(role, "Слот:"..(pos+1)..", ID:"..Item_ID..", Тип:"..Item_Type)
	end
end

Результат:

fa1a1df7a492.png

  • Like 1

Share this post


Link to post
Share on other sites
function Inventory(role)
	local kbsize = GetKbCap(role)
	for i = 0, kbsize - 1, 1 do
		local item = GetChaItem(role, 2, i)
		if (item ~= 0 and item ~= nil) then
			local item_id = GetItemID(item)
			local item_name = GetItemName(item_id)
			local item_type = GetItemType(item)
		
			SystemNotice(role, "Слот " .. (i + 1) .. ": ID " .. item_id .. " " .. item_name .. ", тип " .. item_type)
		else
			SystemNotice(role, "Слот " .. (i + 1) .. ": Пусто")
		end
	end
end

 

  • Like 1

Share this post


Link to post
Share on other sites

Да, точно, верно подметил, не учел что 48 слотов не сразу разблокированы у персонажей. :smile:

Share this post


Link to post
Share on other sites

@e1mer, а при повторном использовании твоя функция будет работать?

Inventory = GetChaItem (role, 2, pos)

Ты по сути заменяешь функцию на дескриптор предмета в ячейке pos инвентаря.


Share this post


Link to post
Share on other sites
Только что, V3ct0r сказал:

@e1mer, а при повторном использовании твоя функция будет работать?


Inventory = GetChaItem (role, 2, pos)

Ты по сути заменяешь функцию на дескриптор предмета в ячейке pos инвентаря.

Да, будет, проверял. :smile:

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...