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

Lua Is possible check sharing exp

newby

Active Member
Joined
Jun 11, 2016
Messages
183
Reaction score
43
Is possible check if players in party have share exp?

I want add bonus exp 12.5% per vocation
Exemple:
If have:
Code:
knight+paladin 25% bonus exp
knight+paladin+paladin 25% bonus exp
knight+paladin+sorcerer 37.5% bonus exp
knight+paladin+sorcerer+druid 50.0% bonus exp

I'm using 0.4 sources (3777)
 
Last edited:
First remove bonus things from that getexperience in player.cpp

And you might need to put that bit of code inside creature.cpp.

I was worng? Don't need change nothing in players.cpp and players.h?
All is in creature.cpp and creature.h?

I put down my backup 3777 (player.cpp/player.h)

And edit creature.cpp / creature.h

Got few erros when compile:
Code:
t.Tpo -c -o chat.o chat.cpp
In file included from player.h:23:0,
  from party.h:20,
  from chat.h:24,
  from chat.cpp:18:
creature.h: In member function ‘virtual double Creature::getGainedExperience(Creature*)’:
creature.h:357:25: error: invalid use of incomplete type ‘class Player’
  bonus = player->getPartyBonus();
  ^
In file included from player.h:23:0,
  from house.h:27,
  from beds.cpp:20:
creature.h: In member function ‘virtual double Creature::getGainedExperience(Creature*)’:
creature.h:357:25: error: invalid use of incomplete type ‘class Player’
  bonus = player->getPartyBonus();
  ^
In file included from player.h:23:0,
  from actions.cpp:23:
creature.h: In member function ‘virtual double Creature::getGainedExperience(Creature*)’:
creature.h:357:25: error: invalid use of incomplete type ‘class Player’
  bonus = player->getPartyBonus();
  ^
In file included from baseevents.h:22:0,
  from raids.h:26,
  from item.h:29,
  from tile.h:23,
  from map.h:26,
  from creature.h:28,
  from player.h:23,
  from party.h:20,
  from chat.h:24,
  from chat.cpp:18:
luascript.h:72:7: note: forward declaration of ‘class Player’
 class Player;
  ^
In file included from baseevents.h:22:0,
  from actions.h:20,
  from actions.cpp:20:
luascript.h:72:7: note: forward declaration of ‘class Player’
 class Player;
  ^
In file included from baseevents.h:22:0,
  from raids.h:26,
  from item.h:29,
  from beds.h:20,
  from beds.cpp:19:
luascript.h:72:7: note: forward declaration of ‘class Player’
 class Player;
  ^
Makefile:546: recipe for target 'actions.o' failed
make[1]: *** [actions.o] Error 1
make[1]: ** Esperando que outros processos terminem.
Makefile:546: recipe for target 'beds.o' failed
make[1]: *** [beds.o] Error 1
Makefile:546: recipe for target 'chat.o' failed
make[1]: *** [chat.o] Error 1
make[1]: Leaving directory '/home/ubuntu/Documentos/server/3777/src'
Makefile:403: recipe for target 'all' failed
make: *** [all] Error 2
ubuntu@ubuntu-DC8CU41:~/Documentos/server/3777/src$

creature.cpp (edit lines: 1558 to 1583)
http://pastebin.com/3jbYDnXw

creature.h (edit lines: 352 to 360)
http://pastebin.com/QkzRpvFf
 
I was worng? Don't need change nothing in players.cpp and players.h?
All is in creature.cpp and creature.h?

I put down my backup 3777 (player.cpp/player.h)

And edit creature.cpp / creature.h

Got few erros when compile:
Code:
t.Tpo -c -o chat.o chat.cpp
In file included from player.h:23:0,
  from party.h:20,
  from chat.h:24,
  from chat.cpp:18:
creature.h: In member function ‘virtual double Creature::getGainedExperience(Creature*)’:
creature.h:357:25: error: invalid use of incomplete type ‘class Player’
  bonus = player->getPartyBonus();
  ^
In file included from player.h:23:0,
  from house.h:27,
  from beds.cpp:20:
creature.h: In member function ‘virtual double Creature::getGainedExperience(Creature*)’:
creature.h:357:25: error: invalid use of incomplete type ‘class Player’
  bonus = player->getPartyBonus();
  ^
In file included from player.h:23:0,
  from actions.cpp:23:
creature.h: In member function ‘virtual double Creature::getGainedExperience(Creature*)’:
creature.h:357:25: error: invalid use of incomplete type ‘class Player’
  bonus = player->getPartyBonus();
  ^
In file included from baseevents.h:22:0,
  from raids.h:26,
  from item.h:29,
  from tile.h:23,
  from map.h:26,
  from creature.h:28,
  from player.h:23,
  from party.h:20,
  from chat.h:24,
  from chat.cpp:18:
luascript.h:72:7: note: forward declaration of ‘class Player’
class Player;
  ^
In file included from baseevents.h:22:0,
  from actions.h:20,
  from actions.cpp:20:
luascript.h:72:7: note: forward declaration of ‘class Player’
class Player;
  ^
In file included from baseevents.h:22:0,
  from raids.h:26,
  from item.h:29,
  from beds.h:20,
  from beds.cpp:19:
luascript.h:72:7: note: forward declaration of ‘class Player’
class Player;
  ^
Makefile:546: recipe for target 'actions.o' failed
make[1]: *** [actions.o] Error 1
make[1]: ** Esperando que outros processos terminem.
Makefile:546: recipe for target 'beds.o' failed
make[1]: *** [beds.o] Error 1
Makefile:546: recipe for target 'chat.o' failed
make[1]: *** [chat.o] Error 1
make[1]: Leaving directory '/home/ubuntu/Documentos/server/3777/src'
Makefile:403: recipe for target 'all' failed
make: *** [all] Error 2
ubuntu@ubuntu-DC8CU41:~/Documentos/server/3777/src$

creature.cpp (edit lines: 1558 to 1583)
http://pastebin.com/3jbYDnXw

creature.h (edit lines: 352 to 360)
http://pastebin.com/QkzRpvFf
You were not wrong about those things... you were wrong becuase you edited
double Player::getGainedExperience(Creature* attacker) const

and you shouldn't edit this function only

virtual double getGainedExperience(Creature* attacker) {

Those player functions should be in player.cpp and player.h...
 
player.cpp:
Code:
uint32_t Player::getBaseVoc() {
    uint32_t curVoc = vocation_id;
    Vocation* voc = Vocations::getInstance()->getVocation(curVoc);
    while(voc->getFromVocation() != curVoc) {
        curVoc = voc->getFromVocation();
        voc = Vocations::getInstance()->getVocation(curVoc);
    }
    return curVoc;
}

double Player::getPartyBonus() {
    double bonus = 1;
    bool vocations[10];
    if(Party* party = this->getParty()) {
        PlayerVector list = party->getMembers();
        list.push_back(party->getLeader());
        for(PlayerVector::const_iterator it = list.begin(); it != list.end(); ++it) {
            uint32_t vocId = (*it)->getBaseVoc();
            if(!vocations[vocId]) {
                vocations[vocId] = true;
                bonus += 0.125;
            }
        }
    }
    return bonus;
}

player.h:
Code:
uint32_t getBaseVoc();
double getPartyBonus();

creature.h:
Code:
    virtual double getGainedExperience(Creature* attacker);

creature.cpp:
Code:
double Creature::getGainedExperience(Creature* attacker) {
            double bonus = 1;
            if(Player* player = attacker->getPlayer()) {
                bonus = player->getPartyBonus();
            }
            return getDamageRatio(attacker) * (double)getLostExperience() * bonus;
        }

And do not change anything else.
 
Last edited:
Got some errors too :(

Errors
Code:
used-parameter -Wno-array-bounds -pthread -pipe -MT creature.o -MD -MP -MF .deps/creature.Tpo -c -o creature.o creature.cpp
In file included from creature.cpp:20:0:
player.h: In function ‘double getGainedExperience(Creature*)’:
player.h:1124:10: error: ‘double Player::getPartyBonus()’ is protected
  double getPartyBonus();
  ^
creature.cpp:1107:39: error: within this context
  bonus = player->getPartyBonus();
  ^
creature.cpp:1109:35: error: ‘getDamageRatio’ was not declared in this scope
  return getDamageRatio(attacker) * (double)getLostExperience() * bonus;
  ^
creature.cpp:1109:65: error: ‘getLostExperience’ was not declared in this scope
  return getDamageRatio(attacker) * (double)getLostExperience() * bonus;
  ^
Makefile:546: recipe for target 'creature.o' failed
make[1]: *** [creature.o] Error 1
make[1]: ** Esperando que outros processos terminem.
mv -f .deps/container.Tpo .deps/container.Po
mv -f .deps/connection.Tpo .deps/connection.Po
make[1]: Leaving directory '/home/ubuntu/Documentos/server/3777/src'
Makefile:403: recipe for target 'all' failed
make: *** [all] Error 2
ubuntu@ubuntu-DC8CU41:~/Documentos/server/3777/src$

player.cpp (line: 4404 to 4430)
http://pastebin.com/0ZjXU2iM

creature.cpp (line 1103 to 1111)
http://pastebin.com/WM3bmYw6

creature.h (line 552)
http://notepad.cc/noifapo17

player.h (line 1122 to 1125)
http://notepad.cc/sulairo25


I've coment start to:
// bonus 4 vocation party
and end to //
 
Got some errors too :(

Errors
Code:
used-parameter -Wno-array-bounds -pthread -pipe -MT creature.o -MD -MP -MF .deps/creature.Tpo -c -o creature.o creature.cpp
In file included from creature.cpp:20:0:
player.h: In function ‘double getGainedExperience(Creature*)’:
player.h:1124:10: error: ‘double Player::getPartyBonus()’ is protected
  double getPartyBonus();
  ^
creature.cpp:1107:39: error: within this context
  bonus = player->getPartyBonus();
  ^
creature.cpp:1109:35: error: ‘getDamageRatio’ was not declared in this scope
  return getDamageRatio(attacker) * (double)getLostExperience() * bonus;
  ^
creature.cpp:1109:65: error: ‘getLostExperience’ was not declared in this scope
  return getDamageRatio(attacker) * (double)getLostExperience() * bonus;
  ^
Makefile:546: recipe for target 'creature.o' failed
make[1]: *** [creature.o] Error 1
make[1]: ** Esperando que outros processos terminem.
mv -f .deps/container.Tpo .deps/container.Po
mv -f .deps/connection.Tpo .deps/connection.Po
make[1]: Leaving directory '/home/ubuntu/Documentos/server/3777/src'
Makefile:403: recipe for target 'all' failed
make: *** [all] Error 2
ubuntu@ubuntu-DC8CU41:~/Documentos/server/3777/src$

player.cpp (line: 4404 to 4430)
http://pastebin.com/0ZjXU2iM

creature.cpp (line 1103 to 1111)
http://pastebin.com/WM3bmYw6

creature.h (line 552)
http://notepad.cc/noifapo17

player.h (line 1122 to 1125)
http://notepad.cc/sulairo25


I've coment start to:
// bonus 4 vocation party
and end to //
1) You shouldn't place ANY definition that I told you to put in protected places in the classes, they should be under public.
2) You have 2 "getGainedExperience" in creature.h... you were suposed to REPLACE the old one with what i sent you.

3) Should be "double Creature::getGainedExperience(Creature* attacker) {" on creature.cpp my bad.
 
1) You shouldn't place ANY definition that I told you to put in protected places in the classes, they should be under public.
2) You have 2 "getGainedExperience" in creature.h... you were suposed to REPLACE the old one with what i sent you.

3) Should be "double Creature::getGainedExperience(Creature* attacker) {" on creature.cpp my bad.

I'm sorry, im a idiot

But now i made right? Right?

Code:
used-parameter -Wno-array-bounds -pthread -pipe -MT creature.o -MD -MP -MF .deps/creature.Tpo -c -o creature.o creature.cpp
creature.cpp: In function ‘double getGainedExperience(Creature*)’:
creature.cpp:1109:35: error: ‘getDamageRatio’ was not declared in this scope
  return getDamageRatio(attacker) * (double)getLostExperience() * bonus;
  ^
creature.cpp:1109:65: error: ‘getLostExperience’ was not declared in this scope
  return getDamageRatio(attacker) * (double)getLostExperience() * bonus;
  ^
Makefile:546: recipe for target 'creature.o' failed
make[1]: *** [creature.o] Error 1
make[1]: ** Esperando que outros processos terminem.
mv -f .deps/container.Tpo .deps/container.Po
mv -f .deps/connection.Tpo .deps/connection.Po
make[1]: Leaving directory '/home/ubuntu/Documentos/server/3777/src'
Makefile:403: recipe for target 'all' failed
make: *** [all] Error 2

player.cpp
http://notepad.cc/cezbeni68

creature.cpp
http://notepad.cc/zbapegra14

creature.h
http://notepad.cc/noifapo17

player.h
http://notepad.cc/sulairo25
 
I'm sorry, im a idiot

But now i made right? Right?

Code:
used-parameter -Wno-array-bounds -pthread -pipe -MT creature.o -MD -MP -MF .deps/creature.Tpo -c -o creature.o creature.cpp
creature.cpp: In function ‘double getGainedExperience(Creature*)’:
creature.cpp:1109:35: error: ‘getDamageRatio’ was not declared in this scope
  return getDamageRatio(attacker) * (double)getLostExperience() * bonus;
  ^
creature.cpp:1109:65: error: ‘getLostExperience’ was not declared in this scope
  return getDamageRatio(attacker) * (double)getLostExperience() * bonus;
  ^
Makefile:546: recipe for target 'creature.o' failed
make[1]: *** [creature.o] Error 1
make[1]: ** Esperando que outros processos terminem.
mv -f .deps/container.Tpo .deps/container.Po
mv -f .deps/connection.Tpo .deps/connection.Po
make[1]: Leaving directory '/home/ubuntu/Documentos/server/3777/src'
Makefile:403: recipe for target 'all' failed
make: *** [all] Error 2

player.cpp
http://notepad.cc/cezbeni68

creature.cpp
http://notepad.cc/zbapegra14

creature.h
http://notepad.cc/noifapo17

player.h
http://notepad.cc/sulairo25
3) Should be "double Creature::getGainedExperience(Creature* attacker) {" on creature.cpp my bad.
 

OH MY GOD ITS WORK! TY <333
U GUYS CAN USE ITS WORKING!!!!

8.60 , 9.10 feature... SO NICE

---

Edit: I found a bug, but i think i know how to fix
Bonus work if players are so far, and if player has only invited (not joined the party)

Is possible check if party is shared exp? I think is solve everything and be better
Code:
double Player::getPartyBonus() {
  double bonus = 1;
  bool vocations[10];
  if(Party* party = this->getParty()) {
  PlayerVector list = party->getMembers();
  list.push_back(party->getLeader());
  for(PlayerVector::const_iterator it = list.begin(); it != list.end(); ++it) {
  uint32_t vocId = (*it)->getBaseVoc();
  if(!vocations[vocId]) {
     if(partysharedexp mode ON)
     {
    vocations[vocId] = true;
    bonus += 0.125;
    }
  }
  }
  }
  return bonus;
}
 
Code:
double Player::getPartyBonus() {
    double bonus = 1;
    bool vocations[] = {false, false, false, false, false, false, false, false};
    if((Party* party = getParty())) {
        if(party->isSharedExperienceEnabled() && party->isSharedExperienceActive()) {
            PlayerVector list = party->getMembers();
            list.push_back(party->getLeader());
            for(PlayerVector::const_iterator it = list.begin(); it != list.end(); ++it) {
                uint32_t vocId = (*it)->getBaseVoc();
                if(!vocations[vocId]) {
                    vocations[vocId] = true;
                    bonus += 0.125;
                    }
            }
        }
    }
    return bonus;
}
 
Last edited:
You should change:
Code:
bool vocations[10];

To:
Code:
bool vocations[] = {false, false, false, false, false, false, false, false};

For safety.
 
Ty bro ur the best :D

---

ops edit:
some errors:
Code:
player.cpp: In member function ‘double Player::getPartyBonus()’:
player.cpp:4417:110: error: cannot convert ‘bool’ to ‘Party*’ in initialization
  if(Party* party = this->getParty() && party->isSharedExperienceEnabled() && party->isSharedExperienceActive()) {
  ^
Makefile:546: recipe for target 'player.o' failed
make[1]: *** [player.o] Error 1
make[1]: ** Esperando que outros processos terminem.
protocolgame.cpp: In member function ‘void ProtocolGame::AddCreatureSpeak(NetworkMessage_ptr, const Creature*, SpeakClasses, std::__cxx11::string, uint16_t, uint32_t, Position*, ProtocolGame*)’:
protocolgame.cpp:2962:158: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
 if(speaker && type != SPEAK_RVR_ANSWER && !speaker->isAccountManager() && !speaker->hasCustomFlag(PlayerCustomFlag_HideLevel) && (pg == NULL || pg != NULL && !pg->get
  ^
mv -f .deps/protocollogin.Tpo .deps/protocollogin.Po
mv -f .deps/protocolgame.Tpo .deps/protocolgame.Po
make[1]: Leaving directory '/home/ubuntu/Documentos/server/3777/src'
Makefile:403: recipe for target 'all' failed
make: *** [all] Error 2
ubuntu@ubuntu-DC8CU41:~/Documentos/server/3777/src$
 
change
Code:
if((Party* party = this->getParty()) && party->isSharedExperienceEnabled() && party->isSharedExperienceActive()) {

to
Code:
if(getParty() && getParty()->isSharedExperienceEnabled() && getParty()->isSharedExperienceActive()) {
 
Ty bro ur the best :D

---

ops edit:
some errors:
Code:
player.cpp: In member function ‘double Player::getPartyBonus()’:
player.cpp:4417:110: error: cannot convert ‘bool’ to ‘Party*’ in initialization
  if(Party* party = this->getParty() && party->isSharedExperienceEnabled() && party->isSharedExperienceActive()) {
  ^
Makefile:546: recipe for target 'player.o' failed
make[1]: *** [player.o] Error 1
make[1]: ** Esperando que outros processos terminem.
protocolgame.cpp: In member function ‘void ProtocolGame::AddCreatureSpeak(NetworkMessage_ptr, const Creature*, SpeakClasses, std::__cxx11::string, uint16_t, uint32_t, Position*, ProtocolGame*)’:
protocolgame.cpp:2962:158: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
if(speaker && type != SPEAK_RVR_ANSWER && !speaker->isAccountManager() && !speaker->hasCustomFlag(PlayerCustomFlag_HideLevel) && (pg == NULL || pg != NULL && !pg->get
  ^
mv -f .deps/protocollogin.Tpo .deps/protocollogin.Po
mv -f .deps/protocolgame.Tpo .deps/protocolgame.Po
make[1]: Leaving directory '/home/ubuntu/Documentos/server/3777/src'
Makefile:403: recipe for target 'all' failed
make: *** [all] Error 2
ubuntu@ubuntu-DC8CU41:~/Documentos/server/3777/src$
I posted "if((Party* party = this->getParty()) && party->isSharedExperienceEnabled() && party->isSharedExperienceActive()) {"
and your error is: " if(Party* party = this->getParty() && party->isSharedExperienceEnabled() && party->isSharedExperienceActive()) {"
I was in the cellphone and couldn't do it properly here it is now:
Code:
double Player::getPartyBonus() {
    double bonus = 1;
    bool vocations[] = {false, false, false, false, false, false, false, false};
    if((Party* party = getParty())) {
        if(party->isSharedExperienceEnabled() && party->isSharedExperienceActive()) {
            PlayerVector list = party->getMembers();
            list.push_back(party->getLeader());
            for(PlayerVector::const_iterator it = list.begin(); it != list.end(); ++it) {
                uint32_t vocId = (*it)->getBaseVoc();
                if(!vocations[vocId]) {
                    vocations[vocId] = true;
                    bonus += 0.125;
                    }
            }
        }
    }
    return bonus;
}
 
Last edited:
Code:
player.cpp: In member function ‘double Player::getPartyBonus()’:
player.cpp:4417:14: error: expected primary-expression before ‘*’ token
  if((Party* party = getParty()) {
  ^
player.cpp:4417:36: error: expected ‘)’ before ‘{’ token
  if((Party* party = getParty()) {
  ^
player.cpp:4430:17: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
  return bonus;
  ^
player.cpp:4415:12: warning: unused variable ‘bonus’ [-Wunused-variable]
  double bonus = 1;
  ^
player.cpp:4416:10: warning: unused variable ‘vocations’ [-Wunused-variable]
  bool vocations[] = {false, false, false, false, false, false, false, false}
  ^
player.cpp:4431:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
Makefile:546: recipe for target 'player.o' failed
make[1]: *** [player.o] Error
 
Code:
player.cpp: In member function ‘double Player::getPartyBonus()’:
player.cpp:4417:14: error: expected primary-expression before ‘*’ token
  if((Party* party = getParty()) {
  ^
player.cpp:4417:36: error: expected ‘)’ before ‘{’ token
  if((Party* party = getParty()) {
  ^
player.cpp:4430:17: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
  return bonus;
  ^
player.cpp:4415:12: warning: unused variable ‘bonus’ [-Wunused-variable]
  double bonus = 1;
  ^
player.cpp:4416:10: warning: unused variable ‘vocations’ [-Wunused-variable]
  bool vocations[] = {false, false, false, false, false, false, false, false}
  ^
player.cpp:4431:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
Makefile:546: recipe for target 'player.o' failed
make[1]: *** [player.o] Error
Missed 1 ")" try again :/
 
Missed 1 ")" try again :/

Code:
player.cpp: In member function ‘double Player::getPartyBonus()’:
player.cpp:4417:14: error: expected primary-expression before ‘*’ token
  if((Party* party = getParty())) {
  ^
Makefile:546: recipe for target 'player.o' failed
make[1]: *** [player.o] Error 1
make[1]: ** Esperando que outros processos terminem.
mv -f .deps/spawn.Tpo .deps/spawn.Po
mv -f .deps/server.Tpo .deps/server.Po
make[1]: Leaving directory '/home/ubuntu/Documentos/server/3777/src'
Makefile:403: recipe for target 'all' failed
make: *** [all] Error 2
ubuntu@ubuntu-DC8CU41:~/Documentos/server/3777/src$
 
Code:
player.cpp: In member function ‘double Player::getPartyBonus()’:
player.cpp:4417:14: error: expected primary-expression before ‘*’ token
  if((Party* party = getParty())) {
  ^
Makefile:546: recipe for target 'player.o' failed
make[1]: *** [player.o] Error 1
make[1]: ** Esperando que outros processos terminem.
mv -f .deps/spawn.Tpo .deps/spawn.Po
mv -f .deps/server.Tpo .deps/server.Po
make[1]: Leaving directory '/home/ubuntu/Documentos/server/3777/src'
Makefile:403: recipe for target 'all' failed
make: *** [all] Error 2
ubuntu@ubuntu-DC8CU41:~/Documentos/server/3777/src$
Weird :confused:

Code:
double Player::getPartyBonus() {
    double bonus = 1;
    bool vocations[] = {false, false, false, false, false, false, false, false};
    if(Party* party = this->getParty()) {
        if(party->isSharedExperienceEnabled() && party->isSharedExperienceActive()) {
            PlayerVector list = party->getMembers();
            list.push_back(party->getLeader());
            for(PlayerVector::const_iterator it = list.begin(); it != list.end(); ++it) {
                uint32_t vocId = (*it)->getBaseVoc();
                if(!vocations[vocId]) {
                    vocations[vocId] = true;
                    bonus += 0.125;
                    }
            }
        }
    }
    return bonus;
}
 
Weird :confused:

Code:
double Player::getPartyBonus() {
    double bonus = 1;
    bool vocations[] = {false, false, false, false, false, false, false, false};
    if(Party* party = this->getParty()) {
        if(party->isSharedExperienceEnabled() && party->isSharedExperienceActive()) {
            PlayerVector list = party->getMembers();
            list.push_back(party->getLeader());
            for(PlayerVector::const_iterator it = list.begin(); it != list.end(); ++it) {
                uint32_t vocId = (*it)->getBaseVoc();
                if(!vocations[vocId]) {
                    vocations[vocId] = true;
                    bonus += 0.125;
                    }
            }
        }
    }
    return bonus;
}


Work perfect you all can use, ty so much Mkalo!!!!


---

Just one last thing...
In my player.cpp when i compile show me this warning error... What is it? You know to fix?

Code:
ps/talkaction.Tpo -c -o talkaction.o talkaction.cpp
player.cpp: In member function ‘void Player::manageAccount(const string&)’:
player.cpp:4876:27: warning: iteration 11u invokes undefined behavior [-Waggressive-loop-optimizations]
  talkState[i] = false;
  ^
player.cpp:4875:26: note: containing loop
  for(int8_t i = 2; i <= 14; i++)
  ^
mv -f .deps/spells.Tpo .deps/spells.Po

http://pastebin.com/Cjt6BSWr
 
Work perfect you all can use, ty so much Mkalo!!!!


---

Just one last thing...
In my player.cpp when i compile show me this warning error... What is it? You know to fix?

Code:
ps/talkaction.Tpo -c -o talkaction.o talkaction.cpp
player.cpp: In member function ‘void Player::manageAccount(const string&)’:
player.cpp:4876:27: warning: iteration 11u invokes undefined behavior [-Waggressive-loop-optimizations]
  talkState[i] = false;
  ^
player.cpp:4875:26: note: containing loop
  for(int8_t i = 2; i <= 14; i++)
  ^
mv -f .deps/spells.Tpo .deps/spells.Po

http://pastebin.com/Cjt6BSWr
I have no idea what is causing this but you can replace those 2 lines:
Code:
for(int8_t i = 2; i <= 14; i++)
    talkState[i] = false;

With:

Code:
memset(talkState + 2, 0, 13);

The error is in your player.h: "bool talkState[13];"
You would only be able to index to talkState[12] and the code is trying to index until [14]

Change it to "bool talkState[15];"
 
Last edited:
Back
Top