function onUse(cid, item, fromPosition, itemEx, toPosition)
local storage, effect, cancelEffect = 5000, CONST_ME_MAGIC_GREEN, CONST_ME_POFF
if getPlayerStorageValue(cid, storage) <= 0 then
for i = 1,5 do
doPlayerAddBlessing(cid, i)
end
doSendMagicEffect(getCreaturePosition(cid), effect)
doPlayerSendTextMessage(cid, 22, "Yay!")
setPlayerStorageValue(cid, storage, 1)
else
doPlayerSendCancel(cid, "You've already used this item.")
doSendMagicEffect(getCreaturePosition(cid), cancelEffect)
end
return true
end
function onLogin(cid)
local storage = 5000
if getPlayerStorageValue(cid, storage) == 1 then
for i = 1,5 do
doPlayerAddBlessing(cid, i)
end
end
return true
end
Made one that sets storage of a player when using a donate item and if he has that storage, everytime he logins he will get all blessings.
(Not tested)
Action script:
LUA:function onUse(cid, item, fromPosition, itemEx, toPosition) local storage, effect, cancelEffect = 5000, CONST_ME_MAGIC_GREEN, CONST_ME_POFF if getPlayerStorageValue(cid, storage) <= 0 then for i = 1,5 do doPlayerAddBlessing(cid, i) end doSendMagicEffect(getCreaturePosition(cid), effect) doPlayerSendTextMessage(cid, 22, "Yay!") setPlayerStorageValue(cid, storage, 1) else doPlayerSendCancel(cid, "You've already used this item.") doSendMagicEffect(getCreaturePosition(cid), cancelEffect) end return true end
Creaturescript:
LUA:function onLogin(cid) local storage = 5000 if getPlayerStorageValue(cid, storage) == 1 then for i = 1,5 do doPlayerAddBlessing(cid, i) end end return true end