• 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!

1 use for an item

alectrona94

Member
Joined
Aug 10, 2019
Messages
143
Reaction score
7
Location
Egypt
ive made a donation castle system and by using a doll, so the doll could by used more than once how i can make it just 1 use as charges, ive tried to edit it on the item xml but didnt work
 
Solution
Try this
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
-- Shortcuts
local item = 11144 -- id of castle doll
local look = "You have to be looking at door of the castle." -- cancel msg of looking to door to buy the castle
local other = "You already rent another house." -- cancel msg of already have other house
local already = "This castle is already owned by someone else " -- cancel msg of castle already owned by someone
local done = "You have successfully bought this donation castle " -- successfully msg for buy the house.
-- Shortcuts
--codes
local house = getHouseFromPos(getCreatureLookPosition(cid))
--codes
if not house then
doPlayerSendCancel(cid, look)
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
return true...
So you mean when you use the doll it doesn't disappear? post the script.
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
-- Shortcuts
local item = 11144 -- id of castle doll
local look = "You have to be looking at door of the castle." -- cancel msg of looking to door to buy the castle
local other = "You already rent another house." -- cancel msg of already have other house
local already = "This castle is already owned by someone else " -- cancel msg of castle already owned by someone
local done = "You have successfully bought this donation castle " -- successfully msg for buy the house.
-- Shortcuts
--codes
local house = getHouseFromPos(getCreatureLookPosition(cid))
--codes
if not house then
doPlayerSendCancel(cid, look)
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
return true
end
if not getHouseInfo(house).guildHall then
if getHouseByPlayerGUID(getPlayerGUID(cid)) then
doPlayerSendCancel(cid, other)
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
return true
end
end
if getHouseOwner(house) > 0 then
doPlayerSendCancel(cid, already)
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
return true
end
setHouseOwner(house, getPlayerGUID(cid))
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, done)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
doPlayerRemoveItem(cid, item)
return true
end
 
Try this
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
-- Shortcuts
local item = 11144 -- id of castle doll
local look = "You have to be looking at door of the castle." -- cancel msg of looking to door to buy the castle
local other = "You already rent another house." -- cancel msg of already have other house
local already = "This castle is already owned by someone else " -- cancel msg of castle already owned by someone
local done = "You have successfully bought this donation castle " -- successfully msg for buy the house.
-- Shortcuts
--codes
local house = getHouseFromPos(getCreatureLookPosition(cid))
--codes
if not house then
doPlayerSendCancel(cid, look)
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
return true
end
if not getHouseInfo(house).guildHall then
if getHouseByPlayerGUID(getPlayerGUID(cid)) then
doPlayerSendCancel(cid, other)
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
return true
end
end
if getHouseOwner(house) > 0 then
doPlayerSendCancel(cid, already)
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
return true
end
setHouseOwner(house, getPlayerGUID(cid))
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, done)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
doPlayerRemoveItem(cid, 11144, 1)
return true
end
 
Solution
I know this is solved but it shouldn't be used.

replace
doPlayerRemoveItem(cid, 11144, 1)

with
doPlayerRemoveItem(cid, item.uid)
 
actually ive got a different question, so this doll can be used infront of a normal house and it buys it, the castles also could be bought with !buyhouse
 
Back
Top