Chest System GC0UJxoAuthorTopic: Chest System

Chest System QA3M1mQ
Chest System
« on: Mar Mar 20, 2018 3:54 am »
Administrador
Administrador

Cerebro

Cerebro


https://otcreator.activo.mx
data/actions/scripts/chestsys.lua


Código:
local t = {
[1001] = {2002,"magic sword",2400},
[1002] = {2004,"royal crossbow",8851}
}

function onUse(cid,item,fromPosition,itemEx,toPosition)
local v = t[item.uid]
      if getPlayerStorageValue(cid,v[1]) == -1 and getPlayerFreeCap(cid) >= (getItemWeightById(v[3])) then
        setPlayerStorageValue(cid,v[1],1)
              doPlayerAddItem(cid,v[3])
              doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a " .. v[2] .. "!")
        elseif getPlayerStorageValue(cid,v[1]) == 1 then
              doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty")
        elseif getPlayerFreeCap(cid) < (getItemWeightById(v[3])) then
              doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You need " .. getItemWeightById(v[3]) .. " capacity in order to get the item")
                end
    return true
end

data/actions/actions.xml


Código:
<action uniqueid="1001-1002" event="script" value="chestsys.lua"/>

Ver el tema anterior Ver el tema siguiente Volver arriba  Mensaje [Página 1 de 1.]

Permisos de este foro:
No puedes responder a temas en este foro.