Jump to content
Fórum Script Brasil
  • 0

Dev-c++


New

Question

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 to comment
Share on other sites

5 answers to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      651.8k
×
×
  • Create New...