function onSay(cid, words, param)
doPlayerSendTextMessage(cid, "Your Health Is "..getCreatureMaxHealth(cid)..".")
doSendMagicEffect(getThingPos(cid), math.random(1,40))
return true
end
function onSay(cid, words, param)
doPlayerSendTextMessage(cid, "Your Mana Is "..getCreatureMaxMana(cid)..".")
doSendMagicEffect(getThingPos(cid), math.random(1,40))
return true
end
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
msg->put<uint16_t>(player->getHealth());
msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXHEALTH));
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);
}
msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MANA));
msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXMANA));
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);
}
didn't you hear about google translate?
msg->put<uint16_t>(player->getHealth());
msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXHEALTH));
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);
}
msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MANA));
msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXMANA));
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);
}
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:
With:Code:msg->put<uint16_t>(player->getHealth()); msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXHEALTH));
And: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); }
With:Code:msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MANA)); msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXMANA));
Ready ☺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); }
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:
With:Code:msg->put<uint16_t>(player->getHealth()); msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXHEALTH));
And: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); }
With:Code:msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MANA)); msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXMANA));
Ready ☺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); }