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

Lua Show real amount of HP and Mana - Script (NOT Source edit)

Progenosis

Member
Joined
Sep 6, 2011
Messages
131
Reaction score
18
Some time ago I found here a script that shows on game window the real amount of HP and MANA that the player has, NOT in the HP and MANA bar since I don't want to edit sources, I'm not sure if I'm explaining this the right way, but I hope I do.

Does someone has the script? I've searched already for it but can't find it.

I'll appreciate it too much, thanks!
 
I'am sorry for my bad english but here you script.
creaturescript/scripts/create new lua, copy and paste in you new lua.
Code:
--[[Blacktibia @Pharos/Otland @Eduardo170]]--

function onThink(cid, interval)

if isPlayer(cid) then
local playerMaxHealth = getCreatureMaxHealth(cid)
local playerHealth = getCreatureHealth(cid)
local playerMaxMana = getCreatureMaxMana(cid)
local playerMana = getCreatureMana(cid)
doPlayerSendTextMessage(cid,27,"You have a total of: "..playerHealth.."/"..playerMaxHealth.." health and "..playerMana.."/"..playerMaxMana.." mana.")
end
return TRUE
end

in creaturescript.xml
Code:
<event type="think" name="showinfo" event="script" value="showinfo.lua"/>
login.lua

Code:
registerCreatureEvent(cid, "showinfo")
 
I'am sorry for my bad english but here you script.
creaturescript/scripts/create new lua, copy and paste in you new lua.
Code:
--[[Blacktibia @Pharos/Otland @Eduardo170]]--

function onThink(cid, interval)

if isPlayer(cid) then
local playerMaxHealth = getCreatureMaxHealth(cid)
local playerHealth = getCreatureHealth(cid)
local playerMaxMana = getCreatureMaxMana(cid)
local playerMana = getCreatureMana(cid)
doPlayerSendTextMessage(cid,27,"You have a total of: "..playerHealth.."/"..playerMaxHealth.." health and "..playerMana.."/"..playerMaxMana.." mana.")
end
return TRUE
end

in creaturescript.xml
Code:
<event type="think" name="showinfo" event="script" value="showinfo.lua"/>
login.lua

Code:
registerCreatureEvent(cid, "showinfo")

It works wonders, thanks!!

It may be too much to ask for but, is it possible that the info were shown in the game window instead of the default channel?
Just as the "Sorry, not possible." text.

2M3qX6B.png
 
Code:
function onThink(cid, interval)
if isPlayer(cid) then
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_SMALL, 'Health: '.. getCreatureHealth(cid) ..'/'.. getCreatureMaxHealth(cid) ..' | Mana: '.. getCreatureMana(cid) ..'/'.. getCreatureMaxMana(cid) ..'')
    end
    return true
end
not entirely sure if its MESSAGE_STATUS_CONSOLE_SMALL, if you debug try MESSAGE_STATUS_SMALL
 
@Limos could you help me a little, please? :)
Code:
--[[Blacktibia @Pharos/Otland @Eduardo170]]--

function onThink(cid, interval)

if isPlayer(cid) then
local playerMaxHealth = getCreatureMaxHealth(cid)
local playerHealth = getCreatureHealth(cid)
local playerMaxMana = getCreatureMaxMana(cid)
local playerMana = getCreatureMana(cid)
doPlayerSendTextMessage(cid,23,"You have a total of: "..playerHealth.."/"..playerMaxHealth.." health and "..playerMana.."/"..playerMaxMana.." mana.")
end
return TRUE
end
try again.
 
Code:
--[[Blacktibia @Pharos/Otland @Eduardo170]]--

function onThink(cid, interval)

if isPlayer(cid) then
local playerMaxHealth = getCreatureMaxHealth(cid)
local playerHealth = getCreatureHealth(cid)
local playerMaxMana = getCreatureMaxMana(cid)
local playerMana = getCreatureMana(cid)
doPlayerSendTextMessage(cid,23,"You have a total of: "..playerHealth.."/"..playerMaxHealth.." health and "..playerMana.."/"..playerMaxMana.." mana.")
end
return TRUE
end
try again.
my solution should work just fine, you save everything to locals even though you use them once, which is a waste of time and doesn't improve readability
 
Better than onThink
Code:
function showStats(cid)
    if isPlayer(cid) then
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Health: '.. getCreatureHealth(cid) ..'/'.. getCreatureMaxHealth(cid) ..' | Mana: '.. getCreatureMana(cid) ..'/'.. getCreatureMaxMana(cid) ..'')
       return addEvent(showStats, 10 * 1000, cid) -- 10 seconds
    end
end
showStats(cid)

Paste it on your login.lua
 
Last edited:
Better than onThink
Code:
function showStats(cid)
    if isPlayer(cid) then
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Health: '.. getCreatureHealth(cid) ..'/'.. getCreatureMaxHealth(cid) ..' | Mana: '.. getCreatureMana(cid) ..'/'.. getCreatureMaxMana(cid) ..'')
       return addEvent(showStats, 10 * 1000, cid) -- 10 seconds
    end
end
showStats(cid)

Paste it on your login.lua
Excelente!. No sabia como añadirle un tiempo.
 
Back
Top