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

Action Citizen Lever

Grehy

Killroy
Joined
Nov 21, 2008
Messages
2,631
Reaction score
33
Location
United States
town.lua in actions/scripts/tools
Lua:
function onUse(cid, item, frompos, item2, topos)

player = getThingfromPos(playerpos)
newpos = {x=435, y=483, z=7}
playerpos = getPlayerPosition(cid)

	if item.uid == 7659 then
		doPlayerSendTextMessage(cid,22,"You are now a citizen of the town Nova.")
		doPlayerSetTown(cid, TOWN ID) 
		doTeleportThing(cid,newpos)
		doSendMagicEffect(playerpos,12)
	end
end

Lua:
<action uniqueid="7659" script="tools/town.lua" />

Credits to me. Rep++ if this helped you please :p
 
Last edited:
Code:
<action uniqueid="7659" event="script" value="tools/town.lua"/>
try this one...
 
just need to learn a little more about programming open tibia.
you could have used it rather than on the state pos.
getTownTemplePosition(townId)
if item.uid == 7659 then << not necessary. --The tag xml already does this.
player = getThingfromPos(playerpos) << not necessary.
add the code:
townid = 1 or town choice.

Hail ohio
 
My version:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local town = (item.aid - 20000)
	local pos = getTownTemplePosition(town)

	if (item.itemid == 1945) then
		doSendMagicEffect(fromPosition, CONST_ME_POFF)
		doTeleportThing(cid, pos)
		doSendMagicEffect(pos, CONST_ME_TELEPORT)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are now citizen of ".. getTownName(town) .."!")
		doTransformItem(item.uid, item.itemid + 1)
	elseif (item.itemid == 1946) then
		doTransformItem(item.uid, item.itemid - 1)
	end

	return true
end

To setup use Action ID: Town ID + 20,000 on laver :)
 
Any chance to make this for mystic flame? So when you step on it you become a citizen of the town im in?:)
 
Code:
function onUse(cid, item, pos)

local pos = {x=1000, y=996, z=7}

if doPlayerSetTown(cid, 1) then
nome = getTownName(1)
doTeleportThing(cid, pos)
doSendMagicEffect(pos,29)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Voce agora é o novo morador de  "..nome..".")

end
return TRUE
end
Your not worked here.
I made one and it worked.
Att
 
Back
Top