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

Edit Antifrag

pawlacz741

New Member
Joined
Jan 23, 2009
Messages
90
Reaction score
2
Hello can somebody edit my script to it: buy first look

function onKill(cid, target, lastHit)

local timeWithinKill = 40 --in seconds
local killsLimit = 5 --limit to die
local lastKill, lastKillTime = nil, nil
local storage = 65535 --storage to check if player has killed another player 'killsLimit' times

if(isPlayer(target) == false) or (isMonster(cid) == true) then
return true
end

query = db.getResult("select lastKill, lastKillTime from players where id = " .. getPlayerGUID(cid) .. ";")
if(query:getID() ~= -1) then
lastKill, lastKillTime = query:getDataInt("lastKill"), query:getDataInt("lastKillTime")
if(lastKill == getPlayerGUID(target)) then
if(os.clock() - lastKillTime) < timeWithinKill then
if(getPlayerStorageValue(cid, storage) < 0) then
doPlayerSetStorageValue(cid, storage, 0)
end
doPlayerSetStorageValue(cid, storage, getPlayerStorageValue(cid, storage) + 1)
if(getPlayerStorageValue(cid, storage) >= killsLimit) then
doCreatureAddHealth(cid, -getCreatureHealth(cid))
doPlayerSendTextMessage(cid,22,"FREE FRAGING OR MC = DEATH")
end
else
doPlayerSetStorageValue(cid, storage, 0)
end
end
db.executeQuery("update players set lastKill = " .. getPlayerGUID(target) .. ", lastKillTime = " .. os.clock() .. " where id = " .. getPlayerGUID(cid) .. ";")
else
return LUA_ERROR
end
return true
end

Its killing MC and free fraging but its not good idea to kill and don't always kill player becouse when he kill random player he get lvl and 5 hp more and script don't kill him..

Somebody have other idea to antyfrag? Meaby somebody can to do teleport to position XXX? Or change it to don't get exp for player when u kill that same player 5 times.

Sry but my english is low..
 
as far as i understand you dont want players to get exp from mc right? so just make players with same ip cant attack each other
in creatureevent
LUA:
function onCombat(cid,target)
if getPlayerIp(cid) == getPlayerIp(target) then
 return false
end
return true
end

regestire event name in login.lua
 
Errors on console when somebody died by monster or other player

[13/08/2010 11:51:28] [Error - CreatureScript Interface]
[13/08/2010 11:51:28] data/creaturescripts/scripts/anty.lua:onCombat
[13/08/2010 11:51:28] Description:
[13/08/2010 11:51:28] (internalGetPlayerInfo) Player not found when requesting player info #28

Any idea?
 
Rep++
LUA:
function onCombat(cid,target)
if isPlayer(cid) == true and isPlayer(target) == true then
   if getPlayerIp(cid) == getPlayerIp(target) then
      return false
   end
end
return true
end
 
Thanks i give u yesterday ; ]

Can you edit this script to only say on boardcast who last hit monster?

local monsters = {"Demodras","Orshabaal"}

function onKill(cid, target, lastHit)
if not(isInArray(monsters,getCreatureName(target):lower())) or not isMonster(target) then
return true
end
doBroadcastMessage(getCreatureName(cid) .. "["..getPlayerLevel(cid).."] Just killed a " .. getCreatureName(target)..".")
return true
end
 
Haven't tested
LUA:
local monsters = {"Demodras","Orshabaal"}

function onKill(cid, target, lastHit)
if not(isInArray(monsters,getCreatureName(target):lower())) or not isMonster(target) then
return true
end
if lastHit then
doBroadcastMessage(getCreatureName(cid) .. "["..getPlayerLevel(cid).."] Just killed a " .. getCreatureName(target)..".")
end
return true
end
 
Last edited:
Back
Top