OTHispano
¿Quieres reaccionar a este mensaje? Regístrate en el foro con unos pocos clics o inicia sesión para continuar.

Ir abajo
Falcon
Falcon
Administrador
Mensajes Mensajes : 350
http://www.othispano.net

[Function] doPlayerAddDepotItems(cid, items, town) Empty [Function] doPlayerAddDepotItems(cid, items, town)

Sáb Mayo 12, 2012 11:43 am
Reputación del mensaje :100% (1 voto)
Hola usuarios de OTSuporter, hoy les traigo una funcion a todos aquellos scritpers:], es muy util y buena Wink.
Funcion;
Código:
function doPlayerAddDepotItems(cid, items, town)
data/libs/050-function;
Código:
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

Un ejemplo;
Código:
-- example usage
doPlayerAddDepotItems(cid, {[2160] = 60, ["backpack"] = 1})
doPlayerAddDepotItems(cid, {["gold coin"] = 100, ["crystal coin"] = 16})
avatar
pakkitto2012
Miembro
Mensajes Mensajes : 10

[Function] doPlayerAddDepotItems(cid, items, town) Empty Re: [Function] doPlayerAddDepotItems(cid, items, town)

Vie Jul 27, 2012 2:58 pm
muy bueno amigo, esta funcion les vendra bien a los scripters para futuros scripts, sigue asin.

@oftopic: como haces esas userbar tan guapas, porque con el userbar no creo que lo hagas no?, ya me diras, un salu2
Volver arriba
Permisos de este foro:
No puedes responder a temas en este foro.