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

CreatureEvent Show real HP & Mana for HighExp OT's - No Source edit

Progenosis

Member
Joined
Sep 6, 2011
Messages
131
Reaction score
18
Some days ago I was asking for a script that show to the player the real HP and Mana on HighExp server for high level players since, as we know, the number of health and mana points can't fit the assigned space on the interface and random numbers show instead.

So, some people helped me to get the script and I just want to share it with you since, when I looked for it, couldn't find it.

Thanks to @Eduardo170 and @Xeraphus.

Here we go:

Step #1:


- Go to: data / creaturescripts / scripts
- Copy/Paste a script and rename it to: "RealHPandMANA.lua"
- Open RealHPandMANA.lua , erase all the content and paste this code:

Code:
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,"Actualmente tienes: "..playerHealth.."/"..playerMaxHealth.." de HP y "..playerMana.."/"..playerMaxMana.." de mana.")
end
return TRUE
end

** Feel free to edit this line as you wish, only if you know what you're doing:
doPlayerSendTextMessage(cid,23,"Actualmente tienes: "..playerHealth.."/"..playerMaxHealth.." de HP y "..playerMana.."/"..playerMaxMana.." de mana.")

- Save the file.

Step #2:

- Go to: data / creaturescripts and open "creaturescripts.xml"
- Paste the following code:

Code:
<event type="think" name="showinfo" event="script" value="RealHPandMANA.lua"/>

- Save the file.

Step #3:

- Go to: data / creaturescripts / scripts
- Search for "login.lua" and open the file.
- Paste the following code:

Code:
registerCreatureEvent(cid, "showinfo")

- Save the file.

It is all ready now, run your server!

r0aM2kh.png
 
Some days ago I was asking for a script that show to the player the real HP and Mana on HighExp server for high level players since, as we know, the number of health and mana points can't fit the assigned space on the interface and random numbers show instead.

So, some people helped me to get the script and I just want to share it with you since, when I looked for it, couldn't find it.

Thanks to @Eduardo170 and @Xeraphus.

Here we go:

Step #1:


- Go to: data / creaturescripts / scripts
- Copy/Paste a script and rename it to: "RealHPandMANA.lua"
- Open RealHPandMANA.lua , erase all the content and paste this code:

Code:
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,"Actualmente tienes: "..playerHealth.."/"..playerMaxHealth.." de HP y "..playerMana.."/"..playerMaxMana.." de mana.")
end
return TRUE
end

** Feel free to edit this line as you wish, only if you know what you're doing:
doPlayerSendTextMessage(cid,23,"Actualmente tienes: "..playerHealth.."/"..playerMaxHealth.." de HP y "..playerMana.."/"..playerMaxMana.." de mana.")

- Save the file.

Step #2:

- Go to: data / creaturescripts and open "creaturescripts.xml"
- Paste the following code:

Code:
<event type="think" name="showinfo" event="script" value="RealHPandMANA.lua"/>

- Save the file.

Step #3:

- Go to: data / creaturescripts / scripts
- Search for "login.lua" and open the file.
- Paste the following code:

Code:
registerCreatureEvent(cid, "showinfo")

- Save the file.

It is all ready now, run your server!

r0aM2kh.png
the other guy's function with onLogin was better, since onthink uses a set interval and it checked if its a player every time, and the function that other guy made does the message recursively and you can edit the interval to whatever you'd like
 
the other guy's function with onLogin was better, since onthink uses a set interval and it checked if its a player every time, and the function that other guy made does the message recursively and you can edit the interval to whatever you'd like

An error prompted in the console with the other script :/
 
Code:
function showStats(cid, sec)
    doPlayerSendCancel(cid, 'Health: '.. getCreatureHealth(cid) ..'/'.. getCreatureMaxHealth(cid) ..' | Mana: '.. getCreatureMana(cid) ..'/'.. getCreatureMaxMana(cid) ..'')
    addEvent(showStats, sec * 1000, cid, sec)
end

showStats(cid, 5)

shouldn't need the isPlayer(cid) for the onLogin since nothing but players log into the server :|, also changed function to where you can edit amount of seconds easier
should work fine
 
Code:
function showStats(cid, sec)
    doPlayerSendCancel(cid, 'Health: '.. getCreatureHealth(cid) ..'/'.. getCreatureMaxHealth(cid) ..' | Mana: '.. getCreatureMana(cid) ..'/'.. getCreatureMaxMana(cid) ..'')
    addEvent(showStats, sec * 1000, cid, sec)
end

showStats(cid, 5)

shouldn't need the isPlayer(cid) for the onLogin since nothing but players log into the server :|, also changed function to where you can edit amount of seconds easier
should work fine
It need isPlayer(cid). Think what script do, after player logout? Script try doPlayerSendCancel to nil.
 
Back
Top