Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
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!
I'm trying to make a script that if the player has the outfit X wins the achievement Y
the problem I want to do this for all outfits
LUA:
if player:hasOutfit(929, 2) and player:hasOutfit(931, 2) then
player:addAchievement('Reason to Celebrate')
how could I do this to make several else =c
Solution
X
Xikini
Something like this should work
LUA:
local achievementCheck = {
{requiredOutfits = {{929, 2}, {931, 2}}, rewardAchievement = "Reason to Celebrate"}
}
for i = 1, #achievementCheck do
if not player:hasAchievement(achievementCheck[i].rewardAchievement) then
local giveAchievement = true
for n = 1, #achievementCheck[i].requiredOutfits do
if not player:hasOutfit(achievementCheck[i].requiredOutfits[n][1], achievementCheck[i].requiredOutfits[n][2]) then
giveAchievement = false
break
end
end
if giveAchievement then
player:addAchievement(achievementCheck[i].rewardAchievement)
end
end
end
local achievementCheck = {
{requiredOutfits = {{929, 2}, {931, 2}}, rewardAchievement = "Reason to Celebrate"}
}
for i = 1, #achievementCheck do
if not player:hasAchievement(achievementCheck[i].rewardAchievement) then
local giveAchievement = true
for n = 1, #achievementCheck[i].requiredOutfits do
if not player:hasOutfit(achievementCheck[i].requiredOutfits[n][1], achievementCheck[i].requiredOutfits[n][2]) then
giveAchievement = false
break
end
end
if giveAchievement then
player:addAchievement(achievementCheck[i].rewardAchievement)
end
end
end
local achievementCheck = {
{requiredOutfits = {{929, 2}, {931, 2}}, rewardAchievement = "Reason to Celebrate"}
}
for i = 1, #achievementCheck do
if not player:hasAchievement(achievementCheck[i].rewardAchievement) then
local giveAchievement = true
for n = 1, #achievementCheck[i].requiredOutfits do
if not player:hasOutfit(achievementCheck[i].requiredOutfits[n][1], achievementCheck[i].requiredOutfits[n][2]) then
giveAchievement = false
break
end
end
if giveAchievement then
player:addAchievement(achievementCheck[i].rewardAchievement)
end
end
end
local scriptonetest = CreatureEvent("scriptonetest")
local achievementCheck = {
{requiredOutfits = {{324, 3}, {325, 3}}, rewardAchievement = "Yalahari of Wisdom"},
{requiredOutfits = {{431, 3}, {430, 3}}, rewardAchievement = "Beak Doctor"}
}
function scriptonetest.onLogin(player)
print('scriptonetest')
for i = 1, #achievementCheck do
if not player:hasAchievement(achievementCheck[i].rewardAchievement) then
local giveAchievement = true
for n = 1, #achievementCheck[i].requiredOutfits do
if not player:hasOutfit(achievementCheck[i].requiredOutfits[n][1], achievementCheck[i].requiredOutfits[n][2]) then
giveAchievement = false
break
end
end
if giveAchievement then
player:addAchievement(achievementCheck[i].rewardAchievement)
end
end
end
return true
end
scriptonetest:register()
I tested it with adm and it worked now with the player no it logs in the log appears the 'print' but it doesn't work
local scriptonetest = CreatureEvent("scriptonetest")
local achievementCheck = {
{requiredOutfits = {{324, 3}, {325, 3}}, rewardAchievement = "Yalahari of Wisdom"},
{requiredOutfits = {{431, 3}, {430, 3}}, rewardAchievement = "Beak Doctor"}
}
function scriptonetest.onLogin(player)
print('scriptonetest')
for i = 1, #achievementCheck do
if not player:hasAchievement(achievementCheck[i].rewardAchievement) then
local giveAchievement = true
for n = 1, #achievementCheck[i].requiredOutfits do
if not player:hasOutfit(achievementCheck[i].requiredOutfits[n][1], achievementCheck[i].requiredOutfits[n][2]) then
giveAchievement = false
break
end
end
if giveAchievement then
player:addAchievement(achievementCheck[i].rewardAchievement)
end
end
end
return true
end
scriptonetest:register()
I tested it with adm and it worked now with the player no it logs in the log appears the 'print' but it doesn't work