Hi, i want to have a tp scroll fixed.
Tp scroll should work anywhere even if you have pk.
Also when you press on scroll you teleport like when you press on it you dont have to wait any seconds.
This is script, if someone could fix it for me, this would be great!
Tp scroll should work anywhere even if you have pk.
Also when you press on scroll you teleport like when you press on it you dont have to wait any seconds.
This is script, if someone could fix it for me, this would be great!
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 == 7727 then
npos = {x=1000, y=1000, z=7}
doTeleportThing(z.cid, npos)
doPlayerSendTextMessage(z.cid, 21, "You have been Teleported.")
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, 1000, z)
Use1 = addEvent(onUse1, 11000, z)
timecount = 10
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