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

RevScripts Talkaction to teleport you home

Solution
So the final script will look like this one, Just added few checks to Znote's one.
Lua:
local talk = TalkAction("!home")

function talk.onSay(player, words, param)
    local house = player:getHouse()
    if not house then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "You do not have a house.")
        return false
    end

    if player:isPzLocked() then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "You cannot teleport yourself or other while in combat.")
        return false
    end

    if player:getSkull() ~= SKULL_NONE then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "You can't teleport yourself or players with a skull.")
        return false
    end

    player:teleportTo(house:getExitPosition())
    return...
As you didn't give enough details, If you want players to have exhaust using it or only use it in PZ or whatever so I will just paste a simple script and you can edit it yourself or post if you needed different edits.
Lua:
local talk = TalkAction("!home")

function talk.onSay(player, words, param)
    player:teleportTo(player:getTown():getTemplePosition())
    return false
end

talk:separator(" ")
talk:register()
 
So the final script will look like this one, Just added few checks to Znote's one.
Lua:
local talk = TalkAction("!home")

function talk.onSay(player, words, param)
    local house = player:getHouse()
    if not house then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "You do not have a house.")
        return false
    end

    if player:isPzLocked() then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "You cannot teleport yourself or other while in combat.")
        return false
    end

    if player:getSkull() ~= SKULL_NONE then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "You can't teleport yourself or players with a skull.")
        return false
    end

    player:teleportTo(house:getExitPosition())
    return false
end

talk:separator(" ")
talk:register()
 
Last edited:
Solution
So the final script will look like this one, Just added few checks to Znote's one.
Lua:
local talk = TalkAction("!home")

function talk.onSay(player, words, param)
    local house = player:getHouse()
    if not house then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "You do not have a house.")
        return false
    end

    if config.pzlocked and player:isPzLocked() then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "You cannot teleport yourself or other while in combat.")
        return false
    end

    if player:getSkull() ~= SKULL_NONE then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "You can't teleport yourself or players with a skull.")
        return false
    end

    if house then
    player:teleportTo(house:getExitPosition())
end
    return false
end

talk:separator(" ")
talk:register()
You are checking if house exists twice. First check is enough, it wont proceed.
Also where is config table?
 
Thanks, Edited it, I just coped the checks from different script quickly as I was going off.
 
Thanks, Edited it, I just coped the checks from different script quickly as I was going off.
you deleted the wrong check, you should have deleted the last one if house then, because if player has no house then there is no point to proceed even further.
 
Wouldn't cause problems anyways as it was going to stop before teleporting the player but edited it aswell, It looks better now.
Feel free to correct my script or re-write it anytime, I still most of times make few mistakes due to my little experience.
 
Back
Top