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

Use script only in pz

Vendeliko

Banned User
Joined
Dec 3, 2011
Messages
3,087
Reaction score
93
Location
Beside that guy with that thing but without that t
Hey guys,anyone could please edit this script so that players can only use it when they are in PZ?
There is 'if(not getTilePzInfo(getThingPos(cid))) then' which I'm guessing [by the text under :p] should do the job but for some reason isnt.
I need the script to work with rev 4269.

Code:
function onSay(cid, words, param, channel)
        if(param == '') then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "To chose a town please type !t 1,!t 2,!t or !t 5.")
                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 exist.")
                        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 exist 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 must be in PZ to use this command.")
            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 " .. t[1] .. " War.")
        end

        return true
end

Thanks in advance,
Vendeliko
 
LUA:
if(not getTileInfo(getThingPosition(cid)).protection)

Try like this
LUA:
function onSay(cid, words, param, channel)
        if(param == '') then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "To chose a town please type !t 1,!t 2,!t or !t 5.")
                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 exist.")
                        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 exist 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 getTileInfo(getThingPosition(cid)).protection) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must be in PZ to use this command.")
            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 " .. t[1] .. " War.")
        end

        return true
end
 
This script looks really odd.
Try this way then
LUA:
function onSay(cid, words, param, channel)
        if(param == '') then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "To chose a town please type !t 1,!t 2,!t or !t 5.")
                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 exist.")
                        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 exist 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
  
        tmp = getCreaturePosition(tid)
        if(doTeleportThing(tid, pos, true) and (not getTileInfo(getThingPosition(cid)).protection) 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 " .. t[1] .. " War.")
        end
 
        return true
end
 
LUA:
function onSay(cid, words, param, channel)
	if (not getTileInfo(getThingPosition(cid)).protection) then
		return doPlayerSendCancel(cid, "You must be in a protection zone to execute this command.")
	end
        
	if(param == '') then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "To chose a town please type !t 1,!t 2,!t or !t 5.")
        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 exist.")
            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 exist 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
 
    tmp = getCreaturePosition(tid)
    if(  not isPlayerGhost(tid)) then
        doTeleportThing(tid, pos, true)
		doSendMagicEffect(tmp, CONST_ME_POFF)
        doSendMagicEffect(pos, CONST_ME_TELEPORT)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce foi movido para " .. t[1] .. " War.")
    end
 
    return true
end
 
Last edited:
LUA:
function onSay(cid, words, param, channel)
	if (not getTileInfo(getThingPosition(cid)).protection) then
		return doPlayerSendCancel(cid, "You must be in a protection zone to execute this command.")
	end
 
	if(param == '') then
		return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "To chose a town please type !t 1,!t 2,!t or !t 5.")
	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
			return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[2] .. " not found.")
		end
	end
 
	local tmp = t[1]
	if(not tonumber(tmp)) then
		tmp = getTownId(tmp)
		if(not tmp) then
			return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Town " .. t[1] .. " does not exist.")
		end
	end
 
	local pos = getTownTemplePosition(tmp, false)
	if(not pos or isInArray({pos.x, pos.y}, 0)) then
		return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Town " .. t[1] .. " does not exist or has invalid temple position.")
	end
 
	pos = getClosestFreeTile(tid, pos)
	if(not pos or isInArray({pos.x, pos.y}, 0)) then
		return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Destination not reachable.")
	end
 
	tmp = getCreaturePosition(tid)
	if( not isPlayerGhost(tid)) then
		doTeleportThing(tid, pos, true)
		doSendMagicEffect(tmp, CONST_ME_POFF)
		doSendMagicEffect(pos, CONST_ME_TELEPORT)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce foi movido para " .. t[1] .. " War.")
	end
	return true
end
 
Back
Top