do actions.xml dodajemy:
tworzymy plik soldier.lua w data/actions i wlejamy:
function onUse(cid, item, frompos, item2, topos)
local exhausted_seconds = 1
local exhausted_storagevalue = 74
local mp = 0.20 -- 0.ILE MA DAWAĆ MP W %
local hp = 0.20 -- 0.ILE MA DAWAĆ HP W %
if isPlayer(cid) then
if(os.time() <= getPlayerStorageValue(cid, exhausted_storagevalue)) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return doPlayerSendCancel(cid, "You are exchausted.")
end
if(item.type >= 1) then
doSendMagicEffect(topos,40)
doCreatureAddMana(cid, math.floor(getCreatureMaxMana(cid)*mp))
doCreatureAddHealth(cid, math.floor(getCreatureMaxHealth(cid)*hp))
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
doChangeTypeItem(item.uid, item.type - 1)
else
doSendMagicEffect(topos,40)
doCreatureAddMana(cid, math.floor(getCreatureMaxMana(cid)*mp))
doCreatureAddHealth(cid, math.floor(getCreatureMaxHealth(cid)*hp))
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
doRemoveItem(item.uid, 1)
end
end
return true
end