• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[REQUEST] Item ids - Item names

Sizaro

Advanced OT User
Joined
Aug 20, 2007
Messages
5,151
Solutions
5
Reaction score
209
Location
Sweden
GitHub
coldensjo
Is it possible for an example to make like this:

Code:
  doPlayerAddItem(cid, 2650, 1)

to

Code:
  doPlayerAddItem(cid, leather armor, 1)

:thumbup:?
 
yes.
:)
PHP:
function addItemByName(cid, item, count)
local item_id = getItemIdByName(item)
	if item_id > 0 then
		doPlayerAddItem(cid, item_id, count)
	end
end

addItemByName(cid, item_NAME, count)

:)

#edit
im writing post, and you are fastest ; D
 
PHP:
function doPlayerAddItemByName(cid, name, count)
    local itemid = getItemIdByName(name)
    if itemid > 0 then
        return doPlayerAddItem(cid, itemid, count or 1)
    end
end
 
What should I do? Add that to global.lua?

xD

This is the script:

Code:
local firstItems =
{
	2050,
	2382
}

function onLogin(cid)
	if getPlayerStorageValue(cid, 30001) == -1 then
		for i = 1, table.maxn(firstItems) do
			doPlayerAddItem(cid, firstItems[i], 1)
		end
		if getPlayerSex(cid) == 0 then
			doPlayerAddItem(cid, 2651, 1)
		else
			doPlayerAddItem(cid, 2650, 1)
		end
		local bag = doPlayerAddItem(cid, 1987, 1)
		doAddContainerItem(bag, 2674, 1)
		setPlayerStorageValue(cid, 30001, 1)
	end
 	return TRUE
end

This would be cool:

Code:
function onLogin(cid)
	if getPlayerStorageValue(cid, 30001) then

		doPlayerAddItem(cid, leather armor, 1, chest)
		doPlayerAddItem(cid, legion helmet, 1, head)
	        doPlayerAddItem(cid, leather legs, 1, legs)
	        doPlayerAddItem(cid, leather boots, 1, boots)
	        doPlayerAddItem(cid, studded shield, 1, shield)
	
                end

		local bag = doPlayerAddItem(cid, bag, 1)
		doAddContainerItem(bag, apple, 1)
		doAddContainerItem(bag, rope, 1)
		doAddContainerItem(bag, shovel, 1)
		setPlayerStorageValue(cid, 30001, 1)
	end
 	return TRUE
end
 
Last edited:
Back
Top