ilveoncaffiene
New Member
- Joined
- Jun 12, 2008
- Messages
- 19
- Reaction score
- 0
This is a cooking script I made so that you are able to cook items such as the cooking tray with cookie dough, and the chocolate cake lumps.
There is, of course, a random chance of burning the cake/cookies
Script (data/actions/scripts/other/cooking.lua):
Add to actions.xml:
There is, of course, a random chance of burning the cake/cookies
Script (data/actions/scripts/other/cooking.lua):
Code:
local oven_off={1787,1789,1791,1793}
local oven_on={1786,1788,1790,1792}
local COOKIE_ID=2687
local COOKIE_TRAY_ID=8848
local TRAY_ID=2561
local CHOCOLATE_DOUGH_ID=8846
local CHOCOLATE_CAKE_ID=8847
function onUse(cid, item, fromPosition, itemEx, toPosition)
if itemEx == nil or itemEx.uid ==nil then
return FALSE
elseif isInArray(oven_off,itemEx.itemid) == TRUE then
doPlayerSendCancel(cid,"The oven must be turned on.")
return FALSE
elseif isInArray(oven_on,itemEx.itemid) == TRUE then
if item.itemid == COOKIE_TRAY_ID then
doTransformItem(item.uid,TRAY_ID)
local rand=math.random(1,100)
if rand < 24 then
doPlayerSendTextMessage(cid,MESSAGE_EVENT_DEFAULT,"You burnt the cookies.")
else
local give = doPlayerGiveItem(cid,COOKIE_ID,10,0)
if give == LUA_ERROR then
return FALSE
end
end
elseif item.itemid == CHOCOLATE_DOUGH_ID then
doPlayerRemoveItem(item.uid,1)
local rand=math.random(1,100)
if rand < 33 then
doPlayerSendTextMessage(cid,MESSAGE_EVENT_DEFAULT,"You burnt the cake.")
else
local give = doPlayerGiveItem(cid,CHOCOLATE_CAKE_ID,1)
if give == LUA_ERROR then
return FALSE
end
end
else
doPlayerSendCancel(cid,"This item can't be cooked.")
return FALSE
end
else
doPlayerSendCancel(cid,"Use this item on an oven.")
return FALSE
end
return TRUE
end
Add to actions.xml:
Code:
<!-- COOKING -->
<action itemid="8846" script="other/cooking.lua"/>
<action itemid="8848" script="other/cooking.lua"/>
Last edited: