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

Add/Remove/Get/Reset frags

LucasFerraz

Systems Analyst
Joined
Jun 10, 2010
Messages
2,858
Reaction score
96
Location
Brazil
I didn't made this function, you can find author and post here.
All credits to CyberM.
Lua:
local FRAG_STORAGE = 6776
 
frag = {
    add = function(cid, amount)
        return doCreatureSetStorage(cid, FRAG_STORAGE, math.max(amount,getCreatureStorage(cid,FRAG_STORAGE)+amount))
    end,
 
    get = function(cid)
        return math.max(0,getCreatureStorage(cid,FRAG_STORAGE))
    end,
 
    remove = function(cid, amount)
        return getCreatureStorage(cid,FRAG_STORAGE) < amount and false or doCreatureSetStorage(cid,getCreatureStorage(cid,FRAG_STORAGE)-amount)
    end,

    reset = function(cid)
        return doCreatureSetStorage(cid, FRAG_STORAGE, -1)
    end
}

How to use?^_^
Lua:
frag.add(cid, amount)
frag.get(cid)
frag.remove(cid, amount)
frag.reset(cid)
Adjust frag storage to your storage (create a storage to frag)
Lua:
local FRAG_STORAGE = 6776

Remember, it will get this storage(6776) as example. Not the kills, perfect to Hardcore/War Servers
 
Last edited:
I was expecting database manipulation

remove , -1 to make TFS erase the key from db
 
this should use database manipulation rather than a storage counter. Otherwise it's useless implementing to a server that has already been online etc + it would make it actually useful lol. But thanks for your contribution none the less! <3
 
Back
Top