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

Solved Autoi Donate Castle Item.

moha zakii

Owner Vinera
Joined
Feb 18, 2013
Messages
53
Reaction score
0
Location
egypto
data/movements/scripts
LUA:
local items = 8985

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local tpos, v = {x=1,y=1,z=1}, getCreaturePosition(cid) 
    if(getPlayerItemCount(cid, items) > 0) then        
        doTeleportThing(cid,tpos) else        
        doTeleportThing(cid,fromPosition)                
        doSendMagicEffect(v,2)            
        doPlayerSendTextMessage(cid, 25, "You need Castle Doll to enter on this sqm.") 
        end 
    return true
end
--------------------------------------------------
data/actions/scripts
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
-- Shortcuts
local item = 8985 -- 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
-------------------------------------------------
when people use it. its not remove .
1 buy it from shop donating and give other players to use it to buy castle. i want when 1 player use it (disapper) if anyone know how to help msg me or post here plx
thanks waiting answer's
 
Last edited by a moderator:
[06/10/2013 18:51:59] Lua Script Error: [Action Interface]
[06/10/2013 18:51:59] data/actions/scripts/other/castle.lua:onUse
[06/10/2013 18:51:59] data/actions/scripts/other/castle.lua:10: attempt to call global 'getHouseFromPos' (a nil value)
[06/10/2013 18:51:59] stack traceback:
[06/10/2013 18:51:59] [C]: in function 'getHouseFromPos'
[06/10/2013 18:51:59] data/actions/scripts/other/castle.lua:10: in function <data/actions/scripts/other/castle.lua:1>

What can you change getHouseFromPos to in TFS 0.2.14 9.60..?
 
Back
Top