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

RevScripts Points system by killing monster

nefinoo

Carnage.flv
Joined
Sep 11, 2010
Messages
549
Solutions
1
Reaction score
58
Location
Lo Mochis, Sinaloa
Im trying to find a monster point system when you kill 1 monster get 1 point.
i am using storage value = 100 to save the points count.
 
Solution
Im trying to find a monster point system when you kill 1 monster get 1 point.
i am using storage value = 100 to save the points count.
Lua:
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...
Im trying to find a monster point system when you kill 1 monster get 1 point.
i am using storage value = 100 to save the points count.
Lua:
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()
 
Solution
Back
Top