DE
programação

Nao Ta Aparecendo PVP PAra o Ot Todo Guando Mata Um pk

Por deivisonamorim, 07 de nov. de 2015 em Programação

ajuda player.cpp
11
1.9k
07 de novembro de 2015 às 20:33
To com uma poblema q e o Seguinte o player nao ta pegando yellow quando ataka um PK e nao ta aparecendo pvp para o server todo guando mata um PK so aparece guando O player q pegou pk mata podem me ajuda ..? aki esta o codigo




#ifdef __SKULLSYSTEM__

Skulls_t Player::getSkull() const

{

if(getAccessLevel() >= ACCESS_PROTECT)

return SKULL_NONE;


return skull;

}


Skulls_t Player::getSkullClient(const Player* player) const

{

if(!player){

return SKULL_NONE;

}


Skulls_t skull;

skull = player->getSkull();


#ifdef __PARTYSYSTEM__

if(skull != SKULL_RED && player->party != NULL && player->party == this->party)

return SKULL_GREEN;

#endif


if(skull == SKULL_NONE){

if(player->hasAttacked(this)){

skull = SKULL_YELLOW;

}

}


return skull;

}


bool Player::hasAttacked(const Player* attacked) const

{

if(accessLevel >= ACCESS_PROTECT)

return false;


if(!attacked)

return false;


AttackedSet::const_iterator it;

unsigned long attacked_id = attacked->getID();

it = attackedSet.find(attacked_id);

if(it != attackedSet.end()){

return true;

}

else{

return false;

}

}


void Player::addAttacked(const Player* attacked)

{

if(accessLevel >= ACCESS_PROTECT)

return;


if(!attacked || attacked == this)

return;

AttackedSet::iterator it;

unsigned long attacked_id = attacked->getID();

it = attackedSet.find(attacked_id);

if(it == attackedSet.end()){

attackedSet.insert(attacked_id);

}

}


void Player::clearAttacked()

{

attackedSet.clear();

}


void Player::addUnjustifiedDead(const Player* attacked)

{

if(getAccessLevel() >= ACCESS_PROTECT || attacked == this)

return;


std::stringstream msg;

msg << "PvP: " << getName() << " (Level: " << getLevel() << ") Matou " << attacked->getName() << " (Level:" << attacked->getLevel() << ").";

g_game.addAnimatedText(this->getPosition(), 129, "Drink!");

for(AutoList<Player>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it){

if(dynamic_cast<Player*>(it->second))

(*it).second->sendTextMessage(MSG_STATUS_CONSOLE_BLUE, msg.str().c_str());

}

2 semanas depois...
16 de novembro de 2015 às 17:41

@up

TaaGT
16 de novembro de 2015 às 17:51

Tente agora:

 

#ifdef __SKULLSYSTEM__
Skulls_t Player::getSkull() const
{
if(getAccessLevel() >= ACCESS_PROTECT)
return SKULL_NONE;


return skull;
}


Skulls_t Player::getSkullClient(const Player* player) const
{
if(!player){
return SKULL_NONE;
}


Skulls_t skull;
skull = player->getSkull();


#ifdef __PARTYSYSTEM__
if(skull != SKULL_RED && player->party != NULL && player->party == this->party)
return SKULL_GREEN;
#endif


if(skull == SKULL_NONE){
if(player->hasAttacked(this)){
skull = SKULL_YELLOW;
}
}


return skull;
}


bool Player::hasAttacked(const Player* attacked) const
{
if(accessLevel >= ACCESS_PROTECT)
return true;


if(!attacked)
return true;


AttackedSet::const_iterator it;
unsigned long attacked_id = attacked->getID();
it = attackedSet.find(attacked_id);
if(it != attackedSet.end()){
return true;
}
else{
return false;
}
}


void Player::addAttacked(const Player* attacked)
{
if(accessLevel >= ACCESS_PROTECT)
return;


if(!attacked || attacked == this)
return;
AttackedSet::iterator it;
unsigned long attacked_id = attacked->getID();
it = attackedSet.find(attacked_id);
if(it == attackedSet.end()){
attackedSet.insert(attacked_id);
}
}


void Player::clearAttacked()
{
attackedSet.clear();
}


void Player::addUnjustifiedDead(const Player* attacked)
{
if(getAccessLevel() >= ACCESS_PROTECT || attacked == this)
return;


std::stringstream msg;
        msg << "PvP: " << getName() << " (Level: " << getLevel() << ") Matou " << attacked->getName() << " (Level:" << attacked->getLevel() << ").";
g_game.addAnimatedText(this->getPosition(), 129, "Drink!");
        for(AutoList<Player>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it){
                if(dynamic_cast<Player*>(it->second))
                        (*it).second->sendTextMessage(MSG_STATUS_CONSOLE_BLUE, msg.str().c_str());
        }

 

16 de novembro de 2015 às 18:44

nao deu continuo msm jeito

ShinySpriteS
16 de novembro de 2015 às 18:51
#ifdef __SKULLSYSTEM__
Skulls_t Player::getSkull() const
{
if(getAccessLevel() >= ACCESS_PROTECT)
return SKULL_NONE;


return skull;
}


Skulls_t Player::getSkullClient(const Player* player) const
{
if(!player){
return SKULL_NONE;
}


Skulls_t skull;
skull = player->getSkull();


#ifdef __PARTYSYSTEM__
if(skull != SKULL_RED && player->party != NULL && player->party == this->party)
return SKULL_GREEN;
#endif


if(skull == SKULL_NONE){
if(player->hasAttacked(this)){
skull = SKULL_YELLOW;
}
}


return skull;
}


bool Player::hasAttacked(const Player* attacked) const
{
if(accessLevel >= ACCESS_PROTECT)
return true;


if(!attacked)
return true;


AttackedSet::const_iterator it;
unsigned long attacked_id = attacked->getID();
it = attackedSet.find(attacked_id);
if(it != attackedSet.end()){
return true;
}
else{
return false;
}
}


void Player::addAttacked(const Player* attacked)
{
if(accessLevel >= ACCESS_PROTECT)
return;


if(!attacked || attacked == this)
return;
AttackedSet::iterator it;
unsigned long attacked_id = attacked->getID();
it = attackedSet.find(attacked_id);
if(it == attackedSet.end()){
attackedSet.insert(attacked_id);
}
}


void Player::clearAttacked()
{
attackedSet.clear();
}


void Player::addUnjustifiedDead(const Player* attacked)
{
if(getAccessLevel() >= ACCESS_PROTECT || attacked == this)
return;


doBroadcastMessage("PvP: " << getName() << " (Level: " << getLevel() << ") Matou " << attacked->getName() << " (Level:" << attacked->getLevel() << ")
        }

Tenta isso

16 de novembro de 2015 às 18:57

Tbm Nao Deu Deu Erro E nei Compilo

TaaGT
16 de novembro de 2015 às 19:06

Tente agora:

 

#ifdef __SKULLSYSTEM__
Skulls_t Player::getSkull() const
{
if(getAccessLevel() >= ACCESS_PROTECT)
return SKULL_NONE;




return skull;
}




Skulls_t Player::getSkullClient(const Player* player) const
{
if(!player){
return SKULL_NONE;
}




Skulls_t skull;
skull = player->getSkull();




#ifdef __PARTYSYSTEM__
if(skull != SKULL_RED && player->party != NULL && player->party == this->party)
return SKULL_GREEN;
#endif




if(skull == SKULL_NONE){
if(player->hasAttacked(this)){
skull = SKULL_YELLOW;
}
}




return skull;
}




bool Player::hasAttacked(const Player* attacked) const
{
if(accessLevel >= ACCESS_PROTECT)
return SKULL_YELLOW;




if(!attacked)
return SKULL_YELLOW;




AttackedSet::const_iterator it;
unsigned long attacked_id = attacked->getID();
it = attackedSet.find(attacked_id);
if(it != attackedSet.end()){
return true;
}
else{
return false;
}
}




void Player::addAttacked(const Player* attacked)
{
if(accessLevel >= ACCESS_PROTECT)
return;




if(!attacked || attacked == this)
return;
AttackedSet::iterator it;
unsigned long attacked_id = attacked->getID();
it = attackedSet.find(attacked_id);
if(it == attackedSet.end()){
attackedSet.insert(attacked_id);
}
}




void Player::clearAttacked()
{
attackedSet.clear();
}




void Player::addUnjustifiedDead(const Player* attacked)
{
if(getAccessLevel() >= ACCESS_PROTECT || attacked == this)
return;




std::stringstream msg;
        msg << "PvP: " << getName() << " (Level: " << getLevel() << ") Matou " << attacked->getName() << " (Level:" << attacked->getLevel() << ").";
g_game.addAnimatedText(this->getPosition(), 129, "Drink!");
        for(AutoList<Player>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it){
                if(dynamic_cast<Player*>(it->second))
                        (*it).second->sendTextMessage(MSG_STATUS_CONSOLE_BLUE, msg.str().c_str());
        }

Se continuar dando erro, me desculpe, não mexo com 7.91.

 

16 de novembro de 2015 às 19:29

e Nao deu So aparace guando player q pego PK mata guando mata o q ta pk n aparece

TaaGT
16 de novembro de 2015 às 19:55

Tente novamente:

 

#ifdef __SKULLSYSTEM__
Skulls_t Player::getSkull() const
{
if(getAccessLevel() >= ACCESS_PROTECT)
return SKULL_NONE;








return skull;
}








Skulls_t Player::getSkullClient(const Player* player) const
{
if(!player){
return SKULL_NONE;
}








Skulls_t skull;
skull = player->getSkull();








#ifdef __PARTYSYSTEM__
if(skull != SKULL_RED && player->party != NULL && player->party == this->party)
return SKULL_GREEN;
#endif








if(skull == SKULL_NONE){
if(player->hasAttacked(this)){
skull = SKULL_YELLOW;
}
}








return skull;
}








bool Player::hasAttacked(const Player* attacked) const
{
if(accessLevel >= ACCESS_PROTECT)
return SKULL_YELLOW;








if(!attacked)
return SKULL_YELLOW;








AttackedSet::const_iterator it;
unsigned long attacked_id = attacked->getID();
it = attackedSet.find(attacked_id);
if(it != attackedSet.end()){
return true;
}
else{
return SKULL_YELLOW;
}
}








void Player::addAttacked(const Player* attacked)
{
if(accessLevel >= ACCESS_PROTECT)
return;








if(!attacked || attacked == this)
return;
AttackedSet::iterator it;
unsigned long attacked_id = attacked->getID();
it = attackedSet.find(attacked_id);
if(it == attackedSet.end()){
attackedSet.insert(attacked_id);
}
}








void Player::clearAttacked()
{
attackedSet.clear();
}








void Player::addUnjustifiedDead(const Player* attacked)
{
if(getAccessLevel() >= ACCESS_PROTECT || attacked == this)
return;








std::stringstream msg;
        msg << "PvP: " << getName() << " (Level: " << getLevel() << ") Matou " << attacked->getName() << " (Level:" << attacked->getLevel() << ").";
g_game.addAnimatedText(this->getPosition(), 129, "Drink!");
        for(AutoList<Player>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it){
                if(dynamic_cast<Player*>(it->second))
                        (*it).second->sendTextMessage(MSG_STATUS_CONSOLE_BLUE, msg.str().c_str());
        }

 

16 de novembro de 2015 às 21:18

agr tudso player ta yellow e nao aparece pvp

20 de novembro de 2015 às 11:06

@up