• 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 Help with script onDeath

Unass

New Member
Joined
Jul 28, 2010
Messages
23
Reaction score
0
hello otlanders, i have some problems with fragreward script


Here for example i write simple script which doesnt work

PHP:
function onDeath(cid, corpse, lastHitKiller, mostDamageKiller)
doPlayerAddItem(lastHitKiller, 9933)
end

PHP:
[11/05/2010 14:59:31] [Error - CreatureScript Interface] 
[11/05/2010 14:59:31] data/creaturescripts/scripts/death.lua:onDeath
[11/05/2010 14:59:31] Description: 
[11/05/2010 14:59:31] (luaDoPlayerAddItem) Player not found


Whats wrong ;) ;|

_______________________________________
if i add to script
if isPlayer(lastHitKiller) == TRUE then

there is no error in console and i dont get reward becouse there is no lasthitKiller

wtf how it can be possible??
 
Third argument in function onDeath is table.
Code:
onDeath(cid, corpse, deathList)
doc/SCRIPTSYSTEM_HELP
Use
Code:
onKill(cid, target, lastHit)
 
using onkill...when last hit...
Lua:
function onKill(cid, target, lastHit)
    if lastHit and isPlayer(cid) and isPlayer(target) then
        doPlayerAddItem(cid, 9933)
    end
    return true
end
using ondeath...
Lua:
function onDeath(cid, corpse, deathList)
    if isPlayer(cid) and isPlayer(deathList[1]) then
        doPlayerAddItem(deathList[1], 9933)
    end
    return true
end
 
Last edited:
Back
Top