• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

[TFS 1.x] Talkaction to enable/disable loot message.

You are on the right line, you can do it with storage:

Code:
int32_t value;
if (owner && (owner->getStorageValue(1000, value) && value == 1)) {


Code:
function onSay(player, words, param)
    if player:getStorageValue(1000) == 1 then
        player:setStorageValue(1000, 0)
        player:sendTextMessage(MESSAGE_INFO_DESCR, "Loot message has been disabled.")
    else
        player:setStorageValue(1000, 1)
        player:sendTextMessage(MESSAGE_INFO_DESCR, "Loot message has been enabled.")
    end

    return false
end
 
Last edited:
You are on the right line, you can do it with storage:

Code:
int32_t value;
if (owner && (player->getStorageValue(1000, value) && value > 1)) {


Code:
function onSay(player, words, param)
    if player:getStorageValue(1000) == 1 then
        player:setStorageValue(1000, 0)
        player:sendTextMessage(MESSAGE_INFO_DESCR, "Loot message has been disabled.")
    else
        player:setStorageValue(1000, 1)
        player:sendTextMessage(MESSAGE_INFO_DESCR, "Loot message has been enabled.")
    end
 
    return false
end

Please HELP!!!

Code:
/home/otsmanager/forgottenserver/forgottenserver-8d4745e6fcd3caf69cc5c941869fe5c2b27c903f/src/monsters.cpp: In member function ‘void MonsterType::createLoot(Container*)’:
/home/otsmanager/forgottenserver/forgottenserver-8d4745e6fcd3caf69cc5c941869fe5c2b27c903f/src/monsters.cpp:165:17: error: ‘player’ was not declared in this scope
  if (owner && (player->getStorageValue(30016, value) && value > 1)) {
  ^
make[2]: *** [CMakeFiles/tfs.dir/src/monsters.cpp.o] Error 1
make[1]: *** [CMakeFiles/tfs.dir/all] Error 2
make: *** [all] Error 2
root@46-105-246-41:/home/otsmanager/forgottenserver/forgottenserver-8d4745e6fcd3caf69cc5c941869fe5c2b27c903f/build#
 
Please HELP!!!

Code:
/home/otsmanager/forgottenserver/forgottenserver-8d4745e6fcd3caf69cc5c941869fe5c2b27c903f/src/monsters.cpp: In member function ‘void MonsterType::createLoot(Container*)’:
/home/otsmanager/forgottenserver/forgottenserver-8d4745e6fcd3caf69cc5c941869fe5c2b27c903f/src/monsters.cpp:165:17: error: ‘player’ was not declared in this scope
  if (owner && (player->getStorageValue(30016, value) && value > 1)) {
  ^
make[2]: *** [CMakeFiles/tfs.dir/src/monsters.cpp.o] Error 1
make[1]: *** [CMakeFiles/tfs.dir/all] Error 2
make: *** [all] Error 2
root@46-105-246-41:/home/otsmanager/forgottenserver/forgottenserver-8d4745e6fcd3caf69cc5c941869fe5c2b27c903f/build#
Rather than saying "Please HELP!!!" tell us what the problem is, errors can only tell you soo much, what were you trying to accomplish?
 
This "Codex NG" only come to threads for flooding ever. Zzz I was think only for me, but is for all
I guess what you are trying to say in your broken english, If i post something in a thread i am not helpful at all.. if this is the case then don't read anything I post & you won't feel that way.
 
I guess what you are trying to say in your broken english, If i post something in a thread i am not helpful at all.. if this is the case then don't read anything I post & you won't feel that way.

1 AT LEAST I KNOW HOW TO SPEAK OTHER LANGUAGES, EXCEPT THE MINE.
2 SURE, JUST DONT POST ANYTHING IN MY THREADS, THANKS.
 
1 AT LEAST I KNOW HOW TO SPEAK OTHER LANGUAGES, EXCEPT THE MINE.
2 SURE, JUST DONT POST ANYTHING IN MY THREADS, THANKS.
But you can't program, script, compile, form a complete sentence or follow simple instructions for shit.. yea I soo wanna be you.
 
1 AT LEAST I KNOW HOW TO SPEAK OTHER LANGUAGES, EXCEPT THE MINE.
2 SURE, JUST DONT POST ANYTHING IN MY THREADS, THANKS.

1. I think this is the first sentence you wrote that is real english, everything else your posting is just terrible to read. That might be a reason why people cannot help you.
2. As I can see this thread is not yours, Peonso did open this thread.
 
But you can't program, script, compile, form a complete sentence or follow simple instructions for shit.. yea I soo wanna be you.


I do not know programming but have money to have my car, my house and buy programs/scripts (and i know compile lol), one thing that you do not spend anywhere near . Patetic life, thanks
 
I do not know programming but have money to have my car, my house and buy programs/scripts (and i know compile lol), one thing that you do not spend anywhere near . Patetic life, thanks
I am not the one on here 24/7 begging for help with my server..
Out of all my posts I've asked 1 question and @Printer answered it
If my life is pathetic what does that make yours?
 
I did got some weird behavior, when in a party people would get loot messages based on the killer storage value only. Change it that way:

https://github.com/otland/forgotten...cc5c941869fe5c2b27c903f/src/monsters.cpp#L164

Code:
    if (owner) {
       std::ostringstream ss;
       ss << "Loot of " << nameDescription << ": " << corpse->getContentDescription();

       if (owner->getParty()) {
         owner->getParty()->broadcastPartyLoot(ss.str());
       } else {
int32_t value;
         if (owner->getStorageValue(1000, value) && value == 1) {
           owner->sendTextMessage(MESSAGE_INFO_DESCR, ss.str());
         }
       }
     }

https://github.com/otland/forgotten...f69cc5c941869fe5c2b27c903f/src/party.cpp#L348

Code:
    void Party::broadcastPartyLoot(const std::string& loot)
     {
int32_t value;
       if (leader->getStorageValue(1000, value) && value == 1) {
         leader->sendTextMessage(MESSAGE_INFO_DESCR, loot);
       }
       for (Player* member : memberList) {
         if (member->getStorageValue(1000, value) && value == 1) {
           member->sendTextMessage(MESSAGE_INFO_DESCR, loot);
         }
       }
     }

@Printer
 
Back
Top