Credits:
@cbrm For The Function Part
@tetra20 for Editing it
This Is The Killer Player
The Script Mistakes:
@cbrm For The Function Part
@tetra20 for Editing it
- Hello i wanted to release my latest script.Party Loot Share
- I Will Start By The ScreenShots
- It Should Work With
- 0.3.7:Tested And Working
- 0.3.6:Tested And Working
- 0.4:Tested And Working
- 1.0:Not Really Tested But Should Work Good Here
This Is The Killer Player
The Player In Party
- Create A New .lua name it killcreature.lua
- Add This:
Code:
math.randomseed(os.time())
local maxdis = 40
function autoloot(cid, target, pos)
if not isPlayer(cid) then
return
end
local function scanContainer(cid, uid)
local added = 0
local members = getPartyMembers(cid)
for k = (getContainerSize(uid) - 1), 0, -1 do
local tmp = getContainerItem(uid, k)
local stack = 0
local winner = getPartyMembers(getPartyLeader(cid))[math.random(1, table.maxn(getPartyMembers(getPartyLeader(cid))))]
if getDistanceBetween(getCreaturePosition(cid), getCreaturePosition(winner)) <= maxdis then
if (isInArray({2148,2152, 2160}, tmp.itemid)) then
local money = (tmp.itemid == 2160) and (tmp.type*10000) or (tmp.itemid == 2152) and (tmp.type*100) or tmp.type
added = added + money
for a = 1,#members do
doPlayerAddMoney(members[a], math.floor((money/table.maxn(members))))
doPlayerSendTextMessage(members[a], MESSAGE_STATUS_CONSOLE_BLUE, '[Loot System] ' .. math.floor(((added/table.maxn(members)))) .. ' Gold Coin Has Been Added to Your Backpack')
end
elseif isItemStackable(tmp.itemid) then
stack = tmp.type
for i = 1,#members do
doPlayerAddItem(members[i], tmp.itemid,math.floor(stack/table.maxn(members))+1)
if doPlayerSendTextMessage(members[i], MESSAGE_STATUS_CONSOLE_BLUE, "[Loot System] " .. math.floor(((stack/table.maxn(members))))+1 .. "x " .. getItemNameById(tmp.itemid) .. " Has Been Added to Your Backpack") then
end
end
elseif isContainer(tmp.uid) then
scanContainer(cid, tmp.uid)
else
if tmp.type == 0 and not (isInArray({2148, 2152, 2160}, tmp.itemid)) then
doPlayerAddItem(winner, tmp.itemid,tmp.type)
doPlayerSendTextMessage(winner, MESSAGE_STATUS_CONSOLE_BLUE, "[Loot System] You've won: " .. tmp.type+1 .. "x " .. getItemNameById(tmp.itemid) .. ".")
else
doPlayerAddItem(winner, tmp.itemid,tmp.type)
doPlayerSendTextMessage(winner, MESSAGE_STATUS_CONSOLE_BLUE, "[Loot System] You've won: " .. tmp.type .. "x " .. getItemNameById(tmp.itemid) .. ".")
end
end
end
doRemoveItem(tmp.uid)
end
return true
end
local items = {}
for i = getTileInfo(pos).items, 1, -1 do
pos.stackpos = i
items[i] = getThingFromPos(pos)
end
if (#items == 0) then
return
end
local corpse = -1
for _, item in pairs(items) do
if not isCreature(item.uid) then
local name = getItemName(item.uid):lower()
if name:find(target:lower()) then
corpse = item.uid
break
end
end
end
if (corpse ~= -1) and isContainer(corpse) and (getItemAttribute(corpse, "corpseowner") == cid) then
scanContainer(cid, corpse)
end
end
function onKill(cid, target, lastHit)
local members = getPartyMembers(cid)
if isMonster(target) and (isInParty(cid)) and getPlayerStorageValue(members[2], 23305) == 1 then
addEvent(autoloot, 100, cid, getCreatureName(target), getCreaturePosition(target))
end
return true
end
- In Creaturescripts.xml Add This
Code:
<event type="kill" name="killcreature" event="script" value="killcreature.lua"/>
- Now In Login.lua Add This
Code:
registerCreatureEvent(cid, "killcreature")
- Now Open The Talkactions.xml
- Add This:
Code:
<talkaction words="!loot" event="script" value="lootshare.lua"/>
- Create A New lootshare.lua in talkaction
- Add This:
Code:
local stor = 23305
function onSay(cid, words, param, channel)
local party = getPartyMembers(cid)
if isInParty(cid) then
if party[2] == cid then
doCreatureSetStorage(party[2], stor, (getCreatureStorage(party[2], stor) == -1) and 1 or -1)
doPlayerSendTextMessage(party[2], MESSAGE_STATUS_CONSOLE_BLUE, 'Party Item Share has been ' .. (getCreatureStorage(party[2], stor) == -1 and 'disabled' or 'enabled') .. '.')
else
doPlayerSendCancel(cid, "You Aren't The Leader of Party")
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
end
else
doPlayerSendCancel(cid, "You Aren't In Party")
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
end
return true
end
- How To Use:
Code:
!loot
Code:
1-This Script Won't Work With Random Item Stats.it will just give the item with normal stats
- The Script Was Tabbed but it got screwed up due to the code Tags
Last edited: