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

Function For Remove Teleport?

pugamoline

uint32_t patch_mem(char *
Joined
Nov 15, 2011
Messages
189
Reaction score
19
hi otlanders i have this script, for Pythius the rotten quest (Firewalker Boots)
need help to create a function to remove teleport

this is my script

Lua:
local last = 0
local delay = 60 * 60 * 3
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if (itemEx.uid <= 65535 or itemEx.actionid > 0) and (not (itemEx.actionid == 3602)) and (itemEx.itemid == 1304 or itemEx.itemid == 354 or itemEx.itemid == 355 or itemEx.itemid == 9024 or itemEx.itemid == 9025) then
        doTransformItem(itemEx.uid, 383)
        doDecayItem(itemEx.uid)
    elseif itemEx.uid == 60001 then
        doTeleportThing(cid, {x=32551, y=31376, z=10})
        doSendMagicEffect({x=32551, y=31376, z=10}, 10)
    elseif (itemEx.actionid == 3602) then
        if ((os.time() - last) >= delay) and getGlobalStorageValue(33503, 0) then
            local teleport = doCreateTeleport(1387, {x=32564, y=31406, z=15, stackpos=1}, {x=32551, y=31376, z=15, stackpos=2})
            doItemSetAttribute(teleport, "aid", 101)
             setGlobalStorageValue(33503, 1)
            last = os.time()   
		else
            doPlayerSendTextMessage(cid, 25, "Once every 3 hours...")
        end
	  elseif (itemEx.actionid == 3602) then
        if ((os.time() - last) >= delay) and getGlobalStorageValue(33503, 1) then
            local teleport = doCreateTeleport(1387, {x=32564, y=31406, z=15, stackpos=1}, {x=32551, y=31376, z=15, stackpos=2})
            doItemSetAttribute(teleport, "aid", 101)
            last = os.time()   
		else
            doPlayerSendTextMessage(cid, 25, "Once every 3 hours...")
        end	
    else
        return false
    end
    return true
end


Rep++ For Help :)
 
Here not sure but try and tell me errors.
data/movements/removetp.lua
Lua:
function onStepIn(cid, item, position, fromPosition)

local teleport {x=32564, y=31406, z=15}
local get = getThingfromPos(teleport)

        if get.itemid == 1387 then
		       doRemoveItem(get.uid, 1)
			end
		return true
	end
XML:
	<movevent type="StepIn" actionid="101" event="script" value="removetp.lua"/>
 
Last edited:
Here is a "kill script" that will remove the teleport after x seconds. ;)


data/creaturescripts/scripts/login.lua
Lua:
registerCreatureEvent(cid, "Killer")

data/creaturescripts/creaturescripts.xml
XML:
<event type="kill" name="Killer" event="script" value="script.lua"/>

data/creaturescripts/scripts/script.lua
Lua:
local t = {
	["pythius the rotten"] = { -- Monster name (must be LOWER case).
		toPos = {x = 100, y = 100, z = 7}, -- Where the teleport takes the players.
		createPos = {x = 100, y = 100, z = 7}, -- Where the teleport is created.
		timeToRemove = 60, -- Seconds until the teleport is removed.
		messageOnKill = "Fighting little worm, your victory shall be rewarded!" -- The message the monster says onKill.
	},
}
 
local function remove(pos)
    local k = getTileItemById(pos, 1387).uid
    return k > 0 and doRemoveItem(k)
end
 
function onKill(cid, target, damage, flags)
	local v = t[string.lower(getCreatureName(target))]
	if(v and (damage == true or bit.band(flags, 1) == 1) and isMonster(target)) then
		doCreatureSay(cid, v.messageOnKill, TALKTYPE_MONSTER, nil, nil, getCreaturePosition(target))
		doSendMagicEffect(v.createPos, CONST_ME_ENERGYAREA)
		doCreateTeleport(1387, v.toPos, v.createPos)
		addEvent(remove, v.timeToRemove * 1000)
	end
	return true
end
 
Back
Top