Action Citizen Lever

Grehy

Killroy
Joined
Nov 21, 2008
Messages
2,628
Best answers
0
Reaction score
30
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:

Sync

Ø,ø
Joined
May 26, 2009
Messages
1,876
Best answers
0
Reaction score
19
Location
Canada
eeeeeehm nice. you should use locals in your script :p
 

Zerak456

Gorlex.net NEW!
Joined
Aug 13, 2008
Messages
1,060
Best answers
0
Reaction score
6
Location
Germany
Code:
<action uniqueid="7659" event="script" value="tools/town.lua"/>
try this one...
 

marcryzius

New Member
Joined
Mar 22, 2009
Messages
61
Best answers
0
Reaction score
0
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
 

chojrak

Banned User
Joined
Oct 25, 2008
Messages
5,832
Best answers
2
Reaction score
158
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 :)
 

sikkee

New Member
Joined
Feb 27, 2010
Messages
89
Best answers
0
Reaction score
2
Any chance to make this for mystic flame? So when you step on it you become a citizen of the town im in?:)
 

Trinks OT

New Member
Joined
Jun 24, 2011
Messages
3
Best answers
0
Reaction score
0
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
 
Top