• 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!

Solved [TFS 1.0] Save Online Players

sircurse

Curseria RTG - TFS 1.1
Joined
Nov 12, 2007
Messages
107
Reaction score
2
Location
Brazil
Twitch
curseofcourse
Hello,

I ve searching for some days a script that would works on TFS 1.0, but looks like the ones that I found is to old version.

I m trying to avoid server saver, and use players save, in that case I can have more times between the server save.

Anyway... this is the most close script that I found and may work, but I have issue with the line 5 "Player(players):save()"

Code:
function onThink(interval)
  local players = Game.getPlayers()
  for i = 0, #players do
    Player(players[i]):save()
  end
end

As I have few players at moment, I can use this code to save players more often.

Does anyone have a similar code for TFS 1.0?

Curse.
 
Well this script worked to me, hope can help others too:

Code:
function onThink(interval)
local players = Game.getPlayers()
    for k, tmpPlayer in ipairs(players) do
        playerID = getPlayerByName(tmpPlayer:getName())
        Player(playerID):save()
    end
    return false
end
 
Code:
function onThink(interval)
    local players = Game.getPlayers()
    if #players == 0 then
        return true
    end

    local player
    for i = 1, #players do
        player = players[i]
        player:save()
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Your character has been saved.")
    end

    return true
end
 
Back
Top