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

Teleport Doll [ rep++] Help to edit it

Dalale

GX
Joined
Jun 13, 2008
Messages
718
Reaction score
2
Location
Sweden
Code:
local Time1 = 0 
local Use1 = 0 
local timecount = 0 

local function exhaust(cid, storevalue, exhausttime)
-- Exhaustion function by Alreth, v1.1 2006-06-24 01:31
-- Returns 1 if not exhausted and 0 if exhausted
    
    newExhaust = os.time()
    oldExhaust = getPlayerStorageValue(cid, storevalue)
    if (oldExhaust == nil or oldExhaust < 0) then
        oldExhaust = 0
    end
    if (exhausttime == nil or exhausttime < 0) then
        exhausttime = 1
    end
    diffTime = os.difftime(newExhaust, oldExhaust)
    if (diffTime >= exhausttime or diffTime < 0) then
        setPlayerStorageValue(cid, storevalue, newExhaust) 
        return 1
    else
        return 0
    end
end

local function onTime1(z) 
 if isPlayer(z.cid) == 1 then 
 ppos = getPlayerPosition(z.cid) 
  if getCreatureCondition(z.cid, CONDITION_INFIGHT) == 1  then 
   stopEvent(time1) 
   stopEvent(Use1) 
   doPlayerSendTextMessage(z.cid, 21, "Teleport Canceled Because of IN-FIGHT!") 
  else
   if timecount > 0 then
    Time1 = addEvent(onTime1, 1000, z)
   end
   timecount = timecount-1
   doPlayerSendTextMessage(z.cid, 21, "Teleporting in " .. timecount .. " second.")
   doSendMagicEffect(ppos, 53)
end
 else 
  stopEvent(time1) 
  stopEvent(Use1) 
 end 
end 
local function onUse1(z) 
 if isPlayer(z.cid) == 1 then 
  if getCreatureCondition(z.cid, CONDITION_INFIGHT) == 0 then 
   ppos = getPlayerPosition(z.cid)  
   stopEvent(time1) 
   if z.item.itemid == 9019 then 
    npos = {x=783,  y=698,  z=7} 
    doTeleportThing(z.cid, npos) 
    doPlayerSendTextMessage(z.cid, 21, "Teleported to the XxXX Teleport Room.") 
    doSendMagicEffect(npos,40) 
    doSendMagicEffect(npos,10) 
    doSendMagicEffect(ppos,10) 
    stopEvent(time1) 
   end  
  else 
   stopEvent(time1) 
   doPlayerSendTextMessage(z.cid, 21, "Teleport Canceled.") 
  end 
 end 
end 

function onUse(cid, item, ppos, frompos, item2, topos) 
 local z = {cid = cid, item = item, ppos = ppos, item2 = item2, topos = topos} 
 if isPremium(cid) then 
  if getCreatureCondition(z.cid, CONDITION_INFIGHT) == 0 then 
	if (exhaust(cid, 9143, 11) > 0) then
		Time1 = addEvent(onTime1, 600, z) 
		Use1 = addEvent(onUse1, 6000, z) 
		timecount = 7
	else 
   doPlayerSendCancel(cid, "You cannot use a teleport scroll again until you have been teleported.") 
   doSendMagicEffect(frompos, 2) 
   end
   	else 
   doPlayerSendCancel(cid, "You cannot use a teleport scroll when you are in a fight.") 
   doSendMagicEffect(frompos, 2) 
  end 
 else 
  doPlayerSendCancel(cid, "Only players with a Premium account can use teleport scroll.") 
  doSendMagicEffect(frompos, 2) 
 end 
 return 1 
end

When i use this it says

You cannot use a teleport scroll when you are in a fight

but im not in a fight or even pzed
 
Code:
if getCreatureCondition(z.cid, CONDITION_INFIGHT) == 0 then

try making it ==1, if it doesnt work play around with it, try different numbers.
 
Back
Top