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

Set player storage on death

Joined
Mar 14, 2020
Messages
139
Solutions
3
Reaction score
11
How can i set a storage when player die? I'm trying to put that on death.lua and login.lua, but if the player die, then alt+f4 the game the storage ins't setted. Any tips?
 
Solution
Lua:
local storage = 85987 -- Storage here
function onPrepareDeath(creature, killer)
    creature:setStorageValue(storage, creature:getStorageValue(storage) + 1) -- + or -
    return true
end

or you put this in playerdeath.lua

Lua:
 player:setStorageValue(STORAGE HERE, player:getStorageValue(STORAGE HERE) + 1)

M0ustafa

1337
Senator
Joined
Mar 4, 2017
Messages
2,560
Solutions
315
Reaction score
1,132
Location
Egypt
You can try something like this
Lua:
function onPrepareDeath(creature, killer)
    player:setStorageValue(110000, -1)
    return true
end
XML:
 <event type="preparedeath" name="anyname" script="scriptname.lua" />
 

Levi999x

AoT
Joined
Dec 14, 2017
Messages
1,743
Solutions
34
Reaction score
957
Location
Germany
Lua:
local storage = 85987 -- Storage here
function onPrepareDeath(creature, killer)
    creature:setStorageValue(storage, creature:getStorageValue(storage) + 1) -- + or -
    return true
end

or you put this in playerdeath.lua

Lua:
 player:setStorageValue(STORAGE HERE, player:getStorageValue(STORAGE HERE) + 1)
 
Solution

Ascuas Funkeln

Rakkedo Game
Joined
Apr 14, 2013
Messages
515
Solutions
30
Reaction score
267
Location
Poland
GitHub
AscuasFunkeln
login.lua
player:registerEvent("DeathStorage")
creaturescripts.xml
<event type="death" name="DeathStorage" script="DeathStorage.lua" />
DeathStorage.lua
Lua:
function onDeath(player, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
player:setStorageValue(110000, -1)
return
end
 
Top