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

TFS 1.X+ Talkaction script

gubbo123

New Member
Joined
Aug 15, 2017
Messages
151
Solutions
1
Reaction score
3
Code:
function onSay(player, words, param)
    local position = player:getPosition()
    local tile = Tile(position)
    local house = tile and tile:getHouse()
    if house == nil then
        player:sendCancelMessage("You are not inside a house.")
        position:sendMagicEffect(CONST_ME_POFF)
        return false
    end

    if house:getOwnerGuid() ~= player:getGuid() then
        player:sendCancelMessage("You are not the owner of this house.")
        position:sendMagicEffect(CONST_ME_POFF)
        return false
    end

    house:setOwnerGuid(0)
    player:sendTextMessage(MESSAGE_INFO_DESCR, "You have successfully left your house.")
    position:sendMagicEffect(CONST_ME_POFF)
    return false
end



how can i do to not execute the Talkaction script if the player don't have a determinated storage? do a check, if the player don't have the storage de talkaction no work.
 
how can i do to not execute the Talkaction script if the player don't have a determinated storage? do a check, if the player don't have the storage de talkaction no work.
Lua:
local storage = 100
local value = 1
function onSay(player, words, param)
    local position = player:getPosition()
    local tile = Tile(position)
    local house = tile and tile:getHouse()
    if player:getStorageValue(storage) ~= value then
        player:sendCancelMessage("You dont have a storage.")
        position:sendMagicEffect(CONST_ME_POFF)
        return false
    end

    if house == nil then
        player:sendCancelMessage("You are not inside a house.")
        position:sendMagicEffect(CONST_ME_POFF)
        return false
    end

    if house:getOwnerGuid() ~= player:getGuid() then
        player:sendCancelMessage("You are not the owner of this house.")
        position:sendMagicEffect(CONST_ME_POFF)
        return false
    end

    house:setOwnerGuid(0)
    player:sendTextMessage(MESSAGE_INFO_DESCR, "You have successfully left your house.")
    position:sendMagicEffect(CONST_ME_POFF)
    return false
end
100 is a storage
1 is a value of a storage that player neeeed
 
Back
Top