• Vote in November Mapping Competition to select a winner!
  • 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

M0ustafa

1337
Support Team
Joined
Mar 4, 2017
Messages
2,333
Solutions
288
Reaction score
921
Location
Egypt
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()
 

M0ustafa

1337
Support Team
Joined
Mar 4, 2017
Messages
2,333
Solutions
288
Reaction score
921
Location
Egypt
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:

Nekiro

Legendary OT User
TFS Developer
Joined
Sep 7, 2015
Messages
2,230
Solutions
98
Reaction score
1,156
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?
 

Nekiro

Legendary OT User
TFS Developer
Joined
Sep 7, 2015
Messages
2,230
Solutions
98
Reaction score
1,156
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.
 

M0ustafa

1337
Support Team
Joined
Mar 4, 2017
Messages
2,333
Solutions
288
Reaction score
921
Location
Egypt
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.
 
Top