• 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 Block exp when kill same IP

Svira

Active Member
Joined
Jan 27, 2008
Messages
267
Solutions
11
Reaction score
36
Hello, I need a script that will prevent me from getting exp for killing players with the same ip.

TFS 1.2
 
Solution
Lua:
function Player:onGainExperience(source, exp, rawExp)

    if not source then
        return exp
    end

    if source:isPlayer() then
        return source:getIp() == self:getIp() and 0 or 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 =...
I didn't mean that ... I need a script that blocks killing my characters on multiclient for experience. The one you sent does not check Ip.

edit:
Lua Script Error: [Event Interface]
data/events/scripts/player.lua:player@onGainExperience
data/events/scripts/player.lua:280: attempt to call method 'getIp' (a nil value)



edit2:
ok no error in console but players still get exp for killing on MC.

my player lua
Code:
function Player:onGainExperience(source, exp, rawExp)

    if not source or source:isPlayer() then
    
        return exp
    end
    if source:getIp() == self:getIp() then
        return false
    end
 
Last edited:
Lua:
function Player:onGainExperience(source, exp, rawExp)
    if source and source:isPlayer() and source:getIp() == self:getIp() then
        return false
    end
   return exp
end
 
nope...

no erros but:
20:19 player gained 227974 experience points.

this no work too:
Code:
function Player:onGainExperience(source, exp, rawExp)
    if source and source:isPlayer() and source:getIp() == self:getIp() then
        return 0
    end
   return exp
end
Code:
function Player:onGainExperience(source, exp, rawExp)
    if source and source:isPlayer() and source:getIp() == self:getIp() then
        return exp = 0
    end
   return exp
end
 
Last edited:
Lua:
function Player:onGainExperience(source, exp, rawExp)

    if not source then
        return exp
    end

    if source:isPlayer() then
        return source:getIp() == self:getIp() and 0 or 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
 
Solution
added no error but:
00:16 Player gained 193629 experience points.
need restart engine or just /reload events ?


no matter I am a noob, I forgot to connect to the server before saving. works perfectly thank you!
 
Last edited:
Back
Top