• 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!

CreatureEvent Party Loot Share

@imkingran

Try this:
Code:
local STORAGE = 23305
function onSay(cid, words, param, type)  
    local player = Player(cid)
    local party = player:getParty()

    if not party then
        player:sendCancelMessage("You're not in a party.")
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
        return false
    end

    if party:getLeader() ~= player then
        player:sendCancelMessage("You're not the leader of your party.")
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
        return false
    end

    player:setStorageValue(STORAGE, player:getStorageValue(STORAGE) == -1 and 1 or -1)
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Party Item share has been " .. (player:getStorageValue(STORAGE) == -1 and "disabled" or "enabled") .. ".")
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
  
    return false
end
 
Code:
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>

I'm using TFS 1.0 and I'm getting this error. Anybody have the solution? I couldn't solve it yet myself but will keep working on it as well.

This is the talkaction script i'm using:

Code:
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
Code:
local stor = 23305

function onSay(cid, words, param, channel)
local player = Player(cid)
local party = player:getParty()
  if Player(cid):getParty() then
  if party:getLeader():getId() == 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
 
Hey i tryed this script on my TFS 1.0. The Talkaction works fine, i get message enabled or disabled.
But when i kill monster in party nothing happens, i just get the normal loot message.
Can someone help?

Edit: I tryed all the .lua files.
 
Last edited:
do you have random item stats but one script or mod that really work. Otland have one Random item stats but doesnt work on 0.4
 
Back
Top