Hello I am making a script to give a mount to the first 100 players that enter my server. The mount part is ready, but how can I end the event? Think of a globalstorage that adds up to 100 and when it is greater than or equal to 100 the script would stop working. It works in fact, but in the serversave the globalstorage is restarted xd and I don't know any other way to do it. Script I did.
Thanks in advance
Thanks in advance
Lua:
function onLogin(cid)
local player = Player(cid)
local giveawaymounts = {
174, 170, 117, 169, 156
}
if Game.getStorageValue(GIVEAWAY) < 100 then
if player:getStorageValue(WINNER_GA) < 1 then
player:addMount(giveawaymounts[math.random(#giveawaymounts)])
player:setStorageValue(WINNER_GA, 1)
Game.setStorageValue(GIVEAWAY, Game.getStorageValue(GIVEAWAY) + 1)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Congratulations! You have been one of the first 100 players to enter and have won a mount.")
end
end
return true
end