• 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 loot gold

Il Knight

Veteran OT User
Joined
Dec 1, 2014
Messages
678
Solutions
7
Reaction score
352
Location
Spain
Hi community,
today i am triying to add this script to mi Tfs 1.2 (10.76-10.77) (latest tfs source)

its a creatureevent OnKill

function autoGP(cid, pos, corpseId)
local player = Player(cid)
if not player then
return
end

local corpse = Tile(pos):getItemById(corpseId)
if corpse then
local container = Container(corpse:getUniqueId())
if container then
local gold = 0
for i = 1, container:getSize() do
local item = container:getItem(i)
if item then
local id = item:getId()
local count = item:getCount()
local goldAdded = id == 2148 and count or id == 2152 and count * 100 or id == 2160 and count * 10000 or 0
if goldAdded > 0 then
gold = gold + goldAdded
item:remove(count)
end
else
break
end
end

player:addMoney(gold)
end
end
end

function onKill(creature, target)
if target:isPlayer() then
return true
end

local monsterType = MonsterType(target:getName())
addEvent(autoGP, 1, creature:getId(), target:getPosition(), monsterType:getCorpseId())
return true
end


its dont work and dont show errors,
i need it to AUTO loot the gold, platinum and crystal coins from the creatures when you kill it
if someone can help me! thanks in advance
 
Back
Top