Ir para conteúdo

Featured Replies

Postado

Envia o item diretamente no depot do jogador.


function doPlayerAddDepotItems(cid, items, town)

	if (not isPlayer(cid)) then

		error("Player not found")

	end

	local town = town or getPlayerTown(cid)


	local parcel = doCreateItemEx(ITEM_PARCEL)

	for item, count in pairs(items) do

		if (type(item) == "number") then

			doAddContainerItem(parcel, item, count)

		elseif (type(item) == "string") then

			doAddContainerItem(parcel, getItemIdByName(item), count)

		else

			error("Undefinied type of item name")

		end

	end


	return doPlayerSendMailByName(getCreatureName(cid), parcel, town)

end

Como usar

function onSay(cid, words, param, channel)

	if (param == '') then

		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")

	else

		local params = string.explode(param, ",")

		if (not params[2]) then

			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")

		elseif (not getPlayerByNameWildcard(params[1])) then

			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " not found.")

		else

			local items, item_params = {}, {}

			for i = 2, #params do

				item_params = string.explode(params[i], "x")

				if (#item_params ~= 2 or tonumber(item_params[1]) <= 0 or tonumber(item_params[2]) <= 0) then

					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")

				else

					items[tonumber(item_params[2])] = tonumber(item_params[1])

					print(items[tonumber(item_params[2])])

				end

			end

			if (#item_params > 0) then

				doPlayerAddDepotItems(getPlayerByNameWildcard(params[1]), items)

			end

		end

	end


	return true

end

Creditos:

sn4ake

Não testado

Editado por skydangerous (veja o histórico de edições)

 http://baiakuza.com/
IP: baiakuza.com
TIBIA: 10.96
Baiak Custom [ High Exp Rate ]

 

 

 

 

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo