• 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 7.6 doPlayerAddHealth Problem

Stefx

New Member
Joined
Apr 30, 2016
Messages
16
Reaction score
0
I have problem with healing script of NPC. Whenever I say heal > yes nothing happend on my char and
server console drop this message: "Attempt to Call global 'doPlayerAddHealth <a nil value>'

Part of my code:
Lua:
          if msgcontains(msg, 'heal') then
        talk_state = 1
                selfSay('Do really need my help?')
        elseif talk_state == 1 then
                if msgcontains(msg, 'yes') then
        doPlayerAddHealth(cid, 100)   
        selfSay('Let me heal you')
        end
        talk_state = 0
 
This should work.
The problem is that when you say heal you set the talkstate to 1 but then you had the talkstate set it back to 0 at the bottom it should be inside the if statement
Lua:
if msgcontains(msg, 'heal') then
   talk_state = 1
   selfSay('Do really need my help?')
elseif talk_state == 1 then
   if msgcontains(msg, 'yes') then
        doCreatureAddHealth(cid, 100)  
        selfSay('Let me heal you')
       talk_state = 0 -- moved this inside the if statement, since it was outside and would set it back to 0 when you say heal the first time
   end -- also added this might need to be removed if you got an end deeper down in your script
end
 
bb0bd8b1b3499.png.html

Still the same. I even clear everything and make a new simple function and also te same message.
Lua:
        if msgcontains(msg, 'heal') then
            doCreatureAddHealth(cid, 100)
            selfSay('Let me heal you')

Maybe something is wrong with my engine (DeadTouch 1.9) I'm out of ideas
 
Back
Top