Caduceus
Unknown Member
- Joined
- May 10, 2010
- Messages
- 321
- Solutions
- 2
- Reaction score
- 24
Converting a script from a prior release to 1.2. Switch throws no errors in console. However, it does display
regardless of level.
Any suggestions?
Any suggestions?
Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local storage = 15001
waittime = 10 * 60 -- 10 minutes
demon1pos = {x=1119, y=994, z=10}
if item.uid == 15102 then
if item.itemid == 1946 then
playerpos = getPlayerPosition(cid)
player = getThingfromPos(playerpos)
nplayerpos = {x=1107, y=994, z=10}
-- check if player has required level.
if player:getLevel() >= 60 then
end
if player:getStorageValue(storage) == 0 then
doTeleportThing(player.uid,nplayerpos)
doSendMagicEffect(nplayerpos, CONST_ME_FIREWORK_RED)
player:sendTextMessage(MESSAGE_INFO_DESCR, "Hope to see you on the other side!")
demon1 = doSummonCreature("Stormblast", demon1pos)
item:transform(1945)
nexttime = os.time()+ waittime
addEvent(doRemoveCreature, 600 * 1000, demon1) -- remove time in seconds
else
player:sendTextMessage(MESSAGE_INFO_DESCR, "You Have Already Completed The Catacombs Quest.")
end
else
player:sendTextMessage(MESSAGE_STATUS_SMALL, "Switch requires level 60.")
end
else
doPlayerSendDefaultCancel(cid, RETURNVALUE_CANNOTUSETHISOBJECT)
end
if item.itemid == 1946 then
if os.time() >= nexttime then
item:transform(1946)
else
waittime = nexttime - os.time()
player:sendTextMessage(MESSAGE_INFO_DESCR, "Sorry, you need to wait " ..waittime.. " seconds.")
end
end
return true
end