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

Lua Set MinLevel server + win gold onkill

Sir Prototype

New Member
Joined
May 12, 2017
Messages
3
Reaction score
0
Hello guys, could anyone help me?

In using Canary 3.0
Datapack 13.21

I want to implement an enforced-pvp system and I need to set the minimum level to 550, if I die and lose, go back to that..
Maybe we can adapt this script:

Code:
function onDeath(cid, corpse, deathList)
    for i = 1, 2 do
        if isPlayer(cid) and isPlayer(deathList[i]) then
            doPlayerAddExperience(deathList[i], getPlayerExperience(cid) / 3)
        end
    end
    return true
end

function onLogin(cid)
    registerCreatureEvent(cid, "Exp por player")
    return true
end


And I also needed that when you killed another player you would earn gold coins, if you could help me adapt this script to my version:
Lua:
function onKill(cid, target, lastHit)
if isPlayer(cid) and isPlayer(target) then
if getPlayerIp(target) ~= getPlayerIp(cid) then
doPlayerAddItem(cid, 2160, 1)
end
end
return TRUE
end

Thanks
 
Last edited:

Lua:
function onDeath(cid, corpse, deathList)
    local player = Player(cid)
    local minLevel = 550

    for i = 1, #deathList do
        if isPlayer(cid) and isPlayer(deathList[i]) then
            if player:getLevel() >= minLevel then
                player:addExperience(player:getExperience() / 3)
            else
                player:setLevel(minLevel)
            end
        end
    end
    return true
end

function onLogin(cid)
    local player = Player(cid)
    player:registerEvent("Exp por player")
    return true
end


Lua:
function onKill(cid, target, lastHit)
    local player = Player(cid)
    local targetPlayer = Player(target)

    if player:isPlayer() and targetPlayer:isPlayer() then
        if targetPlayer:getIp() ~= player:getIp() then
            player:addItem(2160, 1)
        end
    end
    return true
end
 
Back
Top