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

Killer level. 200 higher than target?

Serp

/* No comment */
Joined
Mar 23, 2008
Messages
249
Reaction score
1
How can i make something understand if a players level is a certain amount higher than another players?


apockalyptik fragreward script.
PHP:
function onKill(cid, target)
    if isPlayer(cid) then
        killerName = getCreatureName(cid)
        name = getCreatureName(target)
        lvl = getPlayerLevel(target)
        
        if lvl > 0 and lvl < 100 then
            loot = 5943


How could i edit that so it understood if the killer was 200 levels higher than the target?
 
Code:
function onKill(cid, target)
    if isPlayer(cid) then
        killerName = getCreatureName(cid)
        name = getCreatureName(target)
        lvl = getPlayerLevel(target)
        
        if lvl > 0 and lvl < 100 then
            loot = 5943

=

If you are higher level than 0
And the oponement is lower level than 100

You will be rewarded with item id 5943

I think he wants a script that:
If you are level etc 143
and the opponement 20+ levels higher than you (163)

then you will be rewarded with item id: xxxx

But sry, im not experienced enough to figure out how to make it in lua :p
 
Thats exactly what i meant :P im dyslexic so im not the best person with structuring my sentances. ty for explaining it better Z
 
ok so the script I think will be this

function blablabla

Code:
killerlevel = getCreatureLevel(killer)
victimlevel = getCreatureLevel(cid)
heartpos = getCreaturePos(cid) -- or killer, is the same thing

if killerlevel >= 0 and killerlevel <= 100 then
if victimlevel >= 0 and victimlevel <= 100 then
doCreateItem(5943,heartpos)

end -- victimlevel sentence
end -- killerlevel sentence
end -- function close

I think its ok in that way, test it and tell me
 
With Marcinek Paladinek's example it would be?
Code:
killerlevel = getCreatureLevel(killer)
victimlevel = getCreatureLevel(cid)
heartpos = getCreaturePos(cid) -- or killer, is the same thing

if (getPlayerLevel(killer) * 1.1) >= getPlayerLevel(cid) then
doCreateItem(5943,heartpos)

end -- victimlevel and killerlevel sentence
end -- function close
If this works, its not "20+ level" but "10% bigger level than the killer is"
 
Last edited:
Oh, so it should be only if 20 or more lvls higher?

Code:
if (getPlayerLevel(killer) - 20) >= getPlayerLevel(cid) then

So... if the killer is level 180 and (cid) 140, then it will take off 20 killers levels - 160 now and check if this number is higher than (cid)s level.

If the killers level is 180 and (cid)s 170 then it wont give any prize, since 160 < 170.
 

Similar threads

Back
Top