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

RevScripts [TFS 1.5] --

SaadPro

Member
Joined
Dec 25, 2022
Messages
37
Reaction score
18
Location
Egypt
Lua Script Error: [Event Interface]
data/events/scripts/player.lua:player@onGainExperience
data/events/scripts/player.lua:306: attempt to perform arithmetic on a nil value
stack traceback:
[C]: in function '__sub'
data/events/scripts/player.lua:306: in function 'useStamina'
data/events/scripts/player.lua:342: in function <data/events/scripts/player.lua:325>

Lua:
Line: 306
local timePassed = currentTime - nextUseStaminaTime[playerId]
All script
Code:
    local playerId = player:getId()
    local currentTime = os.time()
    local timePassed = currentTime - nextUseStaminaTime[playerId]
    if timePassed <= 0 then
        return
    end

Line 342
Code:
    useStamina(self)
All script
Lua:
if configManager.getBoolean(configKeys.STAMINA_SYSTEM) then
    useStamina(self)

    local staminaMinutes = self:getStamina()
    if staminaMinutes > 840 and staminaMinutes <= 2400 and self:isPremium() then
        exp = exp * 1.5
    elseif staminaMinutes <= 840 then
        exp = exp * 0.5
    end
end

Any one help me?
 
Solution
Lua:
local playerId = player:getId()
local currentTime = os.time()

if nextUseStaminaTime[playerId] == nil then
    nextUseStaminaTime[playerId] = currentTime
end

local timePassed = currentTime - nextUseStaminaTime[playerId]

if timePassed <= 0 then
    return
end
Lua:
local playerId = player:getId()
local currentTime = os.time()

if nextUseStaminaTime[playerId] == nil then
    nextUseStaminaTime[playerId] = currentTime
end

local timePassed = currentTime - nextUseStaminaTime[playerId]

if timePassed <= 0 then
    return
end
 
Solution
Lua:
local playerId = player:getId()
local currentTime = os.time()

if nextUseStaminaTime[playerId] == nil then
    nextUseStaminaTime[playerId] = currentTime
end

local timePassed = currentTime - nextUseStaminaTime[playerId]

if timePassed <= 0 then
    return
end
When i added your code now this problem
Lua Script Error: [Event Interface]
data/events/scripts/player.lua:player@onGainExperience
data/events/scripts/player.lua:360: attempt to call method 'isPremium' (a nil value)
stack traceback:
[C]: in function 'isPremium'
data/events/scripts/player.lua:360: in function <data/events/scripts/player.lua:331>
line: 360
Code:
    if self:isPremium() then
All script
Code:
    local xpPremium = 0
    if self:isPremium() then
        xpPremium = exp * 0.2 -- +20% XP
    end
Post automatically merged:

Lua:
local playerId = player:getId()
local currentTime = os.time()

if nextUseStaminaTime[playerId] == nil then
    nextUseStaminaTime[playerId] = currentTime
end

local timePassed = currentTime - nextUseStaminaTime[playerId]

if timePassed <= 0 then
    return
end
Thank you, solved
 
Last edited:
Stan Marsh Ai GIF by South Park
 
Back
Top