It's better to add the new if-condition inside one if instead of having two if-statements, like this:
local function giveHPAndMP(cid, hp, mp)
setCreatureMaxHealth(cid, hp) -- give max health
setCreatureMaxMana(cid, mp) -- give max mana
doPlayerRemoveMoney(cid, 1000)...