nanduzenho
Member
Good morning, i have this script that gives access to djins green and blue. However, the player can use both, but I wanted him to use only one. For example, if he already has Green, he won't be able to use Blue. Could someone help me?
Lua:
local config = {
[13275] = 13, --Blue Djinn scroll
[13276] = 14, --Green Djinn scroll
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local scroll = config[item.itemid]
if not scroll then
return true
end
if scroll == 13 then
--Blue Djinn scroll
--Marid Faction (Blue Djinn)
player:setStorageValue(Storage.DjinnWar.MaridFaction.Mission01, 2)
player:setStorageValue(Storage.DjinnWar.MaridFaction.Mission02, 2)
player:setStorageValue(Storage.DjinnWar.MaridFaction.Mission03, 3)
player:setStorageValue(Storage.DjinnWar.MaridFaction.DoorToEfreetTerritory, 1)
player:setStorageValue(Storage.OrcKingGreeting, 1)
player:setStorageValue(Storage.DjinnWar.MaridFaction.DoorToLamp, 1)
player:setStorageValue(Storage.DjinnWar.ReceivedLamp, 1)
player:addAchievement('Marid Ally')
player:addItem(2146, 3)
player:addItem(2356, 1)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The Gods blessed you.. now you are one Marid Ally.")
end
if scroll == 14 then
--Green Djinn scroll
--Efreet Faction (Green Djinn)
player:setStorageValue(Storage.DjinnWar.Faction.Efreet, 1)
player:setStorageValue(Storage.DjinnWar.Faction.Greeting, 0)
player:setStorageValue(Storage.DjinnWar.EfreetFaction.Start, 1)
player:setStorageValue(Storage.DjinnWar.EfreetFaction.Mission01, 3)
player:setStorageValue(Storage.DjinnWar.EfreetFaction.Mission02, 3)
player:setStorageValue(Storage.DjinnWar.EfreetFaction.Mission03, 3)
player:setStorageValue(Storage.DjinnWar.EfreetFaction.DoorToMaridTerritory, 1)
player:addAchievement('Efreet Ally')
player:setStorageValue(Storage.DjinnWar.EfreetFaction.DoorToLamp, 1)
player:setStorageValue(Storage.DjinnWar.ReceivedLamp, 1)
player:addItem(2356, 1)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The Gods blessed you.. now you are one Efreet Ally.")
end
Item(item.uid):remove(1)
return true
end