• 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+ Set item move cooldown

Tbol

Well-Known Member
Joined
Apr 7, 2019
Messages
592
Reaction score
64
How can i set cooldown on item pick from the ground,corpse? Tried editing in config.lua timeBetweenActions, timeBetweenExActions but this seems to affect stuff like opening container and similar stuff
 
Solution
player.lua

LUA:
local pickupCooldown = 0.5 -- Cooldown in seconds (0.5 seconds)
local storageKey = 1234
Inside function Player:onMoveItem(item, count, fromPosition, toPosition, fromCylinder, toCylinder)
LUA:
   local lastPickupTime = self:getStorageValue(storageKey)
    local currentTime = os.time()

    if lastPickupTime > 0 and currentTime - lastPickupTime < pickupCooldown then
        self:sendCancelMessage("Your cancel text.")
        return false
    end

    self:setStorageValue(storageKey, currentTime)
You propably need to write your own script for that
Uch okay so gonna use action script i just thought maybe there is something already made in src that i dont know and cooldown i set to zero, but okay thanks
 
player.lua

LUA:
local pickupCooldown = 0.5 -- Cooldown in seconds (0.5 seconds)
local storageKey = 1234
Inside function Player:onMoveItem(item, count, fromPosition, toPosition, fromCylinder, toCylinder)
LUA:
   local lastPickupTime = self:getStorageValue(storageKey)
    local currentTime = os.time()

    if lastPickupTime > 0 and currentTime - lastPickupTime < pickupCooldown then
        self:sendCancelMessage("Your cancel text.")
        return false
    end

    self:setStorageValue(storageKey, currentTime)
 
Solution
Back
Top