• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Storage Problem urgent

Bloody-War

New Member
Joined
Feb 9, 2016
Messages
88
Reaction score
1
Hello i have problem with this script the problem is when the script put you the storage and you die or you logut your storage didnt reset..

i wanna do when you die or you logut your char comes normal like you dint got the storage

help me fix please

Code:
function onCombat(cid, target)
if isPlayer(target) and getCreatureStorage(cid, 8825) ~= -1 and getCreatureStorage(target, 8826) ~= -1 then
return false
end
return true
end
 
TFS 0.3.6: data/creaturescripts/scripts/login.lua
above:
Code:
return true
end
add:
Code:
if getCreatureStorage(cid, 8825) ~= -1 then
doCreatureSetStorage(cid, 8825, -1)
print('8825: '..getCreatureStorage(cid, 8825))
end

It means that even
Code:
if getCreatureStorage(target, 8826) ~= -1
then after login your storage is -1 so script doesn't work, becasue to work both storages must be 0 or higher. Remember that storages are like: -1 + 1 = 0 (zero means that the sotrage exists with a zero value).
 
Last edited:
TFS 0.3.6: data/creaturescripts/scripts/login.lua
above:
Code:
return true
end
add:
Code:
if getCreatureStorage(cid, 8825) ~= -1 and getCreatureStorage(cid, 8826) ~= -1 then
doCreatureSetStorage(cid, 8825, -1)
doCreatureSetStorage(cid, 8826, -1)
print('8825: '..getCreatureStorage(cid, 882)..'8826: '..getCreatureStorage(cid, 8826))
end

in login.lua?
 
Please read the post carefully, you will see: "data/creaturescripts/scripts/login.lua". And I've edited the post. Use the new version of my script.
Code:
if getCreatureStorage(cid, 8825) ~= -1 then
doCreatureSetStorage(cid, 8825, -1)
print('8825: '..getCreatureStorage(cid, 8825))
end

/edit Does it work?
 
Last edited:
Please read the post carefully, you will see: "data/creaturescripts/scripts/login.lua". And I've edited the post. Use the new version of my script.
Code:
if getCreatureStorage(cid, 8825) ~= -1 then
doCreatureSetStorage(cid, 8825, -1)
print('8825: '..getCreatureStorage(cid, 8825))
end

/edit Does it work?

Dosent work :(
 
Back
Top