function onLogin(player)
local outfitList = {
136, 137, 138, 139, 140, 141, 142, 147, 148, 149, 150, 155, 156, 157, 158, 252, 269, 270, 279, 288, 324, 329,
336, 366, 431, 433, 464, 466, 471, 513, 514, 542, 575, 578, 618, 620, 632, 635, 636, 664, 666, 683, 694, 696,
698, 724, 732, 745, 749, 759, 845, 852, 874, 885, 900, 909, 929, 956, 958, 963, 965, 967, 969, 971, 973, 975,
128, 129, 130, 131, 132, 133, 134, 143, 144, 145, 146, 151, 152, 153, 154, 251, 268, 273, 278, 289, 325, 328,
335, 367, 430, 432, 463, 465, 472, 512, 516, 541, 574, 577, 610, 619, 633, 634, 637, 665, 667, 684, 695, 699,
725, 733, 746, 750, 760, 846, 853, 873, 884, 899, 908, 931, 955, 957, 962, 964, 966, 968, 970, 972, 974
}
local storageSeed = 40000
local is_premium = player:isPremium()
for i = 1, #outfitList do
-- We don't have a -1 -> 3 getOutFit function?
local has_outfit = player:hasOutfit(outfitList[i], 0)
local has_addon1 = nil
local has_addon2 = nil
-- -1 = no outfit, 0 = has outfit, 1 = outfit with first addon, 2 = outfit with 2nd addon, 3 = outfit with both addons
local outfit_value = -1
-- Calculate user addons (without checking storage copy)
if has_outfit then
outfit_value = 0
has_addon1 = player:hasOutfit(outfitList[i], 1)
has_addon2 = player:hasOutfit(outfitList[i], 2)
if has_addon1 then
outfit_value = outfit_value + 1
end
if has_addon2 then
outfit_value = outfit_value + 2
end
end
-- If you are free account
if not is_premium then
-- If you have an addon
if outfit_value > 0 then
-- Store it before you remove it
player:setStorageValue(storageSeed + outfitList[i],outfit_value)
-- Remove it
if has_addon1 then player:removeOutfitAddon(outfitList[i], 1) end
if has_addon2 then player:removeOutfitAddon(outfitList[i], 2) end
end
else -- You are premium account
-- Get stored outfit addons
local storage_outfit_value = player:getStorageValue(storageSeed + outfitList[i])
-- Perhaps you have an addon from storage that we need to add?
if outfit_value ~= storage_outfit_value then
if storage_outfit_value > 0 then
-- If you have 2nd addon, add it
if storage_outfit_value > 1 then
player:addOutfitAddon(outfitList[i], 2)
-- If you also have 1st addon, add it
if storage_outfit_value > 2 then
player:addOutfitAddon(outfitList[i], 1)
end
else -- You just have first addon
player:addOutfitAddon(outfitList[i], 1)
end
end
end
end
end
return true
end