• 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 teleport / town script!

tosse12

Panchira Project Member
Joined
Jun 10, 2007
Messages
864
Reaction score
9
Location
Sweden
Hi,
As you can see I am havin' some problems with my teleport script.
The thing is, that this script worked before(even without changes) but now it just stoped work.

Code:
local nPos = {
x = 9977,
y = 10003,
z = 7
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.uid == 1000 and item.id == 1445 then
		doPlayerSetTown(cid, 1)
		doTeleportThing(cid, nPos, TRUE)
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
		doSendAnimatedText(nPos, 'You are now living in Zergius!', TEXTCOLOR_GOLD)
	end
	return TRUE
end

Anyone who have any ide what's wrong?
 
PHP:
local nPos = {
x = 9977,
y = 10003,
z = 7
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.uid == 1000 and item.itemid == 1445 then
		doPlayerSetTown(cid, 1)
		doTeleportThing(cid, nPos, TRUE)
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
		doSendAnimatedText(nPos, 'You are now living in Zergius!', TEXTCOLOR_GOLD)
	end
	return TRUE
end
 
Code:
local nPos = {
x = 9977,
y = 10003,
z = 7
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.uid == 1000 then
        doPlayerSetTown(cid, 1)
        doTeleportThing(cid, nPos, TRUE)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
        doSendAnimatedText(nPos, 'You are now living in Zergius!', TEXTCOLOR_GOLD)
    end
    return TRUE
end

you don't need item.itemid unless you have a script for multiple items xD
 
you don't even need if item.uid either
it can be like this:
Code:
local nPos = {
x = 9977,
y = 10003,
z = 7
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
        doPlayerSetTown(cid, 1)
        doTeleportThing(cid, nPos, TRUE)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
        doSendAnimatedText(nPos, 'You are now living in Zergius!', TEXTCOLOR_GOLD)
    end
    return TRUE
end
and just declare the uid in actions.xml
 
hihi
LUA:
local town = 1

function onUse(cid, item, fromPosition, itemEx, toPosition)
    doPlayerSetTown(cid, town)
    doTeleportThing(cid, getTownTemplePosition(town), false)
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    doSendAnimatedText(nPos, 'You are now living in ' .. getTownName(town) .. '!', TEXTCOLOR_GOLD)
    return true
end
 
hihi
LUA:
local town = 1

function onUse(cid, item, fromPosition, itemEx, toPosition)
    doPlayerSetTown(cid, town)
    doTeleportThing(cid, getTownTemplePosition(town), false)
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    doSendAnimatedText(nPos, 'You are now living in ' .. getTownName(town) .. '!', TEXTCOLOR_GOLD)
    return true
end
ok
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	return doPlayerSetTown(cid, 1) and doTeleportThing(cid, getPlayerMasterPos(cid), true) and doSendMagicEffect(getThingPos(cid), 10) and doSendAnimatedText(getPlayerMasterPos(cid), 'You are now living in ' .. getTownName(1) .. '!', TEXTCOLOR_GOLD)
end
 
Why should he? So it doesn't work anymore or what?

lol? When I have too many 'end' then I have error
like:
Code:
[Error - LuaScriptInterface::loadFile] data/actions/scripts/xxxxx.lua:149: '<eof>' expected near 'end'
 [Warning - Event::loadScript] Cannot load script (data/actions/scripts/xxxxx.lua)
 data/actions/scripts/xxxxx.lua:149: '<eof>' expected near 'end'
 
Thanks guys for your fast replys :D
But I have to disappoint you, none of these do not work.
But,(again) I think it's my server who doesn't load action.xml -.-'

EDIT:
Yeap, downloaded a new dist. my script is working now :D
 
Last edited:
The problem with this script is that it doesnt work when you walk into the teleport, only when you rightclick on it, does a onWalk function exist or how does one solve this problem?
 
Back
Top