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

Lua Movement

SasirO

Banned User
Joined
Apr 30, 2009
Messages
559
Reaction score
0
My movement script isnt working, using tfs 0.3.4 pl2 :p
PHP:
function onStepIn(cid, item, pos)

local ice = {x=427, y=503, z=7}
local fire = {x=424, y=503, z=7}
local energy = {x=424, y=505, z=7}
local earth = {x=427, y=505, z=7}

if getPlayerLookDir(cid) == 0 then
newdir = 2
elseif getPlayerLookDir(cid) == 1 then
newdir = 3
elseif getPlayerLookDir(cid) == 2 then
newdir = 0
else
newdir = 1
end

if item.actionid == 7801 then
if getPlayerVocation(cid) == 2 or getPlayerVocation(cid) == 6 and getPlayerLevel(cid) >= 30 and isPremium(cid) == TRUE then
doTeleportThing(cid,ice)
doSendMagicEffect(ice,10)
else
doPlayerSay(cid,"Only Premium Druids of level 30 or higher are able to enter this portal", 16)
doMoveCreature(cid, newdir)
end
elseif item.actionid == 7802 then
if getPlayerVocation(cid) == 2 or getPlayerVocation(cid) == 6 and getPlayerLevel(cid) >= 30 and isPremium(cid) == TRUE then
doTeleportThing(cid,earth)
doSendMagicEffect(earth,10)
else
doPlayerSay(cid,"Only Premium Druids of level 30 or higher are able to enter this portal", 16)
doMoveCreature(cid, newdir)
end
elseif item.actionid == 7803 then
if getPlayerVocation(cid) == 1 or getPlayerVocation(cid) == 5 and getPlayerLevel(cid) >= 30 and isPremium(cid) == TRUE then
doTeleportThing(cid,fire)
doSendMagicEffect(fire,10)
else
doPlayerSay(cid,"Only Premium Sorcerers of level 30 or higher are able to enter this portal", 16)
doMoveCreature(cid, newdir)
end
elseif item.actionid == 7804 then
if getPlayerVocation(cid) == 1 or getPlayerVocation(cid) == 5 and getPlayerLevel(cid) >= 30 and isPremium(cid) == TRUE then
doTeleportThing(cid,energy)
doSendMagicEffect(energy,10)
else
doPlayerSay(cid,"Only Premium Sorcerers of level 30 or higher are able to enter this portal", 16)
doMoveCreature(cid, newdir)
end
end
end

PHP:
<movevent event="StepIn" actionid="7801" script="alterstp.lua" />
<movevent event="StepIn" actionid="7802" script="alterstp.lua" />
<movevent event="StepIn" actionid="7803" script="alterstp.lua" />
<movevent event="StepIn" actionid="7804" script="alterstp.lua" />


Im not getting any errors or such, its just not working, And yes, i have placed the action id number on my map.:blink:
 
Nope, there's mistake in XML code, also there's one missing return :P

LUA:
function onStepIn(cid, item, pos)
local ice = {x=427, y=503, z=7}
local fire = {x=424, y=503, z=7}
local energy = {x=424, y=505, z=7}
local earth = {x=427, y=505, z=7}
	if getPlayerLookDir(cid) == 0 then
		newdir = 2
	elseif getPlayerLookDir(cid) == 1 then
		newdir = 3
	elseif getPlayerLookDir(cid) == 2 then
		newdir = 0
	else
		newdir = 1
	end
	if item.actionid == 7801 then
		if getPlayerVocation(cid) == 2 or getPlayerVocation(cid) == 6 and getPlayerLevel(cid) >= 30 and isPremium(cid) == TRUE then
			doTeleportThing(cid, ice)
			doSendMagicEffect(ice, 10)
		else
			doPlayerSay(cid, "Only Premium Druids of level 30 or higher are able to enter this portal", 16)
			doMoveCreature(cid, newdir)
		end
	elseif item.actionid == 7802 then
		if getPlayerVocation(cid) == 2 or getPlayerVocation(cid) == 6 and getPlayerLevel(cid) >= 30 and isPremium(cid) == TRUE then
			doTeleportThing(cid, earth)
			doSendMagicEffect(earth, 10)
		else
			doPlayerSay(cid, "Only Premium Druids of level 30 or higher are able to enter this portal", 16)
			doMoveCreature(cid, newdir)
		end
	elseif item.actionid == 7803 then
		if getPlayerVocation(cid) == 1 or getPlayerVocation(cid) == 5 and getPlayerLevel(cid) >= 30 and isPremium(cid) == TRUE then
			doTeleportThing(cid, fire)
			doSendMagicEffect(fire, 10)
		else
			doPlayerSay(cid, "Only Premium Sorcerers of level 30 or higher are able to enter this portal", 16)
			doMoveCreature(cid, newdir)
		end
	elseif item.actionid == 7804 then
		if getPlayerVocation(cid) == 1 or getPlayerVocation(cid) == 5 and getPlayerLevel(cid) >= 30 and isPremium(cid) == TRUE then
			doTeleportThing(cid, energy)
			doSendMagicEffect(energy, 10)
		else
			doPlayerSay(cid, "Only Premium Sorcerers of level 30 or higher are able to enter this portal", 16)
			doMoveCreature(cid, newdir)
		end
	end
return TRUE
end
Code:
<movevent type="StepIn" actionid="7801" event="script" value="alterstp.lua" />
<movevent type="StepIn" actionid="7802" event="script" value="alterstp.lua" />
<movevent type="StepIn" actionid="7803" event="script" value="alterstp.lua" />
<movevent type="StepIn" actionid="7804" event="script" value="alterstp.lua" />
 
I think the script is outdated, thats why im getting debug, could you please post your script or could someone update it ?, thanks in advance.
 
Back
Top