local function giveHPAndMP(cid, hp, mp)
[COLOR="#B22222"]setCreatureMaxHealth(cid, hp) -- give max health[/COLOR]
doCreatureAddHealth(cid, hp)
[COLOR="#B22222"]setCreatureMaxMana(cid, mp) -- give max mana[/COLOR]
doPlayerAddMana(cid, mp)
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 1945 then
local voc = getPlayerVocation(cid)
local hp = 0
local mp = 0
if voc == 1 or voc == 5 then -- sorc
hp = 5
mp = 30
elseif voc == 2 or voc == 6 then -- druid
hp = 5
mp = 30
elseif voc == 3 or voc == 7 then -- paladin
hp = 10
mp = 15
elseif voc == 4 or voc == 8 then -- knight
hp = 15
mp = 5
end
giveHPAndMP(cid, hp*10, mp*10)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have gained " .. hp .. " maximum health and " .. mp .. " maximum mana!")
doTransformItem(item.uid, 1946)
elseif item.itemid == 1946 then
doTransformItem(item.uid, 1945)
end
return TRUE
end
If you are using distro 0.2.15~ you will not be able to use this script since it uses the two functions marked with red.
Code:local function giveHPAndMP(cid, hp, mp) [COLOR=#B22222]setCreatureMaxHealth(cid, hp) -- give max health[/COLOR] doCreatureAddHealth(cid, hp) [COLOR=#B22222]setCreatureMaxMana(cid, mp) -- give max mana[/COLOR] doPlayerAddMana(cid, mp) end function onUse(cid, item, fromPosition, itemEx, toPosition) if item.itemid == 1945 then local voc = getPlayerVocation(cid) local hp = 0 local mp = 0 if voc == 1 or voc == 5 then -- sorc hp = 5 mp = 30 elseif voc == 2 or voc == 6 then -- druid hp = 5 mp = 30 elseif voc == 3 or voc == 7 then -- paladin hp = 10 mp = 15 elseif voc == 4 or voc == 8 then -- knight hp = 15 mp = 5 end giveHPAndMP(cid, hp*10, mp*10) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have gained " .. hp .. " maximum health and " .. mp .. " maximum mana!") doTransformItem(item.uid, 1946) elseif item.itemid == 1946 then doTransformItem(item.uid, 1945) end return TRUE end
local function giveHPAndMP(cid, hp, mp)
setCreatureMaxHealth(cid, hp) -- give max health
setCreatureMaxMana(cid, mp) -- give max mana
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerMoney(cid) > 1000 then
if item.itemid == 1355 then
local voc = getPlayerVocation(cid)
local hp = 0
local mp = 0
if voc == 1 then -- Guard
hp = 35
mp = 10
elseif voc == 2 then -- Archer
hp = 15
mp = 15
elseif voc == 3 then -- Necromancer
hp = 10
mp = 20
elseif voc == 4 then -- Priest
hp = 10
mp = 25
end
giveHPAndMP(cid, hp*10, mp*10)
doPlayerRemoveMoney(cid, 1000)
doPlayerSendTextMessage(cid,21,"You have bought 10 lvls of hp/mana!")
else
doPlayerSendTextMessage(cid,21,"Sorry you dont have enough money!")
end
end
return TRUE
end
local function giveHPAndMP(cid, hp, mp)
setCreatureMaxHealth(cid, hp) -- give max health
setCreatureMaxMana(cid, mp) -- give max mana
doPlayerRemoveMoney(cid, 1000)
doPlayerSendTextMessage(cid, 21, "You have bought 10 lvls of hp/mana!")
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerMoney(cid) > 1000 and item.itemid == 1355 then
local voc = getPlayerVocation(cid)
if voc == 1 then -- Guard
giveHPAndMP(cid, 35*10, 10*10)
elseif voc == 2 then -- Archer
giveHPAndMP(cid, 15*10, 15*10)
elseif voc == 3 then -- Necromancer
giveHPAndMP(cid, 10*10, 20*10)
elseif voc == 4 then -- Priest
giveHPAndMP(cid, 10*10, 25*10)
end
else
doPlayerSendTextMessage(cid, 21, "Sorry you don't have enough money!")
end
return TRUE
end
local function giveHPAndMP(cid, hp, mp)
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + hp) -- give max health
setCreatureMaxMana(cid, getCreatureMaxMana(cid) + mp) -- give max mana
doPlayerRemoveMoney(cid, 1000)
doPlayerSendTextMessage(cid, 21, "You have bought 10 lvls of hp/mana!")
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerMoney(cid) > 1000 and item.itemid == 1355 then
local voc = getPlayerVocation(cid)
if voc == 1 then -- Guard
giveHPAndMP(cid, 35*10, 10*10)
elseif voc == 2 then -- Archer
giveHPAndMP(cid, 15*10, 15*10)
elseif voc == 3 then -- Necromancer
giveHPAndMP(cid, 10*10, 20*10)
elseif voc == 4 then -- Priest
giveHPAndMP(cid, 10*10, 25*10)
else
doPlayerSendTextMessage(cid, 21, "Sorry, your vocation is not allowed to buy hp/mana!")
end
else
doPlayerSendTextMessage(cid, 21, "Sorry you don't have enough money!")
end
return TRUE
end
You must spread some Reputation around before giving it to trollebror again.