Venn
Member
- Joined
- Aug 16, 2009
- Messages
- 547
- Reaction score
- 20
TFS 0.4 CLIENT 8.71
WORK! but spam on my server and verry lagger
Code:[12:40:48.191] ( table.find(n.t ypes, DISTANCE) and f.weaponType == WEAPON_DIST and f.ammoType ~= 0 ) or [12:40:48.191] ( table.find(n.t ypes, ARMOR) and f.armor ~= 0 and f.wieldPosition ~= CONST_SLOT_NECKLACE ) or [12:40:48.191] ( table.find(n.t ypes, SHIELD) and f.defense ~= 0 and f.weaponType == WEAPON_SHIELD ) or [12:40:48.191] ( table.find(n.t ypes, WAND) and f.weaponType == WEAPON_WAND ) or [12:40:48.191] ( table.find(n.t ypes, DURATION_RING) and f.wieldPosition == CONST_SLOT_RING and f.transformEquip To ~= 0 ) or [12:40:48.191] ( table.find(n.t ypes, CHARGES) and table.find({CONST_SLOT_RING, CONST_SLOT_NECKLACE}, f.wieldPos ition) and f.charges ~= 0 ) [12:40:48.191] ) )then [12:40:48.191] table.insert(cur , m) [12:40:48.191] end [12:40:48.191] end [12:40:48.192] [12:40:48.192] if( #cur ~= 0 )then [12:40:48.192] local n = cur[math.rando m(#cur)] [12:40:48.192] table.insert(used, n) [12:40:48.192] [12:40:48.192] n = attr[n] [12:40:48.192] local percent, new, tmp = math.random(n.percent[1] + (v.extra[1] or 0), n.percent[2] + (v.extra[2] or 0) ) [12:40:48.192] -- hacks [12:40:48.192] if( n.attr == 'duration' )then [12:40:48.192] tmp = getItemInf o(f.transformEquipTo) [12:40:48.192] if tmp.transform DeEquipTo ~= item then [12:40:48.192] break [12:40:48.192] end [12:40:48.192] new = round( tmp .decayTime * (1 + percent / 100) * 1000 ) [12:40:48.192] elseif( n.attr == 'attac kSpeed' )then [12:40:48.192] new = round( voc ation_base_attackspeed / (1 + percent / 100) ) [12:40:48.192] elseif( n.attr == 'hitCh ance' ) then [12:40:48.192] new = round( [12:40:48.192] f.hitCha nce == -1 and [12:40:48.192] p ercent [12:40:48.192] or [12:40:48.192] f .hitChance * (1 + percent / 100) [12:40:48.192] ) [12:40:48.192] else [12:40:48.192] new = round( [12:40:48.192] n.base a nd [12:40:48.192] f [n['attr']] + f[n['base']] * (percent / 100) [12:40:48.192] or [12:40:48.192] f [n['attr']] * (1 + percent / 100) [12:40:48.192] ) [12:40:48.192] [12:40:48.192] if( new == f[n[n .base and 'base' or 'attr']] )then -- no improvement [12:40:48.192] break [12:40:48.192] end [12:40:48.192] end [12:40:48.192] [12:40:48.192] doItemSetAttribute(tmpIt em, n.attr:lower(), new) [12:40:48.192] [12:40:48.192] local name = getItemAttr ibute(tmpItem, 'name') [12:40:48.192] if( v.attrNames or not n ame )then [12:40:48.192] local name = (v. attrNames and used[#used] or k) .. ' ' .. (name or f.name) [12:40:48.192] doItemSetAttribu te(tmpItem, 'name', name) [12:40:48.192] [12:40:48.192] if( f.article ~= '' )then [12:40:48.192] local ar ticle = getArticle(name) [12:40:48.192] if( arti cle ~= f.article )then [12:40:48.192] d oItemSetAttribute(tmpItem, 'article', article) [12:40:48.192] end [12:40:48.192] end [12:40:48.192] end [12:40:48.192] [12:40:48.192] local desc = getItemAttr ibute(tmpItem, 'description') or f.description [12:40:48.192] doItemSetAttribute(tmpIt em, 'description', '[' .. n.name .. ': +' .. percent .. '%]' .. (desc == '' and '' or '\n' .. desc)) [12:40:48.192] [12:40:48.192] ret = k [12:40:48.192] end [12:40:48.192] cur = {} [12:40:48.192] if( #v.chance == i )then [12:40:48.192] done = true [12:40:48.192] end [12:40:48.192] end [12:40:48.192] else [12:40:48.192] done = i ~= 1 [12:40:48.192] break [12:40:48.192] end [12:40:48.192] end [12:40:48.192] if( done )then [12:40:48.192] break [12:40:48.192] end [12:40:48.192] end [12:40:48.192] [12:40:48.192] return tmpItem, ret [12:40:48.192] end [12:40:48.192] [12:40:48.192] local function createChildLoot(parent, i, ext, pos) [12:40:48.192] if( not i or #i == 0 )then [12:40:48.192] return true [12:40:48.192] end [12:40:48.192] [12:40:48.192] local size, cap = 0, getContainerCap(parent) [12:40:48.192] for k = 1, #i do [12:40:48.192] if( size == cap )then [12:40:48.192] break [12:40:48.192] end [12:40:48.192] local tmp, ret = createLoot(i[k], ext) [12:40:48.192] if( tmp )then [12:40:48.192] if( isContainer(tmp) )then [12:40:48.192] if( createChildLoot(tmp, i[k].child, ext , pos) )then [12:40:48.192] doAddContainerItemEx(parent, tmp ) [12:40:48.192] size = size + 1 [12:40:48.192] else [12:40:48.193] doRemoveItem(tmp) [12:40:48.193] end [12:40:48.193] else [12:40:48.193] if( ret )then [12:40:48.193] doSendMagicEffect(pos, CONST_ME_ MAGIC_GREEN) [12:40:48.193] doSendAnimatedText(pos, ret:uppe r(), tiers[ret].color) [12:40:48.193] end [12:40:48.193] doAddContainerItemEx(parent, tmp) [12:40:48.193] size = size + 1 [12:40:48.193] end [12:40:48.193] end [12:40:48.193] end [12:40:48.193] [12:40:48.193] return size > 0 [12:40:48.193] end [12:40:48.193] [12:40:48.193] local function dropLoot(pos, v, ext, master, cid, target) [12:40:48.193] local corpse [12:40:48.193] if( not master or master == target )then -- 0.3/4 [12:40:48.193] corpse = getTileItemById(pos, v.lookCorpse).uid [12:40:48.193] if( isContainer(corpse) )then [12:40:48.193] for i = 1, getContainerSize(corpse) do [12:40:48.193] doRemoveItem(getContainerItem(corpse, 0) .uid) [12:40:48.193] end [12:40:48.193] local size, cap = 0, getContainerCap(corpse) [12:40:48.193] for i = 1, #v.loot do [12:40:48.193] if( size == cap )then [12:40:48.193] break [12:40:48.193] end [12:40:48.193] local tmp, ret = createLoot(v.loot[i], e xt) [12:40:48.193] if( tmp )then [12:40:48.193] if( isContainer(tmp) )then [12:40:48.193] if( createChildLoot(tmp, v.loot[i].child, ext, pos) )then [12:40:48.193] doAddContainerIt emEx(corpse, tmp) [12:40:48.193] size = size + 1 [12:40:48.193] else [12:40:48.193] doRemoveItem(tmp ) [12:40:48.193] end [12:40:48.193] else [12:40:48.193] if( ret )then [12:40:48.193] doSendMagicEffec t(pos, CONST_ME_MAGIC_GREEN) [12:40:48.193] doSendAnimatedTe xt(pos, ret:upper(), tiers[ret].color) [12:40:48.193] end [12:40:48.193] doAddContainerItemEx(cor pse, tmp) [12:40:48.193] size = size + 1 [12:40:48.193] end [12:40:48.193] end [12:40:48.193] end [12:40:48.193] end [12:40:48.193] end [12:40:48.193] send(cid, corpse, v.description) [12:40:48.193] end [12:40:48.193] [12:40:48.193] function onKill(cid, target, damage, flags) [12:40:48.193] if( (damage == true or bit.band(flags, 1) == 1) and isMonster(ta rget) )then -- 0.3/4 [12:40:48.193] local v = getMonsterInfo(getCreatureName(target)) [12:40:48.193] if( v and v.lookCorpse ~= 0 )then [12:40:48.193] local s = getCreatureStorage(cid, extra_loot_key ) [12:40:48.193] addEvent(dropLoot, 0, getThingPos(target), v, s == -1 and rate or s, getCreatureMaster(target), cid, target) [12:40:48.193] end [12:40:48.193] end [12:40:48.193] return true [12:40:48.193] end [12:40:48.193] :onKill [12:40:48.193] Description: [12:40:48.193] (luaGetThing) Thing not found
its problem with functon
Lua:
function onKill(cid, target, damage, flags)
if( (damage == true or bit.band(flags, 1) == 1) and isMonster(target) )then -- 0.3/4
local v = getMonsterInfo(getCreatureName(target))
if( v and v.lookCorpse ~= 0 )then
local s = getCreatureStorage(cid, extra_loot_key)
addEvent(dropLoot, 0, getThingPos(target), v, s == -1 and rate or s, getCreatureMaster(target), cid, target)
end
end
return true
end
it cant find Thing at getThingPos(target) idk how to fix it