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

Problem with teleport to enchanting

bivan

New Member
Joined
Dec 18, 2008
Messages
125
Reaction score
1
Hi!
I have w problem with this script:
Code:
local ice = {x=1035, y=1022, z=7} ---7992
local fire = {x=1036, y=1022, z=7} --7993
local energy = {x=1037, y=1022, z=7} --7991
local earth = {x=1038, y=1021, z=7} --7994
local exit = {x=1048, y=1026, z=6} --7995
 
function onStepIn(cid, item, position, fromPosition)
local charpos = getPlayerPosition(cid)
 	if item.actionid == 7992 then
		if (isPremium(cid) == TRUE and isDruid(cid) and getPlayerLevel(cid) >= 30) or getPlayerGroupId(cid) >= 2 then
			doTeleportThing(cid,ice)
			doSendMagicEffect(ice,10)
		else
			doCreatureSay(cid,"Only premium Druids are able to enter this portal", TALKTYPE_ORANGE_1)
					doTeleportThing(cid, {x = charpos.x, y = charpos.y+2, z = charpos.z}, TRUE)
					doSendMagicEffect({x = charpos.x, y = charpos.y+2, z = charpos.z},10)
		end
	elseif item.actionid == 7994 then
		if (isPremium(cid) == TRUE and isDruid(cid) and getPlayerLevel(cid) >= 30)  or getPlayerGroupId(cid) >= 2 then
			doTeleportThing(cid,earth)
			doSendMagicEffect(earth,10)
		else
			doCreatureSay(cid,"Only premium Druids are able to enter this portal", TALKTYPE_ORANGE_1)
					doTeleportThing(cid, {x = charpos.x, y = charpos.y+2, z = charpos.z}, TRUE)
					doSendMagicEffect({x = charpos.x, y = charpos.y+2, z = charpos.z},10)
		end
	elseif item.actionid == 7993 then
		if (isPremium(cid) == TRUE and isSorcerer(cid) and getPlayerLevel(cid) >= 30) or getPlayerGroupId(cid) >= 2 then
			doTeleportThing(cid,fire)
			doSendMagicEffect(fire,10)
		else
			doCreatureSay(cid,"Only premium Sorcerers are able to enter this portal", TALKTYPE_ORANGE_1)
					doTeleportThing(cid, {x = charpos.x, y = charpos.y+2, z = charpos.z}, TRUE)
					doSendMagicEffect({x = charpos.x, y = charpos.y+2, z = charpos.z},10)
		end
	elseif item.actionid == 7991 then
		if (isPremium(cid) == TRUE and isSorcerer(cid) and getPlayerLevel(cid) >= 30) or getPlayerGroupId(cid) >= 2 then
			doTeleportThing(cid,energy)
			doSendMagicEffect(energy,10)
		else
			doCreatureSay(cid,"Only premium Sorcerers are able to enter this portal", TALKTYPE_ORANGE_1)
					doTeleportThing(cid, {x = charpos.x, y = charpos.y+2, z = charpos.z}, TRUE)
					doSendMagicEffect({x = charpos.x, y = charpos.y+2, z = charpos.z},10)
		end
	elseif item.actionid == 7995 then
			doTeleportThing(cid,exit)
			doSendMagicEffect(exit,10)
	end
	return TRUE
end
When I try to enter portal, nothing is happening. Could somebody mend it?
 
Code:
function onStepIn(cid, item, position, fromPosition)
	local enchant = {
		[7991] = {p = {x=1037, y=1022, z=7}, v = { 1 } },
		[7992] = {p = {x=1035, y=1022, z=7}, v = { 2 } },
		[7993] = {p = {x=1036, y=1022, z=7}, v = { 1 } },
		[7994] = {p = {x=1038, y=1021, z=7}, v = { 2 } },
		[7995] = {p = {x=1048, y=1026, z=6}, v = {1, 2} }
	}
 	if(item.actionid == enchant[item.aid]) then
		if(isPremium(cid) == true) then
			if(getPlayerVocation(cid) == enchant[item.aid].v) then
				doTeleportThing(cid, enchant[item.aid].p)
				doSendMagicEffect(enchant[item.aid].p, CONST_ME_ENERGYAREA)
			else
				doPlayerSendCancel(cid, "Your vocation is not correct.")
				doTeleportThing(cid, fromPosition)
			end
		else
			doPlayerSendCancel(cid, "You must be premium.")
			doTeleportThing(cid, fromPosition)
		end
		return true
	end
end
 
untested
Code:
local cfg = {
	level = 30,
	premium = true,
	portals = {
-- actionid, teleportToPos, vocations
		[7991] = { {x=1037, y=1022, z=7}, { 1, 5 } },
		[7992] = { {x=1035, y=1022, z=7}, { 2, 6 } },
		[7993] = { {x=1036, y=1022, z=7}, { 1, 5 } },
		[7994] = { {x=1038, y=1021, z=7}, { 2, 6 } },
		[7995] = { {x=1048, y=1026, z=6} }
	}
}
function onStepIn(cid, item, position, fromPosition)
	local i = cfg.portals[item.actionid]
	if i and (not cfg.premium or isPremium(cid)) and (not i[2] or isInArray(i[2], getPlayerVocation(cid))) and (not cfg.level or getPlayerLevel(cid) >= cfg.level) then
		doSendMagicEffect(position, CONST_ME_TELEPORT)
		doTeleportThing(cid, i[1])
		doSendMagicEffect(i[1], CONST_ME_TELEPORT)
	else
		doTeleportThing(cid, fromPosition, true)
		doSendMagicEffect(fromPosition, CONST_ME_TELEPORT)
		doCreatureSay(cid, not i and "" or "Only " .. (cfg.premium and "Premium " or "") .. (i[2][1] == 1 and "Sorcerers" or "Druids") .. (cfg.level and " of level " .. cfg.level .. " or higher" or "") .. " may enter this portal", TALKTYPE_ORANGE_1, false, cid, fromPosition)
	end
end
 
So, in editor all is ok but I have a problem with movements.xml
If I'll register script like this:
Code:
<movevent event="StepIn" actionid="7995" event="script" value="enchant.lua" />
then in console appear appear an error: Attribute event redefined.
It concerns the higher written line. I don't know what in it is badly...
When nothing happened I added:
Code:
 <movevent event="StepIn" actionid="7995" script="enchant.lua" />
 
Code:
<movevent [B][COLOR="Red"]type[/COLOR][/B]="StepIn" actionid="7995" event="script" value="enchant.lua" />
 
It is configuration for test:
beztytuusq.jpg


I don't know why this script doesn't work...
 
Back
Top