• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua KILL DEATH SAME IP

Sigoles

Discord: @sigoles
Joined
Nov 20, 2015
Messages
1,209
Solutions
2
Reaction score
154
Hello, How to dont count if player attacker/attacked is the same IP?

tfs 1.2

code
Code:
function onKill(creature, target)
  if target:isPlayer() and target:getLevel() >= 200 then
        creature:setStorageValue(167912, math.max(0, creature:getStorageValue(167912)) + 1)
     
         db.query("UPDATE `players` SET `frag_points` = `frag_points` + '1' WHERE `name` = "..db.escapeString(creature:getName())..";")
    end
    return true
end


function onDeath(creature, corpse, lasthitkiller, mostdamagekiller, lasthitunjustified, mostdamageunjustified)
    if lasthitkiller and lasthitkiller:isPlayer() and creature:getLevel() >= 200 then
        creature:setStorageValue(167913, math.max(0, creature:getStorageValue(167913)) + 1)
    end
    return true
end
 
Solution
LUA:
if creature:isPlayer() and target:isPlayer() and creature:getIp() == target:getIp() then
    return true
end

Same thing for the onDeath just change target to lasthitkiller.
LUA:
if creature:isPlayer() and target:isPlayer() and creature:getIp() == target:getIp() then
    return true
end

Same thing for the onDeath just change target to lasthitkiller.
 
Solution
Back
Top