• 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 Gain percentage exp based on variable

chiitus

Member
Joined
Jun 1, 2009
Messages
206
Reaction score
12
Hi everybody, after my fail try to ur people help me i try to make the script myself, and the strange is that appear no erros on console but don't work :confused:

The script is for if player level is higher than X, he will receive exp based on a random variable (1 to 10)

Code:
function onKill(cid, target, lastHit)

    local monstreco = getCreatureName(target)
    local monstrecoexp = getMonsterInfo(monstreco).experience

    if isPlayer(cid) and isMonster(target) and lastHit then
        if getPlayerLevel(cid) > 70 then
            local t = math.random(1,10)
            doPlayerAddExp(cid, -monstrecoexp)
            doPlayerAddExp(cid, monstrecoexp*(t/10))
        end
    end
return true
end

Please help me guys, i try to register the event on login.lua, but still don't working and still dont show any errors on console!!!

Thanks adv ;)
 
Try This One
Code:
function onKill(cid, target, lastHit)
    local monstrecoexp = getMonsterInfo(getCreatureName(target)).experience
   
            if not getPlayerLevel(cid) > 70 then
            return true
            end

    if isPlayer(cid) and isMonster(target) then
            local t = math.random(1,10)
            doPlayerAddExperience(cid, monstrecoexp*(t/10) - monstrecoexp)
        end
        return true
    end
 
Back
Top