Hello, I have a problem because I do not know how to properly write a if function. I can not imagine that, so I am asking for help. To the point.
I have 3 quests that you can perform only one person at a time and after logging out, teleport to the temple. I added the OnLogout function:
At the entrance to the quest, I set the variable in the first, second and third quest: quest_executed1 = 1, quest_executed2 = 1, quest_executed3 = 1.
After finishing the quest, I change the variable back to 0. I want the system to change the variable to 0 after logging out.
The function works if I have one quest.
However, I need to do so with 3 quests.
I do not know this well, I explained it, but if someone understands me, please help me.
I have 3 quests that you can perform only one person at a time and after logging out, teleport to the temple. I added the OnLogout function:
Code:
function onLogout(player)
-- Did a player logout?
if player:isPlayer() then
-- Has the quest started?
if quest_executed1 == 1 then
player:teleportTo(player:getTown():getTemplePosition())
quest_executed1 = 0
elseif quest_executed2 == 1 then
player:teleportTo(player:getTown():getTemplePosition())
quest_executed2 = 0
elseif quest_executed3 == 1 then
player:teleportTo(player:getTown():getTemplePosition())
quest_executed3 = 0
else
return true
end
end
return true
end
At the entrance to the quest, I set the variable in the first, second and third quest: quest_executed1 = 1, quest_executed2 = 1, quest_executed3 = 1.
After finishing the quest, I change the variable back to 0. I want the system to change the variable to 0 after logging out.
The function works if I have one quest.
Code:
if quest_executed1 == 1 then
player:teleportTo(player:getTown():getTemplePosition())
quest_executed1 = 0
end
However, I need to do so with 3 quests.
I do not know this well, I explained it, but if someone understands me, please help me.