• 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.2 experienceByKillingPlayers

addewe

New Member
Joined
Jan 14, 2015
Messages
25
Reaction score
2
experienceByKillingPlayers ineed learn how i make the higer level palyer can't exp take in lower than payer
but the lower player can take exp higher player
 
Make an onKill code and remove the experienceByKillingPlayers. Create your own code for it. Make it exactly how you want.
 
experienceByKillingPlayers ineed learn how i make the higer level palyer can't exp take in lower than payer
but the lower player can take exp higher player
Modify this and you can prevent player's getting xp
Lua:
function Player:onGainExperience(source, exp, rawExp)
    if not source or source:isPlayer() then
        return exp
    end

    -- Soul regeneration
    local vocation = self:getVocation()
    if self:getSoul() < vocation:getMaxSoul() and exp >= self:getLevel() then
        soulCondition:setParameter(CONDITION_PARAM_SOULTICKS, vocation:getSoulGainTicks() * 1000)
        self:addCondition(soulCondition)
    end

    -- Apply experience stage multiplier
    exp = exp * Game.getExperienceStage(self:getLevel())

    -- Stamina modifier
    if configManager.getBoolean(configKeys.STAMINA_SYSTEM) then
        useStamina(self)

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

    return exp
end
You can find this in data/events/scripts/player.lua
 
oh tfs 1.2 nice. I figured it would be a 0.3.6 or some crap like people always do...

anyway here is some help....

Lua:
if source and source:isPlayer() and source:getLevel() < self:getLevel() then
          if (self:getLevel() - source:getLevel()) >= 300 then
                 exp = 0
                 return exp
          end
end

If the player that kills the other player is +300 levels higher. They will not gain experience.
 
Screw it here

Lua:
local noExpLevelHigherThan = 300 --Set to how high before no exp for player killing another player

function Player:onGainExperience(source, exp, rawExp)
    if not source then
        return exp
    end

   --PvP too high level
   if source and source:isPlayer() and source:getLevel() < self:getLevel() then
         if (self:getLevel() - source:getLevel()) > noExpLevelHigherThan then
                exp = 0
                return exp
         end
    end

    -- Soul regeneration
    local vocation = self:getVocation()
    if self:getSoul() < vocation:getMaxSoul() and exp >= self:getLevel() then
        soulCondition:setParameter(CONDITION_PARAM_SOULTICKS, vocation:getSoulGainTicks() * 1000)
        self:addCondition(soulCondition)
    end

    -- Apply experience stage multiplier
    exp = exp * Game.getExperienceStage(self:getLevel())

    -- Stamina modifier
    if configManager.getBoolean(configKeys.STAMINA_SYSTEM) then
        useStamina(self)

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

    return exp
end
 
Back
Top