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

[REQUEST] Not being able to /c in houses

Grehy

Killroy
Joined
Nov 21, 2008
Messages
2,631
Reaction score
33
Location
United States
Is there anyway I can edit the talkaction so that it does not allow you to /c players into houses? Thanks!
 
Try this:
Lua:
	if getTileHouseInfo(getPlayerPosition(target)) == TRUE then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You cannot tp player from house.")
		return TRUE
	end
If it doesn't work, replace getPlayerPosition(target) to getCreaturePosition(target). I think Creature is better.

Complete teleportthere.lua:
Lua:
function onSay(cid, words, param)
	if(param == "") then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
		return TRUE
	end

	local target = getPlayerByNameWildcard(param)
	if(target == 0) then
		target = getCreatureByName(param)
		if(target == 0) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Creature not found.")
			return TRUE
		end
	end

	if(isPlayer(target) == TRUE and isPlayerGhost(target) == TRUE and getPlayerAccess(target) > getPlayerAccess(cid)) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Creature not found.")
		return TRUE
	end

	local pos = getClosestFreeTile(target, getCreaturePosition(cid))
	if(pos == LUA_ERROR or isInArray({pos.x, pos.y, pos.z}, 0) == TRUE) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action.")
		return TRUE
	end
	
	if getTileHouseInfo(getPlayerPosition(target)) == TRUE then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You cannot tp player from house.")
		return TRUE
	end

	local tmp = getCreaturePosition(target)
	if(doTeleportThing(target, pos, TRUE) ~= LUA_ERROR and isPlayerGhost(target) ~= TRUE) then
		doSendMagicEffect(tmp, CONST_ME_POFF)
		doSendMagicEffect(pos, CONST_ME_TELEPORT)
	end

	return TRUE
end
I cannot test it now so test it on your own :p
 
Doesn't work but doesn't show any error either. It shouldn't let teleport not invited player to house right?
 
It shouldn't let teleport not invited player to house right?
I think only taking target position
Lua:
getPlayerPosition(target)
should be changed to taking position of player using talkaction
Lua:
getPlayerPosition(cid)

So in result:
Lua:
        if getTileHouseInfo(getPlayerPosition(cid)) == TRUE then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You cannot tp player to house.")
                return TRUE
        end
I have to test it.

@EDIT
It doesn't work at all xD
 
Last edited:
I though its already in tfs ;/ but noou..

change

local pos = getClosestFreeTile(target, getCreaturePosition(cid))

to

local pos = getClosestFreeTile(target, getCreaturePosition(cid), FALSE, FALSE)
 
Back
Top