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

2 Requests Please.

25193323

New Member
Joined
Jun 13, 2013
Messages
91
Reaction score
0
First Request I Want To Know How To Do The Health And The Mana With %?
Second Request I Want A Script That Tells Me How Much Is My HP ANd MP?
 
First Request:
http://otland.net/threads/jak-wysylac-hp-i-mane-w-procentach.181560/

Second Request:

a script that tells you your health.data/talkaction
Code:
function onSay(cid, words, param)
   doPlayerSendTextMessage(cid, "Your Health Is "..getCreatureMaxHealth(cid)..".")
   doSendMagicEffect(getThingPos(cid), math.random(1,40))
   return true
   end

Mana
Code:
function onSay(cid, words, param)
   doPlayerSendTextMessage(cid, "Your Mana Is "..getCreatureMaxMana(cid)..".")
   doSendMagicEffect(getThingPos(cid), math.random(1,40))
   return true
   end

2 in 1

Code:
function onSay(cid, words, param)
     if param == "" then
       doPlayerSendCancel(cid,"Invalid Param")
       return true
     end
       if param == "mana" then
         doPlayerSendTextMessage(cid, "Your Mana Is "..getCreatureMaxMana(cid)..".")
         doSendMagicEffect(getThingPos(cid), math.random(1,40))
     elseif param == "health" then
       doPlayerSendTextMessage(cid, "Your Mana Is "..getCreatureMaxHealth(cid)..".")
       doSendMagicEffect(getThingPos(cid), math.random(1,40))
       end
     return true
   end
 
It's not that hard to figure out what you need to do. :p

Protocolgame.cpp

Locate this
Code:
  msg->put<uint16_t>(player->getHealth());
  msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXHEALTH));
and replace with
Code:
  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);
   }
__________________________________________________________________________
Locate this
Code:
  msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MANA));
  msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXMANA));
and replace with
Code:
  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);
   }

Recompile TFS as usual after source changes.
 
Last edited:
Google translate
How to send your mana and HP as a percentage

Hello,
In this tutorial I will describe how to make mana and HP sent to the client as a percentage.
In particular, may be useful on servers with more experience multipliers, where the amount of HP or mana player exceeds 65 535 rotates counter and starts counting again.

So that:
In the file protocolgame.cpp find and replace:
Code:
msg->put<uint16_t>(player->getHealth());
msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXHEALTH));
With:
Code:
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);
}
And:
Code:
msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MANA));
msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXMANA));
With:
Code:
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);
}
Ready ☺
 
Google translate
How to send your mana and HP as a percentage

Hello,
In this tutorial I will describe how to make mana and HP sent to the client as a percentage.
In particular, may be useful on servers with more experience multipliers, where the amount of HP or mana player exceeds 65 535 rotates counter and starts counting again.

So that:
In the file protocolgame.cpp find and replace:
Code:
 msg->put<uint16_t>(player->getHealth());
msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXHEALTH));
With:
Code:
 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);
}
And:
Code:
 msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MANA));
msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXMANA));
With:
Code:
 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);
}
Ready ☺
Is this working with 0.4? And does it need to get compiled again?
 
Google translate
How to send your mana and HP as a percentage

Hello,
In this tutorial I will describe how to make mana and HP sent to the client as a percentage.
In particular, may be useful on servers with more experience multipliers, where the amount of HP or mana player exceeds 65 535 rotates counter and starts counting again.

So that:
In the file protocolgame.cpp find and replace:
Code:
msg->put<uint16_t>(player->getHealth());
msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXHEALTH));
With:
Code:
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);
}
And:
Code:
msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MANA));
msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXMANA));
With:
Code:
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);
}
Ready ☺

its dont work with me too give me eroor in put and < lol... ?.
 
Back
Top