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

(help) with god script

smockxd

New Member
Joined
Jan 18, 2012
Messages
13
Reaction score
0
when I use the command / to make me this error on the console :/ 0.3.6 use tfs :(
Code:
[23/02/2012 14:15:57] [Error - TalkAction Interface] 
[23/02/2012 14:15:57] data/talkactions/scripts/teleporttiles.lua:onSay
[23/02/2012 14:15:57] Description: 
[23/02/2012 14:15:57] data/talkactions/scripts/teleporttiles.lua:7: attempt to call global 'getPosByDir' (a nil value)
[23/02/2012 14:15:57] stack traceback:
[23/02/2012 14:15:57] 	data/talkactions/scripts/teleporttiles.lua:7: in function <data/talkactions/scripts/teleporttiles.lua:1>

and this is the script
Code:
function onSay(cid, words, param, channel)
	local n = 1
	if(param ~= "" and tonumber(param)) then
		n = tonumber(param)
	end

	local pos = getPosByDir(getCreaturePosition(cid), getPlayerLookDir(cid), n)
	pos.stackpos = STACKPOS_GROUND
	if(getTileThingByPos(pos).uid == 0) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You cannot teleport there.")
		return TRUE
	end

	pos = getClosestFreeTile(cid, pos, FALSE, FALSE)
	if(pos == LUA_ERROR or isInArray({pos.x, pos.y}, 0) == TRUE) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Destination not reachable.")
		return TRUE
	end

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

	return TRUE
end


I will give rep + + to help me
 
lib/function:
Code:
function getPosByDir(fromPosition, direction, size)
local n = size or 1
local pos = fromPosition
if(direction == NORTH) then
pos.y = pos.y - n
elseif(direction == SOUTH) then
pos.y = pos.y + n
elseif(direction == WEST) then
pos.x = pos.x - n
elseif(direction == EAST) then
pos.x = pos.x + n
elseif(direction == NORTHWEST) then
pos.y = pos.y - n
pos.x = pos.x - n
elseif(direction == NORTHEAST) then
pos.y = pos.y - n
pos.x = pos.x + n
elseif(direction == SOUTHWEST) then
pos.y = pos.y + n
pos.x = pos.x - n
elseif(direction == SOUTHEAST) then
pos.y = pos.y + n
pos.x = pos.x + n
end

return pos
end
 
Back
Top