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

{Request, movements} Only druids.

LucasFerraz

Systems Analyst
Joined
Jun 10, 2010
Messages
2,858
Reaction score
96
Location
Brazil
Hello,
I need this script:
If druid step in with 20 enchanted small emerald he get teleported.
if druid step in without 20 enchanted small emerald he get back to old position (with message "Only druids with 20 enchanted small emeralds may enter here.)
if other vocation step in get back to old position(with message "Only druids with 20 enchanted small emeralds may enter here.)
if other vocation step in with 20 enchanted small emerald get back to old position (with message "Only druids with 20 enchanted small emeralds may enter here.)


Here is my script, its not working
Lua:
function onStepIn(cid, item, position, fromPosition)

local pos = {x=33427, y=31829, z=13}
local leave = {x=33266, y=31832, z=9}
local was = fromPosition
vocation = getPlayerVocation(cid)

    if(getPlayerItemCount(cid, 7761) >= 20) and vocation == 2 or vocation == 6 or vocation == 10 then
			doPlayerRemoveItem(cid, 7761, 20)
                        doTeleportThing(cid,pos)

    elseif(getPlayerItemCount(cid, 7761) <= 20) then
        doTeleportThing(cid, was)
        doPlayerSendTextMessage(0, cid, 22, "Only druids with 20 enchanted small emeralds may enter here.")

end
end
 
Lua:
function onStepIn(cid, item, position, fromPosition)
 
---------------------------------------------------------------------------------------------------------------------------------
local newPos = {x=33427, y=31829, z=13}
local back = fromPosition
vocation = getPlayerVocation(cid) == 2 or getPlayerVocation(cid) == 6 or getPlayerVocation(cid) == 10
----------------------------------------------------------------------------------------------------------------------------------

        if vocation == true and doPlayerRemoveItem(cid, 7761, 20) == true then
        doTeleportThing(cid,newPos)
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    
	else
        doTeleportThing(cid,back)
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_ENERGYHIT)
	doPlayerSendTextMessage(0, cid, 22, "Only druids with 20 enchanted small emeralds may enter here.")

     end
end

Lua:
<movevent type="StepIn" actionid="xxxx" event="script" value="druidentrance.lua"/>

Should work.
 
Last edited:
Shorter: :p
Lua:
function onStepIn(cid, item, position, fromPosition)

	local newPos = {x = 33427, y = 31829, z = 13}
	local vocation = {2, 6, 10}
 
	if(isInArray(vocation, getPlayerVocation(cid)) and doPlayerRemoveItem(cid, 7761, 20) == true) then
		doTeleportThing(cid, newPos)
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT) 
	else
		doTeleportThing(cid, fromPosition)
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_ENERGYHIT)
		doPlayerSendTextMessage(0, cid, 22, 'Only druids with 20 enchanted small emeralds may enter here.') 
	end
end
 
Back
Top