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

Experience by killing players TFS 1.0

mips90

New Member
Joined
Feb 24, 2011
Messages
10
Reaction score
0
Could anyone explain me how does this option work in TFS 1.0?
In config I have only:
experienceByKillingPlayers = "yes"
expFromPlayersLevelRange = 50
and there's no way to change exp rate (exp from players).
I suppose it uses exp stages like ordinary exp rate do.
The main problem is that when player with level 130 kills player with level 100, he advances to about lvl 180, cause my exp stage for that lvls is x50.
Is there any possibility to separate rateExp and Rate linked with experience by killing players?
 
Code:
function onKill(cid, target, lastHit)
    local attackPlayer = Player(target)
    if(not attackPlayer) then
        return true
    end

    for id, damage in pairs(attackPlayer:getDamageMap()) do
        local player = Player(id)
        if(player) then
            if(attackPlayer ~= player) then
                if(Game.convertIpToString(attackPlayer:getIp()) ~= Game.convertIpToString(player:getIp())) then
                    if(attackPlayer:getLevel() >= player:getLevel()) then
                        if(attackPlayer:getLevel() >= player:getLevel()) then
                            player:addExperience(math.floor(((player:getExperience() / 100) * 6.0)), true)
                        end
                       
                        player:say("Frag!", TALKTYPE_MONSTER_SAY)
                    end
                else
                    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You didn't get frag/reward because of killing a player with same ip.")
                end
            end
        end
    end
end

That one works, just tested it with 2 of my server testers. But you need to rewrite the formula for the exp since(what we tried) if a level 19 kills a lvl 40 he gets to about lvl 70.
 
Last edited:
I guess I should add this script in creaturescripts and that's all?

It looks like it will works perfectly :) Thank you very much WibbenZ
 
Code:
function onKill(cid, target, lastHit)
    local attackPlayer = Player(target)
    if(not attackPlayer) then
        return true
    end

    for id, damage in pairs(attackPlayer:getDamageMap()) do
        local player = Player(id)
        if(player) then
            if(attackPlayer ~= player) then
                if(Game.convertIpToString(attackPlayer:getIp()) ~= Game.convertIpToString(player:getIp())) then
                    if(attackPlayer:getLevel() >= player:getLevel()) then
                        if(attackPlayer:getLevel() >= player:getLevel()) then
                            player:addExperience(math.floor(((player:getExperience() / 100) * 6.0)), true)
                        end
                      
                        player:say("Frag!", TALKTYPE_MONSTER_SAY)
                    end
                else
                    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You didn't get frag/reward because of killing a player with same ip.")
                end
            end
        end
    end
end

That one works, just tested it with 2 of my server testers. But you need to rewrite the formula for the exp since(what we tried) if a level 19 kills a lvl 40 he gets to about lvl 70.[/QUOTE

Where is this meant to be saved? Also, in the config.lua, will i have to reference this script?

Thanks
 

No as I wrote, you will have to fix the formula for your server, the formula isen't the same for ex. a high exp server compared to a low exp server.
Code:
    math.floor(((player:getExperience() / 100) * 6.0))

The formula I use is alot diffrent since I used this on a noob war server.

If you don't know where to save an onKill script then you should try to learn abit more before starting a server.
And no this script dosen't use a config variable.
 
The server that a friend and myself are creating is a lower exp RPG server, and I know i need to learn more. This is how I learn... By asking questions, implementing shit that doesn't work, then getting it to work. :)
 
Back
Top