So this time i do not get any problems like "callback parameter..." etc. This time its just doesnt do anything.
My script should work like this. When you turn the light on, you will have 2 seconds to click on the other light to remove the stone. When it will take longer than 2 sec, the light of the first lantern will turn off again. So my script is working till the addevent. The light goes on, but there is no timer. It wont turn off after 2 sec
. What am i doing wrong?? Codex NG please help haha 
My script should work like this. When you turn the light on, you will have 2 seconds to click on the other light to remove the stone. When it will take longer than 2 sec, the light of the first lantern will turn off again. So my script is working till the addevent. The light goes on, but there is no timer. It wont turn off after 2 sec
Code:
local config = {
messageGood = "Stone has been removed!",
messageSlow = "You are to slow.",
stonepos = {x=296, y=365, z=8, stackpos=1},
delay = 2
}
function onUse(cid, item, frompos, item2, topos)
local function turnLight(cid)
if item.itemid == 3710 and item.uid == 1207 then
doTransformItem(item.uid,item.itemid-1)
end
end
local getpiece1 = getThingfromPos(config.stonepos)
if item.itemid == 3709 and item.uid == 1207 and getGlobalStorageValue(1200) < 0 then
doTransformItem(item.uid,item.itemid+1)
doSendMagicEffect(topos,14)
doPlayerAddHealth(cid, -10000)
setGlobalStorageValue(1200,0)
doPlayerSendTextMessage(cid,22, "There are 4 lights left.")
addEvent(turnLight, config.delay * 1000, cid)
elseif item.uid == 1208 and item.itemid == 3709 and getGlobalStorageValue(1200) == 0 then
doRemoveItem(getpiece1.uid,1)
doTransformItem(item.uid,item.itemid+1)
doPlayerSendTextMessage(cid,22,config.messageGood)
else
doPlayerSendTextMessage(cid,22,"Ha ha ha! Burn!")
doSendMagicEffect(topos,14)
doPlayerAddHealth(cid, -15000)
end
return true
end
Last edited by a moderator: