Forum

> > CS2D > Scripts > [Tibia]Max Health / Max Mana
Forums overviewCS2D overview Scripts overviewLog in to reply

English [Tibia]Max Health / Max Mana

3 replies
To the start Previous 1 Next To the start

old [Tibia]Max Health / Max Mana

NeverLast
User Off Offline

Quote
Hello,
I need help with my function:
1
2
3
4
5
6
7
8
9
10
addhook("ms100", "maxmp_maxhp")
function maxmp_maxhp()
parse("setmaxhealth " .. id .. " " .. PLAYERS[id].MAXHP) <--- This doesn't work :/
if PLAYERS[id] and PLAYERS[id].tmp.hp > PLAYERS[id].MAXHP then
   PLAYERS[id].tmp.hp = PLAYERS[id].MAXHP
end
if PLAYERS[id] and PLAYERS[id].MP > PLAYERS[id].MAXMP then
   PLAYERS[id].MP = PLAYERS[id].MAXMP
end
end
Here the error + line
1
2
3
parse("setmaxhealth " .. id .. " " .. PLAYERS[id].MAXHP)

LUA ERROR: sys/lua/cs2dtibia/hooks.lua:3: attempt to index field '?' (a nil value)

Or have a other idea to save and load max hp/mp + make max hp?
edited 2×, last 07.04.14 04:11:35 pm

old Re: [Tibia]Max Health / Max Mana

NeverLast
User Off Offline

Quote
(config.lua)     
PLAYERINIT = {
          Experience = 0,
          Level = 1,
          Money = 50,
          HP = 100,
      MAXHP = 100,          
          MP = 100,
     MAXMP = 100,          
          Inventory = {},
          Equipment = {},
          Class = 0,
          Spawn = {784, 240},
          Tutorial = {},
          Info = {},
     },

the function(hook.lua)
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview