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

Anyone can fix this script?

Stewie

Family Guy # ;3
Joined
May 3, 2010
Messages
786
Reaction score
12
Location
TV
Error

Lua:
[03/08/2010 14:02:15] [Error - TalkAction Interface] 
[03/08/2010 14:02:15] data/talkactions/scripts/teleporttown.lua:onSay
[03/08/2010 14:02:15] Description: 
[03/08/2010 14:02:15] data/talkactions/scripts/teleporttown.lua:47: attempt to concatenate a boolean value
[03/08/2010 14:02:15] stack traceback:
[03/08/2010 14:02:15] 	data/talkactions/scripts/teleporttown.lua:47: in function <data/talkactions/scripts/teleporttown.lua:1>

Script:

Lua:
function onSay(cid, words, param, channel)
        if(param == '') then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
                return true
        end

        local tid = cid
        local t = string.explode(param, ",")
        if(t[2]) then
                tid = getPlayerByNameWildcard(t[2])
                if(not tid or (isPlayerGhost(tid) and getPlayerGhostAccess(tid) > getPlayerGhostAccess(cid))) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[2] .. " not found.")
                        return true
                end
        end

        local tmp = t[1]
        if(not tonumber(tmp)) then
                tmp = getTownId(tmp)
                if(not tmp) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Town " .. t[1] .. " does not exists.")
                        return true
                end
        end

        local pos = getTownTemplePosition(tmp, false)
        if(not pos or isInArray({pos.x, pos.y}, 0)) then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Town " .. t[1] .. " does not exists or has invalid temple position.")
                return true
        end

        pos = getClosestFreeTile(tid, pos)
        if(not pos or isInArray({pos.x, pos.y}, 0)) then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Destination not reachable.")
                return true
        end
		
		if(not getTilePzInfo(getThingPos(cid))) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can only use this in a protection zone.")
            return true
		end

        tmp = getCreaturePosition(tid)
        if(doTeleportThing(tid, pos, true) and not isPlayerGhost(tid)) then
                doSendMagicEffect(tmp, CONST_ME_POFF)
                doSendMagicEffect(pos, CONST_ME_TELEPORT)
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce foi movido para " .. getTownName(tmp, false) .. " War.")
        end

        return true
end
 
Code:
function onSay(cid, words, param, channel)
    if(param == '') then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
        return true
    end

    local tid = cid
    local t = string.explode(param, ",")
    if(t[2]) then
        tid = getPlayerByNameWildcard(t[2])
        if(not tid or (isPlayerGhost(tid) and getPlayerGhostAccess(tid) > getPlayerGhostAccess(cid))) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[2] .. " not found.")
            return true
        end
    end

    local tmp = t[1]
    if(not tonumber(tmp)) then
        tmp = getTownId(tmp)
        tmp2 = getTownId(tmp)
        if(not tmp) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Town " .. t[1] .. " does not exists.")
            return true
        end
    end

    local pos = getTownTemplePosition(tmp, false)
    if(not pos or isInArray({pos.x, pos.y}, 0)) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Town " .. t[1] .. " does not exists or has invalid temple position.")
        return true
    end

    pos = getClosestFreeTile(tid, pos)
    if(not pos or isInArray({pos.x, pos.y}, 0)) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Destination not reachable.")
        return true
    end
               
    if(not getTilePzInfo(getThingPos(cid))) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can only use this in a protection zone.")
        return true
    end

    tmp = getCreaturePosition(tid)
    if(doTeleportThing(tid, pos, true) and not isPlayerGhost(tid)) then
        doSendMagicEffect(tmp, CONST_ME_POFF)
        doSendMagicEffect(pos, CONST_ME_TELEPORT)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce foi movido para " .. getTownName(tmp2) .. " War.")
    end
    return true
end
 
Lua:
[03/08/2010 19:49:27] data/talkactions/scripts/teleporttown.lua:onSay
[03/08/2010 19:49:27] Description: 
[03/08/2010 19:49:27] data/talkactions/scripts/teleporttown.lua:48: attempt to concatenate a boolean value
[03/08/2010 19:49:27] stack traceback:
[03/08/2010 19:49:27] 	data/talkactions/scripts/teleporttown.lua:48: in function <data/talkactions/scripts/teleporttown.lua:1>
 
getTownName(tmp, false)

Err, works like..

getTownName(townid)

aka, the town id CANNOT be a position. (As declared just before it, tmp = getCreaturePosition(tid))

If you just got one town replace

Lua:
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce foi movido para " .. getTownName(tmp, false) .. " War.")

with

Lua:
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce foi movido para <townname> War.")

Otherwise, you'll need someone more experienced to help you.
 
PHP:
function onSay(cid, words, param, channel)
    if(param == '') then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
        return true
    end

    local tid = cid
    local t = string.explode(param, ",")
    if(t[2]) then
        tid = getPlayerByNameWildcard(t[2])
        if(not tid or (isPlayerGhost(tid) and getPlayerGhostAccess(tid) > getPlayerGhostAccess(cid))) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[2] .. " not found.")
            return true
        end
    end

    local tmp = t[1]
    if(not tonumber(tmp)) then
        tmp = getTownId(tmp)
        tmp2 = getTownId(tmp)
        if(not tmp) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Town " .. t[1] .. " does not exists.")
            return true
        end
    end

    local pos = getTownTemplePosition(tmp, false)
    if(not pos or isInArray({pos.x, pos.y}, 0)) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Town " .. t[1] .. " does not exists or has invalid temple position.")
        return true
    end

    pos = getClosestFreeTile(tid, pos)
    if(not pos or isInArray({pos.x, pos.y}, 0)) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Destination not reachable.")
        return true
    end
               
    if(not getTilePzInfo(getThingPos(cid))) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can only use this in a protection zone.")
        return true
    end

    tmp = getCreaturePosition(tid)
    if(doTeleportThing(tid, pos, true) and not isPlayerGhost(tid)) then
        doSendMagicEffect(tmp, CONST_ME_POFF)
        doSendMagicEffect(pos, CONST_ME_TELEPORT)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce foi movido para " .. getTownName(tmp) .. " War.")
    end
    return true
end

maybe?
 
this work

Lua:
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce foi movido para " .. getTownName(tmp, true) .. " War.")

only show name of town id 1 dont show others towns names.
 
u can get the position of it EX.

doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
 
Try this.

Lua:
  function onSay(cid, words, param, channel)
        if(param == '') then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
                return true
        end

        local tid = cid
        local t = string.explode(param, ",")
        if(t[2]) then
                tid = getPlayerByNameWildcard(t[2])
                if(not tid or (isPlayerGhost(tid) and getPlayerGhostAccess(tid) > getPlayerGhostAccess(cid))) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[2] .. " not found.")
                        return true
                end
        end

        local tmp = t[1]
        if(not tonumber(tmp)) then
                tmp = getTownId(tmp)
                if(not tmp) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Town " .. t[1] .. " does not exists.")
                        return true
                end
        end

        local pos = getTownTemplePosition(tmp, false)
        if(not pos or isInArray({pos.x, pos.y}, 0)) then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Town " .. t[1] .. " does not exists or has invalid temple position.")
                return true
        end

        pos = getClosestFreeTile(tid, pos)
        if(not pos or isInArray({pos.x, pos.y}, 0)) then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Destination not reachable.")
                return true
        end
               
                if(not getTilePzInfo(getThingPos(cid))) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can only use this in a protection zone.")
            return true
                end

        tmp = getCreaturePosition(tid)
        if(doTeleportThing(tid, pos, true) and not isPlayerGhost(tid)) then
                doSendMagicEffect(tmp, CONST_ME_POFF)
                doSendMagicEffect(pos, CONST_ME_TELEPORT)
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce foi movido para town war.")
        end

        return true
end
 
Back
Top