Ir para conteúdo
Fórum Script Brasil
  • 0

Dev-c++


New

Pergunta

Por Favor sou novo aqui no Forum e preciso de uma ajuda,

tenho q adiciona alguns codes em umas sources, mas sempre da varios erros

então queria saber c alguém adicona os codes pra eu, por favor,

esse codes são de um jogo chamado OpenTibiaServer, o code server pra

adiciona skull nos players segue o code abaixo c alguém puder me ajuda eu agradeço muito biggrin.gif ,

Game.cpp in the checkplayer function under if(player){
[code]         std::vector<Creature*> list;
        getSpectators(Range(player->pos), list);
        if(player->unjustkills >= 3 && player->skullred == 0){
        player->skullred++;
        }
        if(player->skullwhite >= 1 && player->inFightTicks > 6000)
        {
        for(int i = 0; i < list.size(); ++i){     
        Player* hond = dynamic_cast<Player*>(list[i]);   
        if(hond){
        hond->onSkull(player, 3);}}}
        else if(player->inFightTicks <= 6000){
        if(player->skullwhite >= 1){
        player->skullwhite -= player->skullwhite;
        for(int i = 0; i < list.size(); ++i){     
        Player* hond = dynamic_cast<Player*>(list[i]);   
        if(hond){
        hond->onSkull(player, 0);}}
        }}
        if(player->skullred == 1){
        for(int i = 0; i < list.size(); ++i){     
        Player* hond = dynamic_cast<Player*>(list[i]); 
        if(hond){
        hond->onSkull(player, 4);
        }}}
under if (attackedCreature->health <= 0) { above the exp code
      //add unjustified kill
       if(player && attackedPlayer &&(attackedPlayer->skullwhite == 0 || attackedPlayer->skullred == 0))
       {
       NetworkMessage ServerSay;
       std::stringstream bericht; 
       bericht<<"Warning! The murder of "<< attackedPlayer->getName() <<" was not justified.";
       NetworkMessage msg;
       msg.AddTextMessage(MSG_SERVERSAY, bericht.str().c_str());
       player->sendNetworkMessage(&msg);
       player->unjustkills++;
       } 
under player->sendIcons(); if(attackedPlayer)
  if (player && player->skullred == 0 && player->skullwhite == 0 &&(attackedPlayer->skullwhite == 0 || attackedPlayer->skullred == 0))
       {
       player->skullwhite++;
       } 
under if(target->health <= 0) {
     //add unjustified kill
           if(player &&(targetPlayer->skullwhite == 0 || targetPlayer->skullred == 0))
           {
           NetworkMessage ServerSay;
           std::stringstream bericht; 
           bericht<<"Warning! The murder of"<< targetPlayer->getName() <<"was not justified.";
           NetworkMessage msg;
           msg.AddTextMessage(MSG_SERVERSAY, bericht.str().c_str());
           player->sendNetworkMessage(&msg);
           player->unjustkills++;
           }  
above if(damage != 0) { creatureApplyDamage(target, damage, damage, manaDamage);
  if (player && player->skullred == 0 && player->skullwhite == 0 &&(targetPlayer->skullwhite == 0 || targetPlayer->skullred == 0))
               {
               player->skullwhite++;
               } 
player.cpp (the places should be obvious)
skullwhite = 0;
 skullred = 0;
 unjustkills= 0; 
void Player::onSkull(Player* player, int type)
{
client->sendSkull(player,type);
} 
 pn = xmlNewNode(NULL,(const xmlChar*)"skull");
   sb << skullwhite; xmlSetProp(pn, (const xmlChar*) "white", (const xmlChar*)sb.str().c_str()); sb.str("");
   sb << skullred; xmlSetProp(pn, (const xmlChar*) "red", (const xmlChar*)sb.str().c_str()); sb.str("");
   sb << unjustkills; xmlSetProp(pn, (const xmlChar*) "unjustkills", (const xmlChar*)sb.str().c_str()); sb.str("");
   xmlAddChild(root, pn); 
player.h in public
int skullwhite, skullred, unjustkills;    
void onSkull(Player* player, int type); 
ioplayerxml.cpp
else if(str=="skull")
{
player->skullwhite=atoi((const char*)xmlGetProp(p, (const xmlChar *) "white"));
player->skullred=atoi((const char*)xmlGetProp(p, (const xmlChar *) "red"));
player->unjustkills=atoi((const char*)xmlGetProp(p, (const xmlChar *) "unjustkills"));
} 
protocol74.cpp
void Protocol74::sendSkull(const Creature *creature, int type){
NetworkMessage newmsg;
newmsg.AddByte(0x90);
newmsg.AddU32(creature->getID());
if(type == 0){
newmsg.AddByte(0x00); // remove skull
}else if(type == 1){ 
newmsg.AddByte(0x01); // yellow skull
}else if(type == 2){
newmsg.AddByte(0x02); // green skull
}else if(type == 3){
newmsg.AddByte(0x03); // white skull
}else if(type == 4){
newmsg.AddByte(0x04); // red skull
}
newmsg.WriteToSocket(s);
}  
protocol74.h
virtual void sendSkull(const Creature *creature, int type); 
protocol.h
virtual void sendSkull(const Creature *creature, int type) = 0; 

OBS: se alguém quiser me ajudar eu passo o coloka as sources q eu uso em um Host pra download

Link para o comentário
Compartilhar em outros sites

5 respostass a esta questão

Posts Recomendados

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,2k
    • Posts
      652k
×
×
  • Criar Novo...