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

Create and remove npc lever to quest

Varianek

New Member
Joined
Nov 4, 2020
Messages
16
Reaction score
2
Hi, I don't know. Why this script no work? 8.6


Code:
local level = 365
local seconds = 30
local event = 0
 
local function reset(leverPos)
        local lever = getTileItemById(leverPos, 1946).uid
    doTransformItem(lever, 1945)
    doRemoveCreature(("Jack")
        doPlayerSendTextMessage(cid,21,"Musisz uzyc dzwignie, by stworzyc NPC Jack!")
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
 
 
          if item.itemid == 1945 and getPlayerLevel(cid) >= level then
                doRemoveCreature(("Jack")
                    doPlayerSendTextMessage(cid,21,"NPC USUNIETY!")
                event = addEvent(reset, seconds * 1000, getThingPos(item.uid))
        doTransformItem(item.uid,item.itemid+1)
    elseif item.itemid == 1946 and getPlayerLevel(cid) >= level then
        stopEvent(event)
        doPlayerSendTextMessage(cid,21,"Mozesz rozmawiac z NPC Jack!")
        doTransformItem(item.uid,item.itemid-1)
        doCreateNpc("Jack", {x= 983, y= 1150, z=7})
end
return true
end
 
You have spare ( in line 8 and 16, Try this one, Not sure if this is the only issue script has.
Lua:
local level = 365
local seconds = 30
local event = 0

local function reset(leverPos)
        local lever = getTileItemById(leverPos, 1946).uid
    doTransformItem(lever, 1945)
    doRemoveCreature("Jack")
        doPlayerSendTextMessage(cid,21,"Musisz uzyc dzwignie, by stworzyc NPC Jack!")
end

function onUse(cid, item, fromPosition, itemEx, toPosition)


          if item.itemid == 1945 and getPlayerLevel(cid) >= level then
                doRemoveCreature("Jack")
                    doPlayerSendTextMessage(cid,21,"NPC USUNIETY!")
                event = addEvent(reset, seconds * 1000, getThingPos(item.uid))
        doTransformItem(item.uid,item.itemid+1)
    elseif item.itemid == 1946 and getPlayerLevel(cid) >= level then
        stopEvent(event)
        doPlayerSendTextMessage(cid,21,"Mozesz rozmawiac z NPC Jack!")
        doTransformItem(item.uid,item.itemid-1)
        doCreateNpc("Jack", {x= 983, y= 1150, z=7})
end
return true
end
If you are still having issues, Write more details about what you want the script to do and if you have any error on console.
 
You have spare ( in line 8 and 16, Try this one, Not sure if this is the only issue script has.
Lua:
local level = 365
local seconds = 30
local event = 0

local function reset(leverPos)
        local lever = getTileItemById(leverPos, 1946).uid
    doTransformItem(lever, 1945)
    doRemoveCreature("Jack")
        doPlayerSendTextMessage(cid,21,"Musisz uzyc dzwignie, by stworzyc NPC Jack!")
end

function onUse(cid, item, fromPosition, itemEx, toPosition)


          if item.itemid == 1945 and getPlayerLevel(cid) >= level then
                doRemoveCreature("Jack")
                    doPlayerSendTextMessage(cid,21,"NPC USUNIETY!")
                event = addEvent(reset, seconds * 1000, getThingPos(item.uid))
        doTransformItem(item.uid,item.itemid+1)
    elseif item.itemid == 1946 and getPlayerLevel(cid) >= level then
        stopEvent(event)
        doPlayerSendTextMessage(cid,21,"Mozesz rozmawiac z NPC Jack!")
        doTransformItem(item.uid,item.itemid-1)
        doCreateNpc("Jack", {x= 983, y= 1150, z=7})
end
return true
end
If you are still having issues, Write more details about what you want the script to do and if you have any error on console.
 

Attachments

Similar threads

Back
Top