Zarabustor
Human Being
local config =
{
level = 30000,
itemid = 7443,
newHealth = 150000
}
local storage = 15000
function onUse(cid, item, fromPosition, itemEx, toPosition)
if (item.itemid == config.itemid) then
if getPlayerLevel(cid) >= config.level then
if getPlayerStorageValue(cid, storage) == -1 then
setCreatureMaxHealth(cid, (getCreatureMaxHealth(cid)+config.newHealth))
setPlayerStorageValue(cid, storage, 1)
doSendAnimatedText(getCreaturePosition(cid), "HEALTH!",TEXTCOLOR_RED)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)
doRemoveItem(item.uid)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have recieved ".. config.newhealth .." extra health points, now your health is ".. getCreatureMaxHealth(cid) .."!")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You may only use one health booster.")
doSendMagicEffect(getPlayerPosition(cid), 2)
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your need level 30,000k!! to use this booster.")
doSendMagicEffect(getPlayerPosition(cid), 2)
end
return TRUE
end
end
Fix it please, when I use the item not removed and
[01/04/2010 15:45:32] [Error - Action Interface]
[01/04/2010 15:45:32] data/actions/scripts/andres/hb.lua
[01/04/2010 15:45:32] Description:
[01/04/2010 15:45:32] data/actions/scripts/andres/hb.lua:16: attempt to concatenate field 'newhealth' (a nil value)
[01/04/2010 15:45:32] stack traceback:
[01/04/2010 15:45:32] data/actions/scripts/andres/hb.lua:16: in function <data/actions/scripts/andres/hb.lua:8>