local config =
{
killsCount = 3943,
levels =
{
{100, 135, 5807, 1, 2},
{135, 150, 5806, 1, 4},
{150, 450, 5805, 1, 6},
},
skulls =
{
{SKULL_GREEN, 10},
{SKULL_YELLOW, 25},
{SKULL_WHITE, 40},
{SKULL_RED, 60}
}
}
function onKill(cid, target, lastHit)
if(not isPlayer(cid) or not isPlayer(target)) then
return true
end
if(not lastHit) then
return true
end
if(getPlayerStorageValue(cid, getPlayerIp(target)) == 5) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You won't get frags and exp by killing this player ([ANTY FRAGGING SYSTEM])")
return true
end
if(getPlayerIp(cid) == getPlayerIp(target)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You won't get frags by killing yourself (This same IP!)")
return true
end
if(getPlayerName(cid) == getPlayerName(target)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You won't get frags by killing yourself!")
return true
end
local kills = getPlayerStorageValue(cid, config.killsCount)
if(kills == -1) then
kills = 0
end
frags.add(cid, 1)
setPlayerStorageValue(cid, config.killsCount, kills + 1)
local frags = getPlayerStorageValue(cid, config.killsCount)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You owned " .. getPlayerName(target) .. "! You have now " .. frags .. " frags!")
for i, v in ipairs(config.skulls) do
if(frags >= v[2]) then
doCreatureSetSkullType(cid, v[1])
end
end
local level = getPlayerLevel(target)
for i, v in ipairs(config.levels) do
if(level >= v[1] and level < v[2]) then
local item = doPlayerAddItem(cid, v[3], v[4])
doItemSetAttribute(item, "description", "Reward for kill " .. getPlayerName(target) .. " at level " .. getPlayerLevel(target) .. ".")
break
end
end
return true
end