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

Loot on corpse

Kjhgfd

New Member
Joined
Dec 25, 2016
Messages
63
Reaction score
1
there any function to check corpse for monster because i use onkill but need reward add in corpse not send to player

tfs 0.4

f5
 
Last edited by a moderator:
Solution
Because killer does not exist in the function, read what I wrote above.
???
KghkOgt.png

My script should work.. After you have added everything you need to restart the server.
You can also try this:
Lua:
function onDeath(cid, corpse, deathList)
    if isMonster(cid) then
        doAddContainerItem(corpse.uid, 2151, 1)
        doPlayerSendTextMessage(deathList[1], MESSAGE_STATUS_WARNING, "dfdfdfdf")
    end
return true
end
Lua:
function onDeath(cid, corpse, killer)
    if isMonster(cid) then
        doAddContainerItem(corpse.uid, 2151, 1)
        doPlayerSendTextMessage(killer[1], MESSAGE_STATUS_WARNING, "dfdfdfdf")
    end
return true
end
 
Lua:
function onDeath(cid, corpse, killer)
    if isMonster(cid) then
        doAddContainerItem(corpse.uid, 2151, 1)
        doPlayerSendTextMessage(killer[1], MESSAGE_STATUS_WARNING, "dfdfdfdf")
    end
return true
end
not work error 'killer' <a nil value >
 
Lua:
function onDeath(cid, corpse, killer)
    if isMonster(cid) then
        doAddContainerItem(corpse.uid, 2151, 1)
        if isPlayer(killer.uid) then
            doPlayerSendTextMessage(killer.uid, MESSAGE_STATUS_WARNING, "dfdfdfdf")
        end
    end
end

Lua:
function onDeath(cid, corpse, killer)
    if isMonster(cid) then
        doAddContainerItem(corpse.uid, 2151, 1)
        if isPlayer(killer.uid) then
            doPlayerSendTextMessage(killer.uid, MESSAGE_STATUS_WARNING, "dfdfdfdf")
        end
    end
end
same error :S
 
Last edited by a moderator:
Lua:
function onDeath(cid, corpse, killer)
    if isMonster(cid) then
        doAddContainerItem(corpse.uid, 2151, 1)
        if isPlayer(killer.uid) then
            doPlayerSendTextMessage(killer.uid, MESSAGE_STATUS_WARNING, "dfdfdfdf")
        end
    end
end


same error :S

Because killer does not exist in the function, read what I wrote above.

Lua:
function onDeath(cid, corpse, deathList)
    if isMonster(cid) then
        doAddContainerItem(corpse.uid, 2151, 1)
    end

    return true
end

Also
Rules for the Support board
#2
 
Because killer does not exist in the function, read what I wrote above.
???
KghkOgt.png

My script should work.. After you have added everything you need to restart the server.
You can also try this:
Lua:
function onDeath(cid, corpse, deathList)
    if isMonster(cid) then
        doAddContainerItem(corpse.uid, 2151, 1)
        doPlayerSendTextMessage(deathList[1], MESSAGE_STATUS_WARNING, "dfdfdfdf")
    end
return true
end
 
Solution
???
KghkOgt.png

My script should work.. After you have added everything you need to restart the server.
You can also try this:
Lua:
function onDeath(cid, corpse, deathList)
    if isMonster(cid) then
        doAddContainerItem(corpse.uid, 2151, 1)
        doPlayerSendTextMessage(deathList[1], MESSAGE_STATUS_WARNING, "dfdfdfdf")
    end
return true
end
worked :D
 

???
KghkOgt.png

My script should work.. After you have added everything you need to restart the server.
You can also try this:
Lua:
function onDeath(cid, corpse, deathList)
    if isMonster(cid) then
        doAddContainerItem(corpse.uid, 2151, 1)
        doPlayerSendTextMessage(deathList[1], MESSAGE_STATUS_WARNING, "dfdfdfdf")
    end
return true
end


I just checked the source code (link above) and 0.4 dosn't seem to have "killer", but maybe you are running another rev?
The error also said it was related to killer.
 
I just checked the source code (link above) and 0.4 dosn't seem to have "killer", but maybe you are running another rev?
The error also said it was related to killer.
I doesn't really matter. It's just a variable name, it should work however named it is. It's probably still the same rev you are revering to, but the script in question most likely got copied or based on already existing 1.x one that's where the variable name "killer" got there in the first place.

@Topic
Not really familiar with 0.4, but you should try killing something with your summon and see if it doesn't throw out an error. Simple isPlayer(deathList[1]) check will fix it. In 1.x doPlayerSendTextMessage() checks for a player, not sure how it is in 0.4.
 
I doesn't really matter. It's just a variable name, it should work however named it is. It's probably still the same rev you are revering to, but the script in question most likely got copied or based on already existing 1.x one that's where the variable name "killer" got there in the first place.

@Topic
Not really familiar with 0.4, but you should try killing something with your summon and see if it doesn't throw out an error. Simple isPlayer(deathList[1]) check will fix it. In 1.x doPlayerSendTextMessage() checks for a player, not sure how it is in 0.4.

Could be, but you can't index a table (deathList) as a creature.
And 1.x does not have that function, it's Player:sendTextMessage()
And in that case it does not check if it's a player.

If you for some reason use the compat file it will check if it's a player; forgottenserver/compat.lua at master · otland/forgottenserver · GitHub
 
Back
Top