MarkSmartRemark
Lua-Noob in Training :D
- Joined
- Jan 27, 2010
- Messages
- 139
- Reaction score
- 3
the "single item" loot just gave it to any random player in the party.. i was using 3 people heh
Ye.it just give random item if the item isn't stackable or money.Like fire axethe "single item" loot just gave it to any random player in the party.. i was using 3 people heh
Ye.it just give random item if the item isn't stackable or money.Like fire axe
And Thanks For Testing Again.Btw i haven't seen you on otland before
Haha Welcome Back btw i have made this system for my server to force people to use party.really there are much more in my server but i don't release.pm me if you want to see moreyeaa i just got back recently, i was out for a good 2-3 years.. its gotten smaller here but theres still alotta familiar faces! and otfans is down haha couple things changed but yea, im back so ill try my best to help out anytime i can since im not a pro scripter yet lolol and make my little noob requests here and there
nice loot share though, good stuff for heavy team hunt servers
Lua Script Error: [Test Interface]
data/creaturescripts/scripts/PartyLoot.lua
data/creaturescripts/scripts/PartyLoot.lua:4: attempt to index local 'player' (a
nil value)
stack traceback:
[C]: in function '__index'
data/creaturescripts/scripts/PartyLoot.lua:4: in main chunk
[Warning - Event::checkScript] Can not load script: scripts/PartyLoot.lua
math.randomseed(os.time())
local maxdis = 40
function autoloot(cid, target, pos)
local player = Player(cid)
local party = player:getParty()
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 = party:getMembers()
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/party:getMemberCount())))
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/party:getMemberCount())+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[math.random(1,#winner)], tmp.itemid,tmp.type)
doPlayerSendTextMessage(winner[math.random(1,#winner)], MESSAGE_STATUS_CONSOLE_BLUE, "[Loot System] You've won: " .. tmp.type+1 .. "x " .. getItemNameById(tmp.itemid) .. ".")
else
doPlayerAddItem(winner[math.random(1,#winner)], tmp.itemid,tmp.type)
doPlayerSendTextMessage(winner[math.random(1,#winner)], MESSAGE_STATUS_CONSOLE_BLUE, "[Loot System] You've won: " .. tmp.type .. "x " .. getItemNameById(tmp.itemid) .. ".")
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.itemid):lower()
if name:find(target:lower()) then
if isCorpse(item.uid) then
corpse = item.uid
break
end
end
end
end
scanContainer(cid, corpse)
end
function onKill(cid, target, lastHit)
local members = getPartyMembers(cid)
local party = Player(cid):getParty()
if isMonster(target) and party and getPlayerStorageValue(members[2], 23305) == 1 then
addEvent(autoloot, 100, cid, getCreatureName(target), getCreaturePosition(target))
end
return true
end
Crushed Dem Bugs? That Mean? Sorry For Being A NoobYou crushed dem bugs.
Will try it more closely asap and write any ideas/thoughts that I have.
Thank You!
Kind Regards,
Eldin.
When you Test It Tell meJust a Little joke, you fixed it and the bugs are gone.
Haven't tested it ingame yet tho.
Kind Regards,
Eldin.
Noobs Will Always Stay Noobs.Script not working on 0.3.6 stil getting 10 gold when not in party and say !loot
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
scanContainer(cid, corpse)
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
I Am Lying to You.Not to my Customers.noob add the talkaction part not the creaturescript0.3.6:Tested And Working
you lying to your customers
It is still addin 10Gp when you are not in party
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 scanContainer(cid, corpse) 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
I Have Made a Little Edit to the script.Just The Corpse Owner will get the loot.if he is in party it will be sharedOkay now the system works for me
my question now is
When 5 players attack a boss and 3 are in party and the 2 which are not attacking make more dmg will the 3 don't get it?
Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/lootshare.lua:onSay
data/talkactions/scripts/lootshare.lua:6: attempt to call method 'getLeader' (a
nil value)
stack traceback:
[C]: in function 'getLeader'
data/talkactions/scripts/lootshare.lua:6: in function <data/talkactions/
scripts/lootshare.lua:3>
local stor = 23305
function onSay(cid, words, param, channel)
local party = getPartyMembers(cid)
if Player(cid):getParty() then
if party:getLeader() == cid then
setPlayerStorageValue(party:getLeader(), stor, (getPlayerStorageValue(party:getLeader(), stor) == -1) and 1 or -1)
doPlayerSendTextMessage(party:getLeader(), MESSAGE_STATUS_CONSOLE_BLUE, 'Party Item Share has been ' .. (getPlayerStorageValue(party:getLeader(), 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