Skip to content

Commit

Permalink
#fix error storage key is nil
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoTKBR authored Nov 8, 2024
1 parent e6c0995 commit 295f2ae
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions data-otservbr-global/scripts/creaturescripts/customs/freequests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -392,25 +392,24 @@ local questTable = {
-- from Position: (33201, 31762, 1)
-- to Position: (33356, 31309, 4)
local function playerFreeQuestStart(playerId, index)
local player = Player(playerId)
if not player then
return
end

for i = 1, 5 do
index = index + 1
if not questTable[index] then
player:sendTextMessage(MESSAGE_LOOK, "Adding free quests completed.")
player:setStorageValue(Storage.FreeQuests, stage)
return
end
local player = Player(playerId)
if not player then
return
end

if player:getStorageValue(questTable[index].storage) ~= questTable[index].storageValue then
player:setStorageValue(questTable[index].storage, questTable[index].storageValue)
end
end
for i = 1, 5 do
index = index + 1
if not questTable[index] then
player:sendTextMessage(MESSAGE_LOOK, "Adding free quests completed.")
player:setStorageValue(Storage.FreeQuests, stage)
return
end

addEvent(playerFreeQuestStart, 500, playerId, index)
if questTable[index].storage and player:getStorageValue(questTable[index].storage) ~= questTable[index].storageValue then
player:setStorageValue(questTable[index].storage, questTable[index].storageValue)
end
end
addEvent(playerFreeQuestStart, 500, playerId, index)
end

local freeQuests = CreatureEvent("FreeQuests")
Expand Down

0 comments on commit 295f2ae

Please sign in to comment.