• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

if player use item get forever aol and bless

Seumion

★ Spell Maker & Mapper ★
Joined
Feb 24, 2015
Messages
172
Reaction score
2
hello otland i want script when player use item id he will get forever aol and bless and message when he logged
@Limos
 
You think now you helped me? and you think you are funny

i already shearched and didn't found any result
 
set an Storage, then check if player doesn't have bless and add him/her onLogin, if doesn't have give him/her bless and aol
 
firstly at the end of data/lib/000-constant.lua add this:
Code:
storageItem = 32421 --STORAGE TO SAVE
itemAol = 2173

actions.xml:
Code:
<action itemid="IDITEM" event="script" value="itemAolBless.lua"/>

actions/scripts/itemAolBless.lua

Code:
function onUse(cid, item, fromPos, item2, toPos)
 
   if (getPlayerStorageValue(cid, storageItem) < 1) then
     doPlayerSetStorageValue(cid, storageItem, 1)
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Congratulations, now you have AOL and BLESS forever.")
     doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
     doRemoveItem(item.uid)
   else
     doPlayerSendCancel(cid, "You already have your forever AOL/BLESS active.")
   end


   return true
end

now in data/creaturescripts/login.lua
before return true add this:
Code:
if (getPlayerStorageValue(cid, storageItem) == 1 and not getPlayerBlessing(cid, 1)) then
     doPlayerAddItem(cid, idAol, 1)
     for i = 1,5 do
       doPlayerAddBlessing(cid, i)
     end
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You received free AOL and BLESS.")
     doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)

   end

Features:
  • Player can click on the item once.
  • Check every login to add the blessings and aol.
  • Remove the item when is used.
 
the script work but when i log in my ot it give me aol but i have aol so now i have 2 aol

more explian when i log in if i have aol it give me another aol i won't that i want chr when use the book it's not able to get aol in game no when it use the book it will get free bless and aol

understand?
 
replace what i said in login.lua with this
Code:
if (getPlayerStorageValue(cid, storageItem) == 1 and getPlayerBlessing(cid, 1) == false) then
  doPlayerAddItem(cid, idAol, 1)
  for i = 1,5 do
  doPlayerAddBlessing(cid, i)
  end
  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You received free AOL and BLESS.")
  doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)

  end
 
thanks you it work's perfect now but it it only say you get aol and bless when it dei i want it always when it log in
 
Last edited:
Its Wokred BUt I Got This Error Can Any one Help Me ..
[12:33:12.298] [Error - CreatureScript Interface]
[12:33:12.298] data/creaturescripts/scripts/login.lua:onLogin
[12:33:12.298] Description:
[12:33:12.298] (luaDoPlayerAddItem) Item not found
 
its work good with me
in action script
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if (not exhaustion.check(cid, 18823)) then
local position = getCreaturePosition(cid)
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
            for i = 1, 30 do
doSendDistanceShoot({x = position.x + math.random(-12 ,12), y = position.y + math.random(-12 ,12), z = position.z}, position, 35)
end
doCreatureSay(cid, "You now have Forever blessing and aol!", TALKTYPE_ORANGE_1)
doPlayerPopupFYI(cid, "You must logout!.")
doRemoveItem(item.uid, 1)
doCreatureSetStorage(cid, 77350, 1)  
exhaustion.set(cid, 18823, 30)
        return true
    else
        doPlayerSendCancel(cid, "You will be able to use this book again in  "..exhaustion.get(cid, 18823).." seconds.")
        return false
    end
  
    return true
end

and in action.xml
Code:
<action itemid="xxx" event="script" value="xxxx.lua"/>
and in login script
Code:
local storage = 77350
function onLogin(cid)
if getPlayerStorageValue(cid, storage) == 1 then
doPlayerSendTextMessage(cid,19,'You are The Champion!')  -- change it for any msg
doPlayerAddBlessing(cid, 1)
doPlayerAddBlessing(cid, 2)
doPlayerAddBlessing(cid, 3)
doPlayerAddBlessing(cid, 4)
doPlayerAddBlessing(cid, 5)
doPlayerAddItem(cid,2173,1)
end
 
Back
Top