• 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+ Talkaction !serverinfo

aqubjukr

Well-Known Member
Joined
Mar 13, 2013
Messages
200
Solutions
17
Reaction score
79
Location
Paraná, Brazil
I'm using a global server (tfs 1.3) and I would like to know if there is how to adapt the script to quote the current stage (ML and SKILL).

Example: If the player has a certain skill between 3 ~ 10 appears 2x and if between 11 ~ 30 appears 1x.


Serverinfo.lua:
PHP:
local serverInfo = TalkAction("!serverinfo")

function serverInfo.onSay(player, words, param)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "SERVER INFO:"
                    .. "\nExp rate: " .. Game.getExperienceStage(player:getLevel()) .. "x"
                    .. "\nSkill rate: " .. configManager.getNumber(configKeys.RATE_SKILL)
                    .. "\nMagic rate: " .. configManager.getNumber(configKeys.RATE_MAGIC)
                    .. "\nLoot rate: " .. configManager.getNumber(configKeys.RATE_LOOT).. "x"
--                    .. "\nSkill rate: Start 50x (Stages)"
--                    .. "\nMagic rate: Start 13x (Stages)"
                    .. "\nSpawn rate: " .. configManager.getNumber(configKeys.RATE_SPAWN).. "x"

)

    return false
end

serverInfo:separator(" ")
serverInfo:register()
 
Solution
data/talkactions/scripts/serverinfo.lua
Lua:
SkillsTable = {
  [0] = { --[[ SKILL_FIST ]]
    stage = {
      [{10, 30}] = 100,
      [{31, 50}] = 70,
      [{51, 70}] = 40,
      [{71, 90}] = 20,
      [{91, 110}] = 10,
      [{111, 300}] = 3
    },
    rate = configKeys.RATE_SKILL
  },
  [1] = { --[[ SKILL_CLUB ]]
    stage = {
      [{10, 30}] = 100,
      [{31, 50}] = 70,
      [{51, 70}] = 40,
      [{71, 90}] = 20,
      [{91, 110}] = 10,
      [{111, 300}] = 3
    },
    rate = configKeys.RATE_SKILL
  },
  [2] = { --[[ SKILL_SWORD ]]
    stage = {
      [{10, 30}] = 100,
      [{31, 50}] = 70,
      [{51, 70}] = 40,
      [{71, 90}] = 20,
      [{91, 110}] = 10,
      [{111, 300}] = 3
    },
    rate = configKeys.RATE_SKILL...
Players.lua:
Lua:
SkillsTable = {
  [0] = { --[[ SKILL_FIST ]]
    stage = {
      [{10, 30}] = 100,
      [{31, 50}] = 70,
      [{51, 70}] = 40,
      [{71, 90}] = 20,
      [{91, 110}] = 10,
      [{111, 300}] = 3
    },
    rate = configKeys.RATE_SKILL
  },
  [1] = { --[[ SKILL_CLUB ]]
    stage = {
      [{10, 30}] = 100,
      [{31, 50}] = 70,
      [{51, 70}] = 40,
      [{71, 90}] = 20,
      [{91, 110}] = 10,
      [{111, 300}] = 3
    },
    rate = configKeys.RATE_SKILL
  },
  [2] = { --[[ SKILL_SWORD ]]
    stage = {
      [{10, 30}] = 100,
      [{31, 50}] = 70,
      [{51, 70}] = 40,
      [{71, 90}] = 20,
      [{91, 110}] = 10,
      [{111, 300}] = 3
    },
    rate = configKeys.RATE_SKILL
  },
  [3] = { --[[ SKILL_AXE ]]
    stage = {
      [{10, 30}] = 100,
      [{31, 50}] = 70,
      [{51, 70}] = 40,
      [{71, 90}] = 20,
      [{91, 110}] = 10,
      [{111, 300}] = 3
    },
    rate = configKeys.RATE_SKILL
  },
  [4] = { --[[ SKILL_DISTANCE ]]
    stage = {
      [{10, 30}] = 100,
      [{31, 50}] = 70,
      [{51, 70}] = 40,
      [{71, 90}] = 18,
      [{91, 110}] = 8,
      [{111, 300}] = 2
    },
    rate = configKeys.RATE_SKILL
  },
  [5] = { --[[ SKILL_SHIELD ]]
    stage = {
      [{10, 30}] = 100,
      [{31, 50}] = 70,
      [{51, 70}] = 40,
      [{71, 90}] = 20,
      [{91, 110}] = 10,
      [{111, 300}] = 3
    },
    rate = configKeys.RATE_SKILL
  },
  [6] = { --[[ SKILL_FISHING ]]
    stage = {
      [{10, 30}] = 100,
      [{31, 50}] = 70,
      [{51, 70}] = 40,
      [{71, 90}] = 20,
      [{91, 110}] = 10,
      [{111, 300}] = 3
    },
    rate = configKeys.RATE_SKILL
  },
  [7] = { --[[ SKILL_MAGLEVEL ]]
    stage = {
      [{10, 30}] = 100,
      [{31, 50}] = 70,
      [{51, 70}] = 40,
      [{71, 90}] = 20,
      [{91, 110}] = 5,
      [{111, 300}] = 1
    },
    rate = configKeys.RATE_MAGIC
  }
}

function getSkillsRate(level, skill)
  local skillRange = SkillsTable[skill]
  if next(skillRange.stage) then
    for sLevel, multiplier in pairs(skillRange.stage) do
      if level >= sLevel[1] and level <= sLevel[2] then
        return multiplier
      end
    end
  end
  return 1
end

function Player:onGainSkillTries(skill, tries)
    if APPLY_SKILL_MULTIPLIER == false then
    return tries
  end
  local skills = SkillsTable[skill]
  if next(skills) and skills.rate then
    local rate = configManager.getNumber(skills.rate)
    if rate > 0 then
      return tries * rate
    else
      return tries * getSkillsRate(self:getEffectiveSkillLevel(skill), skill)
    end
  end
end
 
Last edited by a moderator:
data/talkactions/scripts/serverinfo.lua
Lua:
SkillsTable = {
  [0] = { --[[ SKILL_FIST ]]
    stage = {
      [{10, 30}] = 100,
      [{31, 50}] = 70,
      [{51, 70}] = 40,
      [{71, 90}] = 20,
      [{91, 110}] = 10,
      [{111, 300}] = 3
    },
    rate = configKeys.RATE_SKILL
  },
  [1] = { --[[ SKILL_CLUB ]]
    stage = {
      [{10, 30}] = 100,
      [{31, 50}] = 70,
      [{51, 70}] = 40,
      [{71, 90}] = 20,
      [{91, 110}] = 10,
      [{111, 300}] = 3
    },
    rate = configKeys.RATE_SKILL
  },
  [2] = { --[[ SKILL_SWORD ]]
    stage = {
      [{10, 30}] = 100,
      [{31, 50}] = 70,
      [{51, 70}] = 40,
      [{71, 90}] = 20,
      [{91, 110}] = 10,
      [{111, 300}] = 3
    },
    rate = configKeys.RATE_SKILL
  },
  [3] = { --[[ SKILL_AXE ]]
    stage = {
      [{10, 30}] = 100,
      [{31, 50}] = 70,
      [{51, 70}] = 40,
      [{71, 90}] = 20,
      [{91, 110}] = 10,
      [{111, 300}] = 3
    },
    rate = configKeys.RATE_SKILL
  },
  [4] = { --[[ SKILL_DISTANCE ]]
    stage = {
      [{10, 30}] = 100,
      [{31, 50}] = 70,
      [{51, 70}] = 40,
      [{71, 90}] = 18,
      [{91, 110}] = 8,
      [{111, 300}] = 2
    },
    rate = configKeys.RATE_SKILL
  },
  [5] = { --[[ SKILL_SHIELD ]]
    stage = {
      [{10, 30}] = 100,
      [{31, 50}] = 70,
      [{51, 70}] = 40,
      [{71, 90}] = 20,
      [{91, 110}] = 10,
      [{111, 300}] = 3
    },
    rate = configKeys.RATE_SKILL
  },
  [6] = { --[[ SKILL_FISHING ]]
    stage = {
      [{10, 30}] = 100,
      [{31, 50}] = 70,
      [{51, 70}] = 40,
      [{71, 90}] = 20,
      [{91, 110}] = 10,
      [{111, 300}] = 3
    },
    rate = configKeys.RATE_SKILL
  },
  [7] = { --[[ SKILL_MAGLEVEL ]]
    stage = {
      [{10, 30}] = 100,
      [{31, 50}] = 70,
      [{51, 70}] = 40,
      [{71, 90}] = 20,
      [{91, 110}] = 5,
      [{111, 300}] = 1
    },
    rate = configKeys.RATE_MAGIC
  }
}


function onSay(player, words, param)
function getSkillsRate(level, skill)
  local skillRange = SkillsTable[skill]
  if next(skillRange.stage) then
    for sLevel, multiplier in pairs(skillRange.stage) do
      if level >= sLevel[1] and level <= sLevel[2] then
        return multiplier
      end
    end
  end
  return 1
end
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Server Info:"
                    .. "\nExp rate: " .. Game.getExperienceStage(player:getLevel())
                    .. "\nFist fighting rate: " .. getSkillsRate(self:getEffectiveSkillLevel(0), skill)
                    .. "\nClub fighting rate: " .. getSkillsRate(self:getEffectiveSkillLevel(1), skill)
                    .. "\nSword fighting rate: " .. getSkillsRate(self:getEffectiveSkillLevel(2), skill)
                    .. "\nAxe fighting rate: " .. getSkillsRate(self:getEffectiveSkillLevel(3), skill)
                    .. "\nDistance fighting rate: " .. getSkillsRate(self:getEffectiveSkillLevel(4), skill)
                    .. "\nShielding rate: " .. getSkillsRate(self:getEffectiveSkillLevel(5), skill)
                    .. "\nFishing rate: " .. getSkillsRate(self:getEffectiveSkillLevel(6), skill)
                    .. "\nMagic rate: " .. getSkillsRate(self:getEffectiveSkillLevel(7), skill)
                    .. "\nLoot rate: " .. configManager.getNumber(configKeys.RATE_LOOT))
    return false
end
Im thinking maybe something like this 🧐

and add in data/talkactions/talkactions.xml
XML:
<talkaction words="!serverinfo" script="serverinfo.lua" />

and remove the current code
 
Solution
Back
Top