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

doCreatureSayWithDistance(cid, position, text, type)

EvulMastah

๏̯͡๏﴿
Premium User
Joined
Aug 19, 2007
Messages
4,941
Solutions
11
Reaction score
352
global.lua OR functions.lua:
Code:
function doCreatureSayWithDistance(cid, position, text, type)
	oldPosX = setPlayerStorageValue(cid, 10000, getCreaturePosition(cid).x)
	oldPosY = setPlayerStorageValue(cid, 10001, getCreaturePosition(cid).y)
	oldPosZ = setPlayerStorageValue(cid, 10002, getCreaturePosition(cid).z)
	oldPos = { x = getPlayerStorageValue(cid, 10000), y = getPlayerStorageValue(cid, 10001), z = getPlayerStorageValue(cid, 10002) }
	doTeleportThing(cid, position, 0)
	doCreatureSay(cid, text, type)
	return doTeleportThing(cid, oldPos, 0)
end
This is the example Ive tested it with:
Code:
Code:
function onSay(cid, words, param)
	pos = {x=102,y=121,z=7}
	return doCreatureSayWithDistance(cid, pos, "WORKING !!!", TALKTYPE_ORANGE_1)
end

Requested by Serp:
http://otland.net/showthread.php?t=9949
 
why are you using storage values? there's no need for that...
Code:
function doCreatureSayWithDistance(cid, position, text, type)
	oldPos = getCreaturePosition(cid)
	doTeleportThing(cid, position, 0)
	doCreatureSay(cid, text, type)
	return doTeleportThing(cid, oldPos, 0)
end
 
Nice function, haven't tested it yet, but:
When you teleport back, do you stand looking in the same direction?
 
this cause some crashs because when you teleported again in sqm, this function teleport again and this forever
This cause crash, i use it only with storage :p
 
You can do the same with 1 lines.

doCreatureSay(cid, text, type[,pos])
 
Back
Top