• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action [Help]

JacobC

New Member
Joined
Apr 7, 2009
Messages
34
Reaction score
1
Hey guys, Im trying to make a teleport scroll.
This is my code

Code:
function onUse(cid, item, frompos, item2, topos)
   	npos = {x=160, y=50, z=7}
   	if item.itemid == 5952
   		then
   		doTeleportThing(cid,npos)
        doSendMagicEffect(topos, CONST_ME_TELEPORT)
        doSendMagicEffect(npos, CONST_ME_TELEPORT)
        doRemoveItem(item.uid)
    end
end

and this is the actions.xml
Code:
<action itemid="5952" script="tools/tp.lua"/>

I donno how to make it not work in battle mode...
Any tips?
 
Last edited:
Here is my tp scroll...

PHP:
	local config = {
	---- CONFIG ----


        time = 0      -- after this seconds, the player will be teleportet


	----------------
}       -- Don't touch ----------------
        local events = {}
        local z = config.time
        -------------------------------

function onUse(cid, item, fromPosition, itemEx, toPosition)
		local message = "You will be teleportet in: 1 sec"

		if getPlayerGroupId(cid) >= 1 then
			if getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE then
				events = addEvent(text,100,{cid = cid, z = z})
				doPlayerSendTextMessage(cid,18,message)
			else
				doPlayerSendTextMessage(cid,18,"Sorry you have a battle sign.")
			end
		else
			doPlayerSendTextMessage(cid,18,"Sry you are a gm :D, use /t.")
		end
	else
		doPlayerSendTextMessage(cid,18,"Only VIP Player can use this.")
	end
	return TRUE
end

function text(parameters)
	local cid = parameters.cid
	local z = parameters.z

	if z >= 1 then
		if getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE then
			doPlayerSendTextMessage(cid,18,""..z.."")
			z = z-1
			events = addEvent(text,1000,{cid = cid, z = z})
		else
			events = nil
			doPlayerSendMessage(cid,18,"Failed, you have pz")
		end
	elseif z == 0 then
		if getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE then
			z = config.time
			events = nil
			doSendMagicEffect(getCreaturePosition(cid),2)
			doTeleportThing(cid,(getTownTemplePosition(getPlayerTown(cid))))
			doSendMagicEffect(getCreaturePosition(cid),28)
			doPlayerSendTextMessage(cid,18,"You have teleported to temple.")
		else
			events = nil
			doPlayerSendMessage(cid,18,"Sorry you have a battle sign.")
		end
        end
        return TRUE
end

if i helped u rep++ me :D
 
Lua:
function onUse(cid, item, frompos, item2, topos)
   	npos = {x=160, y=50, z=7}
   if item.itemid == 5952 then
       if (hasCondition(cid, CONDITION_INFIGHT) == TRUE) then
          doPlayerSendCancel(cid, "Sorry,you have a battle sign")
          return TRUE
          end
          doTeleportThing(cid,npos)
          doSendMagicEffect(topos, CONST_ME_TELEPORT)
          doSendMagicEffect(npos, CONST_ME_TELEPORT)
          doRemoveItem(item.uid)
   end
   return TRUE
end
 
Do explain how action script is not in the right section when the name of the section is (And I quote!) "Actions, MoveEvents & TalkActions".
 
Because you are requesting support.
 
Back
Top