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

Release City script.

Ates.tr

Im back
Joined
Nov 11, 2007
Messages
1,046
Reaction score
2
Location
Sweden
I'll just training on scripting so maybe this will work i dont know cause not tested,

Can be useful for peoples.

PHP:
-- Script by Ates
function onStepIn(cid, item, pos)

                 -- /Pos,Msg,TownID/--
local config = {
     [40000] = {x=1000, y=1001, z=7, "You are a citizen of Thais now.", 1},
	 [40001] = {x=1000, y=1002, z=7, "You are a citizen of Venore now.", 2},
	 [40002] = {x=1000, y=1003, z=7, "You are a citizen of Carlin now.", 3},
	 [40003] = {x=1000, y=1004, z=7, "You are a citizen of Kazardoon now.", 4},
	 [40004] = {x=1000, y=1005, z=7, "You are a citizen of Svargrond now.", 5},
	 [40005] = {x=1000, y=1006, z=7, "You are a citizen of Ankrahmun now.", 6}
}
local teleport = 1387


     if isPlayer(cid) == TRUE then
     for action, variable in pairs(config) do
if item.id == teleport then
	 doCreatureSay(cid, variable[2], TALKTYPE_ORANGE_1)
	 doPlayerSetTown(cid, variable[3])
	 doTeleportThing(variable[1])
	 doSendMagicEffect(variable[1],2)
     end
     return TRUE
	 end
end

Edited1: A bug fix
Edited2: One more bug fix, also changed text.
Edited3: More bugs fixed and changed text again.
 
Last edited:
Use 'pairs' not 'ipairs', config.teleport is nil, doTeleportThing will print an error, probably 'creature not found', when declaring pos in table, you still have to put it in { }, item.id should be item.itemid, also you should use 'key' value instead of teleportID.

Code:
local config = {
			-- /Pos,Msg,TownID/--
	[40000] = { { x = 1000, y = 1001, z = 7 }, "Your home town its Thais now.", 1}, -- 1 = TownID 1
	[40001] = { { x = 1000, y = 1002, z = 7 }, "Your home town its Venore now.", 2},
	[40002] = { { x = 1000, y = 1003, z = 7 }, "Your home town its Carlin now.", 3},
	[40003] = { { x = 1000, y = 1004, z = 7 }, "Your home town its Kazardoon now.", 4},
	[40004] = { { x = 1000, y = 1005, z = 7 }, "Your home town its Svargrond now.", 5},
	[40005] = { { x = 1000, y = 1006, z = 7 }, "Your home town its Ankrahmun now.", 6}
}

function onStepIn(cid, item, pos)
	if isPlayer(cid) == TRUE then
		for action, variable in pairs(config) do
			if item.actionid == action then
				doCreatureSay(cid, variable[2], TALKTYPE_ORANGE_1)
				doPlayerSetTown(cid, variable[3])
				doTeleportThing(cid, variable[1], FALSE)
				doSendMagicEffect(variable[1],2)
			end
		end
	end
	return TRUE
end

Also there was missing end.
Placing config outside of the function makes the script load it only once <thanks erp0t>.
You declare item in movements.xml, no need to check again in the script.
 
Last edited:
Code:
local table = {
    [KEY] = 1387
}

O_O???????

It was just an example...

Like you have in your script:
Code:
local config = {
    [40000] = { { pos }, "string", int }
}

The key = 40000 and values are as follow - { pos }, "string", int.

Just use mine script :(

... or at least take a closer look at it.
 
Code:
local table = {
    [KEY] = 1387
}

O_O???????

It was just an example...

Like you have in your script:
Code:
local config = {
    [40000] = { { pos }, "string", int }
}

The key = 40000 and values are as follow - { pos }, "string", int.

Just use mine script :(

... or at least take a closer look at it.

haah let me update it fast. takes 20 secs something i think.
 
Back
Top