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

Lua [/TOWN] Options

Toitsss

New Member
Joined
Sep 15, 2008
Messages
47
Reaction score
0
Hello, How can i edit the command, So it only works inside PZ?
I have a war ot, and with the command /town 1, 2 etc, yo uget tpd to different temple. But atm you can say it everywhere, even while fighting. Help needed.
 
Hello, How can i edit the command, So it only works inside PZ?
I have a war ot, and with the command /town 1, 2 etc, yo uget tpd to different temple. But atm you can say it everywhere, even while fighting. Help needed.

post the script, or add in the script if has condition bla bla bla then return false
 
It doesnt work, ;/
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)
		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

	tmp = getCreaturePosition

(tid)
	if(doTeleportThing(tid, pos, true) and not isPlayerGhost(tid)) then
		doSendMagicEffect(tmp, 

CONST_ME_POFF)
		doSendMagicEffect(pos, CONST_ME_TELEPORT)
	[B]if(isPlayerPzLocked(cid)) then doPlayerSendCancel

(cid, "You cannot use this command when you are in a fight!") doSendMagicEffect(cid, CONST_ME_POFF) return true[/B]
end	end

	return true
end
ATM it looks like this, the bold part is the one the ^suggested me to do
 
Code:
function onSay(cid, words, param, channel)
	if(param == '') then
		doPlayerSendTextMessage(cid, 

MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
		return true
	elseif(isPlayerPzLocked(cid)) then
		doPlayerSendCancel(cid, "You cannot use this command when you are in a fight!")
		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

	tmp = getCreaturePosition(tid)
	if(doTeleportThing(tid, pos, true) and not isPlayerGhost(tid)) then
		doSendMagicEffect(tmp, CONST_ME_POFF)
		doSendMagicEffect(pos, CONST_ME_TELEPORT)
	end

	return true
end
 
Thanks Cycotian !
Now they cant use it when they are fighting, also the one who said it up, i rep´+ you also cause i just didnt know where to add it i think :D
Any possible way to make it only usable inside pz?
 
Back
Top