Edit i have used this thanks!
Lua:
local monsters = {
["demon"] = {item = 2160, count = 2, chance = 70},
["rat"] = {item = 2160, count = 2, chance = 80}
}
function onKill(cid, target, lastHit)
local storage = 7474
local v = getMonsterInfo(getCreatureName(target)).lookCorpse
local chance = math.random(1, 100)
if getPlayerStorageValue(cid, storage) == 1 then
for k, a in pairs(monsters) do
if (isMonster(target) and ((string.lower(getCreatureName(target))) == k)) then
if a.chance >= chance then
local function dropLoot(pos, v, cid)
local corpse = getTileItemById(pos, v).uid
doAddContainerItem(corpse, a.item, math.random(1, a.count))
end
addEvent(dropLoot, 0, getThingPos(target), v,cid)
end
end
end
end
return true
end
Last edited: