Rufo
New Member
- Joined
- Jan 9, 2008
- Messages
- 251
- Reaction score
- 1
Well, this is my first time posting an action made by me, so here it is:
On actions.xml add:
Replace XXXX for the items id you used on the script
Thanks
100% By Rufo
LUA:
function onUse(cid, item, frompos, item2, topos)
--100% By Rufo to Otland
--http://myrland.servegame.com
--Config
local lifeid = XXXX --- Itemid for adding HP
local manaid = XXXX -- Itemid for adding mana
local amountlife = 100 -- Amount of hp added
local amountmana = 100 -- Amount of mana added
local timeslife = 8 -- How many times should be used for hp
local timesmana = 8 -- How many times should be used for mana
--End config
if item.itemid == lifeid then
vida = getCreatureMaxHealth(cid)+amountlife
queststatus = getPlayerStorageValue(cid,53131)
questus = getPlayerStorageValue(cid,53131)+1
if queststatus < timeslife then
doCreatureSay(cid,"You have won some extra hp.", TALKTYPE_ORANGE_1)
setCreatureMaxHealth(cid,vida)
setPlayerStorageValue(cid,53131,questus)
doRemoveItem(item.uid,1)
else
doPlayerSendTextMessage(cid,22,"You cant add yourself more hp.")
end
elseif item.itemid == manaid then
vida = getCreatureMaxMana(cid)+amountmana
queststatus = getPlayerStorageValue(cid,53132)
questus = getPlayerStorageValue(cid,53132)+1
if queststatus < timesmana then
doCreatureSay(cid,"You have won some extra mana.", TALKTYPE_ORANGE_1)
setCreatureMaxMana(cid,vida)
setPlayerStorageValue(cid,53132,questus)
doRemoveItem(item.uid,1)
else
doPlayerSendTextMessage(cid,22,"You cannot add to yourself more mana.")
end
end
return 1
end
On actions.xml add:
Code:
<!-- Add hp and mana -->
<action itemid="XXXX" event="script" value="health.lua"/>
<action itemid="XXXX" event="script" value="health.lua"/>
Replace XXXX for the items id you used on the script
This is for the item that adds mana and hp at the same time
LUA:local itemid = XXXX --- Itemid for adding HP & MP local healthamount = 100 -- The amount of health that should be added local manamount = 100 -- The amount of mana that should be added local times = 8 -- How many times can a player use this item if item.itemid == itemid then HP = getCreatureMaxHealth(cid)+healthamount MP = getCreatureMaxMana(cid)+manamount queststatus = getPlayerStorageValue(cid,53131) timesused = getPlayerStorageValue(cid,53131)+1 if queststatus < times then doCreatureSay(cid,"You've increased your health and mana points.", TALKTYPE_ORANGE_1) setCreatureMaxHealth(cid, HP) setCreatureMaxMana(cid, MP) setPlayerStorageValue(cid,53131,timesused) doRemoveItem(item.uid,1) else doPlayerSendTextMessage(cid,22,"You already used this item.") end end return 1 end
Add on actions.xml
Code:<action itemid="xxxx" event="script" value="yourfilename.lua"/>
Credits to Rufo for the base script
Thanks
100% By Rufo
Last edited: