local storage = 100
local monsterList = {
["demon"] = 1,
["dragon"] = 1,
["dragon lord"] = 1
}
local anyMonsterPoints = 1 -- -1 to disable
local killPoints = CreatureEvent("KillPoints")
function killPoints.onKill(player, target)
if not target:isMonster() then
return true
end
local monsterName = target:getName():lower()
local points = monsterList[monsterName]
if not points then
points = anyMonsterPoints
end
if points < 0 then
return true
end
local storageValue = player:getStorageValue(storage)
if storageValue < 0 then
storageValue = 0
end
player:setStorageValue(storage, storageValue + points)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, string.format("You have %d points.", storageValue + points))
return true
end
killPoints:register()
local killLogin = CreatureEvent("KillLogin")
function killLogin.onLogin(player)
player:registerEvent("KillPoints")
return true
end
killLogin:register()