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

Lua Check Exp stage

viking

Member
Joined
Aug 20, 2015
Messages
323
Reaction score
22
I have one script to check "days" of double exp, but I need to check "minutes/seconds" too, anyone can help me?

Script:
Code:
function onSay(cid, words, param)
if(words == "!exp") then
local timenow = os.time()
local quantity = math.floor((getPlayerStorageValue(cid, 1234) - timenow)/(24 * 60 * 60))
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have ".. (quantity < 0 and 0 or quantity) .." days of Double Exp on your Character.")

end

return TRUE
end

And how to check double exp on !serverinfo ?
serverinfo.lua:
Code:
function onSay(player, words, param)
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Server Info:"
                    .. "\nExp rate: " .. Game.getExperienceStage(player:getLevel())
                    .. "\nSkill rate: " .. configManager.getNumber(configKeys.RATE_SKILL)
                    .. "\nMagic rate: " .. configManager.getNumber(configKeys.RATE_MAGIC)
                    .. "\nLoot rate: " .. configManager.getNumber(configKeys.RATE_LOOT))
    return false
end
 
Code:
function getPlayerVipDays(cid)
  local left, d, h, m, s = (getPlayerStorageValue(cid, 1234) - os.time()), 0, 0, 0, 0
  while left > 1 do
  if left >= 86400 then
  left = left - 86400
  d = d+1
  end
  if left < 86400 and left > 3600 then
  h = h+1
  left = left - 3600
  end
  if left < 3600 and left > 60  then
  m = m+1
  left = left - 60
  end   
  if left < 60 then
  s = left
  break
  end
  end
  return d , h, m, s
end
function onSay(cid, words, param)
if(words == "!exp") then
local d, h, m, s = getPlayerVipDays(cid)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have ".. d .." days , ".. h .." hours, ".. m .." minutes and ".. s .." seconds of Double Exp on your Character.")
end
return true
end
 
Last edited:
Thanks for your help !!

I got this error: (tfs 1.2)
XIZbwV2.png
 
Back
Top