Ir para conteúdo
  • Cadastre-se

(Resolvido)AJUDA MANA E HP %


Ir para solução Resolvido por KotZletY,

Posts Recomendados

Boa noite galerinha do tk

estou com um problema na hora de compilar minha mana e hp para colocar em %

olhei os topicos aqui e minha o meu protcolgame.cpp esta diferente dos daqui o meu e asim

 

void ProtocolGame::AddPlayerStats(OutputMessage_ptr msg)
{
    msg->addByte(0xA0);
    msg->add<uint16_t>(player->getHealth());
    msg->add<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXHEALTH));
    msg->add<uint32_t>(uint32_t(player->getFreeCapacity() * 100));
    uint64_t experience = player->getExperience();
    if(experience > 0x7FFFFFFF)
        msg->add<uint32_t>(0x7FFFFFFF);
    else
        msg->add<uint32_t>(experience);

    msg->add<uint16_t>(player->getPlayerInfo(PLAYERINFO_LEVEL));
    msg->addByte(player->getPlayerInfo(PLAYERINFO_LEVELPERCENT));
    msg->add<uint16_t>(player->getPlayerInfo(PLAYERINFO_MANA));
    msg->add<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXMANA));
    msg->addByte(player->getPlayerInfo(PLAYERINFO_MAGICLEVEL));
    msg->addByte(player->getPlayerInfo(PLAYERINFO_MAGICLEVELPERCENT));
    msg->addByte(player->getPlayerInfo(PLAYERINFO_SOUL));
    msg->add<uint16_t>(player->getStaminaMinutes());
}

 

 

e o topico que vi ta asim

 

protocolgame.cpp, procure por:

    msg->put<uint16_t>(player->getHealth());
    msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXHEALTH));

troque por:

    if (player->getPlayerInfo(PLAYERINFO_MAXHEALTH) > 0)
    {
        msg->put<uint16_t>(uint16_t(player->getHealth() * 100 / player->getPlayerInfo(PLAYERINFO_MAXHEALTH)));
        msg->put<uint16_t>(100);
    }
    else
    {
        msg->put<uint16_t>(0);
        msg->put<uint16_t>(0);  
    }

procure por:

    msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MANA));
    msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXMANA));

troque por:

    if (player->getPlayerInfo(PLAYERINFO_MAXMANA) > 0)
    {
        msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MANA) * 100 / player->getPlayerInfo(PLAYERINFO_MAXMANA));
        msg->put<uint16_t>(100);
    }
    else
    {
        msg->put<uint16_t>(0);
        msg->put<uint16_t>(0);
    }

 

ja tentei substituir so as funçoes que pede ae mas esta diferente e da erro na hora de compilar alguem ajuda?

Link para o post
Compartilhar em outros sites
6 minutos atrás, KotZletY disse:

@mullino e qual erro está dando ? O quê ocorre durante a compilação ?

entao o problema que nao consigo colocar as funçoes que esta para colocar porque comprei essa source ela e boa mas nao consigo colocar o hp e mana por porcentagem pq onde manda modificar e completamente diferente.. tentei ate 3 horas da madruga ontem e nao consegui

vou refazer aki e mandar o erro pra vcs 

 

olha a diferença

o meu ta asim

    msg->add<uint16_t>(player->getHealth());
    msg->add<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXHEALTH));

 

ja no que pedee pra modificar ta asim

 

 

    msg->put<uint16_t>(player->getHealth());
    msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXHEALTH));

 

 

ontem eu fiz asim

    if (player->getPlayerInfo(PLAYERINFO_MAXHEALTH) > 0)
    {
        msg->put<uint16_t>(uint16_t(player->getHealth() * 100 / player->getPlayerInfo(PLAYERINFO_MAXHEALTH)));
        msg->put<uint16_t>(100);
    }
    else
    {
        msg->put<uint16_t>(0);
        msg->put<uint16_t>(0);  
    }

 

troquei o put por add ficando asim

 

 

    if (player->getPlayerInfo(PLAYERINFO_MAXHEALTH) > 0)
    {
        msg->add<uint16_t>(uint16_t(player->getHealth() * 100 / player->getPlayerInfo(PLAYERINFO_MAXHEALTH)));
        msg->add<uint16_t>(100);
    }
    else
    {
        msg->add<uint16_t>(0);
        msg->add<uint16_t>(0);  
    }

fiz issu na mana tbm ate compilou mas na hora que eu entrava no ot com qualquer conta ate no account manangem tomava debug

5 minutos atrás, mullino disse:

entao o problema que nao consigo colocar as funçoes que esta para colocar porque comprei essa source ela e boa mas nao consigo colocar o hp e mana por porcentagem pq onde manda modificar e completamente diferente.. tentei ate 3 horas da madruga ontem e nao consegui

vou refazer aki e mandar o erro pra vcs 

 

olha a diferença

o meu ta asim

    msg->add<uint16_t>(player->getHealth());
    msg->add<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXHEALTH));

 

ja no que pedee pra modificar ta asim

 

 


    msg->put<uint16_t>(player->getHealth());
    msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXHEALTH));

 

 

ontem eu fiz asim


    if (player->getPlayerInfo(PLAYERINFO_MAXHEALTH) > 0)
    {
        msg->put<uint16_t>(uint16_t(player->getHealth() * 100 / player->getPlayerInfo(PLAYERINFO_MAXHEALTH)));
        msg->put<uint16_t>(100);
    }
    else
    {
        msg->put<uint16_t>(0);
        msg->put<uint16_t>(0);  
    }

 

troquei o put por add ficando asim

 

 


    if (player->getPlayerInfo(PLAYERINFO_MAXHEALTH) > 0)
    {
        msg->add<uint16_t>(uint16_t(player->getHealth() * 100 / player->getPlayerInfo(PLAYERINFO_MAXHEALTH)));
        msg->add<uint16_t>(100);
    }
    else
    {
        msg->add<uint16_t>(0);
        msg->add<uint16_t>(0);  
    }

fiz issu na mana tbm ate compilou mas na hora que eu entrava no ot com qualquer conta ate no account manangem tomava debug

@KotZletY

Editado por mullino (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • Solução

@mullino há sim lamento, tava ouvindo um áudio aqui e acabei não prestando atenção: 

Spoiler

void ProtocolGame::AddPlayerStats(OutputMessage_ptr msg)
{
    msg->addByte(0xA0);

    if (player->getPlayerInfo(PLAYERINFO_MAXHEALTH) > 0) {
        msg->add<uint16_t>((player->getHealth() * 100 / player->getPlayerInfo(PLAYERINFO_MAXHEALTH)));
        msg->add<uint16_t>(100);
    } else {
        msg->add<uint16_t>(0);
        msg->add<uint16_t>(0);
    }
 
    msg->add<uint32_t>(uint32_t(player->getFreeCapacity() * 100));
    uint64_t experience = player->getExperience();
    if(experience > 0x7FFFFFFF)
        msg->add<uint32_t>(0x7FFFFFFF);
    else
        msg->add<uint32_t>(experience);

    msg->add<uint16_t>(player->getPlayerInfo(PLAYERINFO_LEVEL));
    msg->addByte(player->getPlayerInfo(PLAYERINFO_LEVELPERCENT));

    if (player->getPlayerInfo(PLAYERINFO_MAXMANA) > 0) {
        msg->add<uint16_t>((player->getPlayerInfo(PLAYERINFO_MANA) * 100 / player->getPlayerInfo(PLAYERINFO_MAXMANA)));
        msg->add<uint16_t>(100);
    } else {
        msg->add<uint16_t>(0);
        msg->add<uint16_t>(0);
    }
	
    msg->addByte(player->getPlayerInfo(PLAYERINFO_MAGICLEVEL));
    msg->addByte(player->getPlayerInfo(PLAYERINFO_MAGICLEVELPERCENT));
    msg->addByte(player->getPlayerInfo(PLAYERINFO_SOUL));
    msg->add<uint16_t>(player->getStaminaMinutes());
}

 

 

                                                              ezgif-1-98aab239f3.gif.1a897c9c3225228909e7b356a5cfb8e4.gif

Link para o post
Compartilhar em outros sites
3 minutos atrás, KotZletY disse:

@mullino há sim lamento, tava ouvindo um áudio aqui e acabei não prestando atenção: 

  Ocultar conteúdo


void ProtocolGame::AddPlayerStats(OutputMessage_ptr msg)
{
    msg->addByte(0xA0);

    if (player->getPlayerInfo(PLAYERINFO_MAXHEALTH) > 0) {
        msg->add<uint16_t>((player->getHealth() * 100 / player->getPlayerInfo(PLAYERINFO_MAXHEALTH)));
        msg->add<uint16_t>(100);
    } else {
        msg->add<uint16_t>(0);
        msg->add<uint16_t>(0);
    }
 
    msg->add<uint32_t>(uint32_t(player->getFreeCapacity() * 100));
    uint64_t experience = player->getExperience();
    if(experience > 0x7FFFFFFF)
        msg->add<uint32_t>(0x7FFFFFFF);
    else
        msg->add<uint32_t>(experience);

    msg->add<uint16_t>(player->getPlayerInfo(PLAYERINFO_LEVEL));
    msg->addByte(player->getPlayerInfo(PLAYERINFO_LEVELPERCENT));

    if (player->getPlayerInfo(PLAYERINFO_MAXMANA) > 0) {
        msg->add<uint16_t>((player->getPlayerInfo(PLAYERINFO_MANA) * 100 / player->getPlayerInfo(PLAYERINFO_MAXMANA)));
        msg->add<uint16_t>(100);
    } else {
        msg->add<uint16_t>(0);
        msg->add<uint16_t>(0);
    }
	
    msg->addByte(player->getPlayerInfo(PLAYERINFO_MAGICLEVEL));
    msg->addByte(player->getPlayerInfo(PLAYERINFO_MAGICLEVELPERCENT));
    msg->addByte(player->getPlayerInfo(PLAYERINFO_SOUL));
    msg->add<uint16_t>(player->getStaminaMinutes());
}

 

 

vou compilar aki

20 minutos atrás, KotZletY disse:

@mullino há sim lamento, tava ouvindo um áudio aqui e acabei não prestando atenção: 

  Mostrar conteúdo oculto


void ProtocolGame::AddPlayerStats(OutputMessage_ptr msg)
{
    msg->addByte(0xA0);

    if (player->getPlayerInfo(PLAYERINFO_MAXHEALTH) > 0) {
        msg->add<uint16_t>((player->getHealth() * 100 / player->getPlayerInfo(PLAYERINFO_MAXHEALTH)));
        msg->add<uint16_t>(100);
    } else {
        msg->add<uint16_t>(0);
        msg->add<uint16_t>(0);
    }
 
    msg->add<uint32_t>(uint32_t(player->getFreeCapacity() * 100));
    uint64_t experience = player->getExperience();
    if(experience > 0x7FFFFFFF)
        msg->add<uint32_t>(0x7FFFFFFF);
    else
        msg->add<uint32_t>(experience);

    msg->add<uint16_t>(player->getPlayerInfo(PLAYERINFO_LEVEL));
    msg->addByte(player->getPlayerInfo(PLAYERINFO_LEVELPERCENT));

    if (player->getPlayerInfo(PLAYERINFO_MAXMANA) > 0) {
        msg->add<uint16_t>((player->getPlayerInfo(PLAYERINFO_MANA) * 100 / player->getPlayerInfo(PLAYERINFO_MAXMANA)));
        msg->add<uint16_t>(100);
    } else {
        msg->add<uint16_t>(0);
        msg->add<uint16_t>(0);
    }
	
    msg->addByte(player->getPlayerInfo(PLAYERINFO_MAGICLEVEL));
    msg->addByte(player->getPlayerInfo(PLAYERINFO_MAGICLEVELPERCENT));
    msg->addByte(player->getPlayerInfo(PLAYERINFO_SOUL));
    msg->add<uint16_t>(player->getStaminaMinutes());
}

 

 

Funcionou Perfeito cara VC E milll 1000000 +Rep

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

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

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo