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

Kill player get 5 platinums

Mister Budex

BudexOT.com
Joined
Jun 22, 2016
Messages
1,547
Solutions
18
Reaction score
378
Hello, can someone give script to me to works like this, When i kill player i want to get 5 platinum coins :D
thanks
 
Solution
yeah was about to post this, i sadly don't remember the old main function arguments, thought onDeath would work (wanted it to only give it to the actual killer, not all players that did damage with onKill)
mmm, I think onKill only works for the person who last hit the target.
I don't have any way to test that though.

.. But we also have "flags"..
Lua:
uint32_t flags = 0;
       if(entry.isLast())
           flags |= 1;

       if(entry.isJustify())
           flags |= 2;

       if(entry.isUnjustified())
           flags |= 4;

So we could alter the code like this...? And it would only work for the player who last hit?
OP will have to test.

Lua:
function onKill(cid, target, damage, flags)
   if bit.band(flags, 1) == 1 then...
Problem is with the main function.

//onDeath(cid, corpse, deathList)

You need to use 'onKill' instead.

Code:
function onKill(cid, target, damage, flags)
    if isPlayer(cid) and isPlayer(target) then
        doPlayerAddItem(target, 2152, 5)
    end
    return true
end
yeah was about to post this, i sadly don't remember the old main function arguments, thought onDeath would work (wanted it to only give it to the actual killer, not all players that did damage with onKill)
 
yeah was about to post this, i sadly don't remember the old main function arguments, thought onDeath would work (wanted it to only give it to the actual killer, not all players that did damage with onKill)
mmm, I think onKill only works for the person who last hit the target.
I don't have any way to test that though.

.. But we also have "flags"..
Lua:
uint32_t flags = 0;
       if(entry.isLast())
           flags |= 1;

       if(entry.isJustify())
           flags |= 2;

       if(entry.isUnjustified())
           flags |= 4;

So we could alter the code like this...? And it would only work for the player who last hit?
OP will have to test.

Lua:
function onKill(cid, target, damage, flags)
   if bit.band(flags, 1) == 1 then
       if isPlayer(cid) and isPlayer(target) then
           doPlayerAddItem(cid, 2152, 5)
       end
   end
   return true
end
 
Last edited by a moderator:
Solution
Problem is with the main function.

//onDeath(cid, corpse, deathList)

You need to use 'onKill' instead.

Code:
function onKill(cid, target, damage, flags)
    if isPlayer(cid) and isPlayer(target) then
        doPlayerAddItem(cid, 2152, 5)
    end
    return true
end
[Warning - Event::loadScript] Event onDeath not found (data/creaturescripts/scripts/reward.lua)
 
Back
Top