• 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] Players can only attack x levels below

strutZ

Australian OT Member {AKA Beastn}
Joined
Nov 16, 2014
Messages
1,393
Solutions
7
Reaction score
552
Hey guys,

There has been a bit of power abusing on my server lately and was wondering if this system is possible..

- Players can only attack other players x levels above them in example i used 50 (Example: player of level 200 can attack players of minimum level 150)

- Players of lower level can attack anyone above them and once they have attacked they get a yellow skull and can be attacked by anyone (Example: Player of level 50 attacks player of level 200, PLayer of level 200 can now attack him)

I assume majority if not all will be source edits..

Thanks
 
Hey guys,

There has been a bit of power abusing on my server lately and was wondering if this system is possible..

- Players can only attack other players x levels above them in example i used 50 (Example: player of level 200 can attack players of minimum level 150)

- Players of lower level can attack anyone above them and once they have attacked they get a yellow skull and can be attacked by anyone (Example: Player of level 50 attacks player of level 200, PLayer of level 200 can now attack him)

I assume majority if not all will be source edits..

Thanks
Code:
function Creature:onTargetCombat(target)
    if self and target then
        if self:isPlayer() and target:isPlayer() then
            if math.abs(self:getLevel()-target:getLevel()) > 50 then
                return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER
            end
        end
    end
    return RETURNVALUE_NOERROR
end

That is not exactly what you asked, players level 200 may only attack 150~250, but I figured out it was better this way because imagine having a level 200 hitting a level 300 but the 300 can't hit that 200 :s

If you want to do that thing with skulls bla etc its possible with lua you should be able to do it.
 
Code:
function Creature:onTargetCombat(target)
    if self and target then
        if self:isPlayer() and target:isPlayer() then
            if math.abs(self:getLevel()-target:getLevel()) > 50 then
                return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER
            end
        end
    end
    return RETURNVALUE_NOERROR
end

That is not exactly what you asked, players level 200 may only attack 150~250, but I figured out it was better this way because imagine having a level 200 hitting a level 300 but the 300 can't hit that 200 :s

If you want to do that thing with skulls bla etc its possible with lua you should be able to do it.

oh sweet thanks for this man.. i literally just thought of it whilst training to work and wanted to write it before i forgot..
 
Back
Top