• 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] Lua function

scorpionfight

New Member
Joined
Sep 21, 2008
Messages
111
Reaction score
1
Location
Brazil
Hello,
I use: TFS 0.3.5 pl1

I need a function which returns the name of an item that is in a slot, there is a similar function if I am not mistaken it returns the name of the item but which is in item.xml.

example: I have a wooden shield of chaos "in one hand used the command / attr to change the name.

function that exists: returns the name "wooden shield"
I need to function: returns "wooden shield of chaos"

Thank you already.
 
Not tested, but try:
Code:
function getItemNameOnSlot(cid, slot)
	local item = getPlayerSlotItem(cid, slot)
	if (not item) then
		return "None"
	end

	return getItemNameById(item.itemid)
end
 
Try in c++ add lua command with this code:
Code:
if(const Item* item = env->getItemByUID(popNumber(L)))
	return item->getName();

#edit:
No it's stupid, don't try it.! :D
 
I think Chojraks function should work:
Lua:
function getItemNameOnSlot(cid, slot)
	local item = getPlayerSlotItem(cid, slot)
	if item.uid ~= 0 then
		return getItemNameById(item.itemid)
	else
		return FALSE
	end
end
 
Failed the Functions that you sent me, but to understand how they could do.
This one for those who need:
Code:
function getItemNameOnSlot(cid, slot)
        local item = getPlayerSlotItem(cid, slot)
        if item.uid ~= 0 then
                return getItemName(item.uid)
        else
                return FALSE
        end
end
Again Thanks to a whole community Otland which is the second time you need and quickly get help.
Note: Excuse my English but I am Brazilian
 
Last edited:
Try aksing somebody other and read the theard (the script should work).



Lol, :D.

well, my bad i forgot about getItemDescriptions, i thouth there is only getItemDescriptionsById... And what you mean with "Try aksing somebody other and read the theard"? I haven't readed thread? I said, your script won't work too, cuz it's ById and i was right...
Anything else?
 
Back
Top