• 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!

createitem.lua description: who made it?

mamon_2

Banned User
Joined
Jul 2, 2007
Messages
424
Reaction score
0
Well, I need to add a description of who made the item, like:
13:28 You see a bag (Vol:8).
It weighs 39.50 oz.
It was made by God Kito.


createitem.lua - maybe here?
PHP:
function onSay(cid, words, param)
	if(param == "") then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
		return TRUE
	end

	local t = string.explode(param, ",")
	local ret = RETURNVALUE_NOERROR
	local tmp = getCreaturePosition(cid)

	local id = tonumber(t[1])
	if(not id) then
		id = getItemIdByName(t[1])
		if(id == LUA_ERROR) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item wich such name does not exists.")
			return TRUE
		end
	end

	local amount = 100
	if(t[2]) then
		amount = t[2]
	end

	local item = doCreateItemEx(id, amount)
	if(t[3] and getBooleanFromString(t[3]) == TRUE) then
		if(t[4] and getBooleanFromString(t[4]) == TRUE) then
			tmp = getPlayerLookPos(cid)
		end

		ret = doTileAddItemEx(tmp, item)	
	else
		ret = doPlayerAddItemEx(cid, item, TRUE)
	end

	if(ret ~= RETURNVALUE_NOERROR) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Couldn't add item: " .. t[1])
		return TRUE
	end

	doSendMagicEffect(tmp, CONST_ME_MAGIC_RED)
	return TRUE
end

Some can help me?
 
before

Code:
doSendMagicEffect(tmp, CONST_ME_MAGIC_RED)

add
Code:
doSetItemSpecialDescription(ret, "Created by " .. getCreatureName(cid) .. ".")
 
Code:
function onSay(cid, words, param)
    if(param == "") then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
        return TRUE
    end

    local t = string.explode(param, ",")
    local ret = RETURNVALUE_NOERROR
    local tmp = getCreaturePosition(cid)

    local id = tonumber(t[1])
    if(not id) then
        id = getItemIdByName(t[1])
        if(id == LUA_ERROR) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item wich such name does not exists.")
            return TRUE
        end
    end

    local amount = 100
    if(t[2]) then
        amount = t[2]
    end

    local item = doCreateItemEx(id, amount)
    doSetItemSpecialDescription(item, "Created by " .. getCreatureName(cid) .. ".")
    if(t[3] and getBooleanFromString(t[3]) == TRUE) then
        if(t[4] and getBooleanFromString(t[4]) == TRUE) then
            tmp = getPlayerLookPos(cid)
        end

        ret = doTileAddItemEx(tmp, item)    
    else
        ret = doPlayerAddItemEx(cid, item, TRUE)
    end

    if(ret ~= RETURNVALUE_NOERROR) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Couldn't add item: " .. t[1])
        return TRUE
    end

    doSendMagicEffect(tmp, CONST_ME_MAGIC_RED)
    return TRUE
end
Newbie
 
Moderator Message: Please post in the correct section at this forum, if you need help with scripts like this, the "Request and Support" fits, also Open Tibia - Support section fit.
 
Back
Top