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

TFS 1.X+ [TFS 1.3] Player die after server save

roriscrave

Advanced OT User
Joined
Dec 7, 2011
Messages
1,210
Solutions
35
Reaction score
206
How can I make the player not die for 20 seconds when server start up?
Some players die when login at server save.
 
Last edited:
data/creaturescripts/login.lua

add
Code:
player:setStorageValue(15671, os.time() + 10)

data/events/scripts/creature.lua

change
Code:
function Creature:onTargetCombat(target)
    return RETURNVALUE_NOERROR
end

to

Code:
function Creature:onTargetCombat(target)
    if self:isMonster() and target:isPlayer() and target:getStorageValue(15671) > os.time() then
        return false
    end
   
    if self:isPlayer() and self:getStorageValue(15671) > os.time() then
        return false
    end
   
    return RETURNVALUE_NOERROR
end

in events.lua

Code:
<event class="Creature" method="onTargetCombat" enabled="1" />
 
Thanks for trying to help, but it doesn't work as I wanted.
I wanted the player to be protected from dying only when the server opens, not every time he login
 
wups super tired... in login.lua

Code:
local serverSaveTime = {hour = 12, minute = 00} -- Hour and minute of server save time hours in 24 hour clock time
    local minutes = {minute + 6, minute + 7}
    if os.time(%H) == serverSaveTime.hour and isInArray(minutes, os.time(%M)) then
        player:setStorageValue(15671, os.time() + 10)
    end
 
wups super tired... in login.lua

Code:
local serverSaveTime = {hour = 12, minute = 00} -- Hour and minute of server save time hours in 24 hour clock time
    local minutes = {minute + 6, minute + 7}
    if os.time(%H) == serverSaveTime.hour and isInArray(minutes, os.time(%M)) then
        player:setStorageValue(15671, os.time() + 10)
    end
Ill try later and back with result, thx for help man!
 

Similar threads

Replies
2
Views
242
Back
Top