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

Solved Need function onKill explained. 0.3.7

  • Thread starter Thread starter Xikini
  • Start date Start date
X

Xikini

Guest
TFS 0.3.7

Looking around for a couple days to try to get this figured out, but I don't understand how each part of the function works.

Code:
function onKill(cid, target, damage, flags)

More particularly, trying to figure out how to use the damage map part.

Thanks.
 
TFS 0.3.7

Looking around for a couple days to try to get this figured out, but I don't understand how each part of the function works.

Code:
function onKill(cid, target, damage, flags)

More particularly, trying to figure out how to use the damage map part.

Thanks.

The onKill is fired for every person that killed the target and the damage is the damage that cid did to target.

For example if player A and player B kills a rotworm.
It will fire onKill 2 times with player A as cid and the rotworm as target and his damage. The same for player B with his damage.
 
TFS 0.3.7

Looking around for a couple days to try to get this figured out, but I don't understand how each part of the function works.

Code:
function onKill(cid, target, damage, flags)

More particularly, trying to figure out how to use the damage map part.

Thanks.

If you ever need to find out what something is, and it is a table (such as damage). Simply do.
Code:
function onKill(cid, target, damage, flags)
  if isCreature(cid) then
    doCreatureSay(cid, table.unserialize(damage), 1)
  end
  return true
end

(Make sure you register the event on your player, and/or on the monsters you are testing with)

Then just kill monsters or test characters a few times to figure out how damage works. (Each time a player/creature dies, the character that died should say the damage table)
 
The onKill is fired for every person that killed the target and the damage is the damage that cid did to target.

For example if player A and player B kills a rotworm.
It will fire onKill 2 times with player A as cid and the rotworm as target and his damage. The same for player B with his damage.
If you ever need to find out what something is, and it is a table (such as damage). Simply do.
Code:
function onKill(cid, target, damage, flags)
  if isCreature(cid) then
    doCreatureSay(cid, table.unserialize(damage), 1)
  end
  return true
end
Thank you.
 
Back
Top