Hello. This is one from my first scripts, enjoy:
Open folder create file named cigarette.lua and copy this in file:
Open actions.xml and add:
In items.xml search for:
and change to:
That's it. On TFS 0.3.5 working correctly.
Open folder create file named cigarette.lua and copy this in file:
Code:
-- Script made by GOD Kermer
-- Xevo OTS - http://xevo.no-ip.org
-- E-Mail - [email protected]
function onUse(cid, item, frompos, item2, topos)
local playerpos = getPlayerPosition(cid)
local hp = getCreatureHealth(cid)
doSendMagicEffect(frompos,2)
if item.itemid == 7499 and item.actionid == 3342 then
if hp > 20 then
doSendMagicEffect(frompos, 2)
doSendMagicEffect(playerpos, 34)
doSendAnimatedText(getPlayerPosition(cid), "Buh...", 129)
doCreatureAddHealth(cid,-30)
doSetItemActionId(item.uid, 3343)
doSetItemSpecialDescription(item.uid, "This cigarette is in 2/10 burned.")
else
doPlayerSendCancel(cid, "You are too weak for this!")
end
elseif item.itemid == 7499 and item.actionid == 3343 then
if hp > 25 then
doSendMagicEffect(frompos, 2)
doSendMagicEffect(playerpos, 34)
doSendAnimatedText(playerpos, "Buh...", 129)
doCreatureAddHealth(cid,-40)
doSetItemActionId(item.uid, 3344)
doSetItemSpecialDescription(item.uid, "This cigarette is in 3/10 burned.")
return TRUE
else
doPlayerSendCancel(cid, "You are too weak for this!")
end
elseif item.itemid == 7499 and item.actionid == 3344 then
if hp > 30 then
doSendMagicEffect(frompos, 2)
doSendMagicEffect(playerpos, 34)
doSendAnimatedText(playerpos, "Buh...", 129)
doCreatureAddHealth(cid,-45)
doSetItemActionId(item.uid, 3345)
doSetItemSpecialDescription(item.uid, "This cigarette is in 4/10 burned.")
return TRUE
else
doPlayerSendCancel(cid, "You are too weak for this!")
end
elseif item.itemid == 7499 and item.actionid == 3345 then
if hp > 35 then
doSendMagicEffect(frompos, 2)
doSendMagicEffect(playerpos, 34)
doSendAnimatedText(playerpos, "Buh...", 129)
doCreatureAddHealth(cid,-50)
doSetItemActionId(item.uid, 3346)
doSetItemSpecialDescription(item.uid, "This cigarette is in 5/10 burned.")
return TRUE
else
doPlayerSendCancel(cid, "You are too weak for this!")
end
elseif item.itemid == 7499 and item.actionid == 3346 then
if hp > 50 then
doSendMagicEffect(frompos, 2)
doSendMagicEffect(playerpos, 34)
doSendAnimatedText(playerpos, "Ahh...", 129)
doCreatureAddHealth(cid,-75)
doSetItemActionId(item.uid, 3347)
doSetItemSpecialDescription(item.uid, "This cigarette is in 6/10 burned.")
return TRUE
else
doPlayerSendCancel(cid, "You are too weak for this!")
end
elseif item.itemid == 7499 and item.actionid == 3347 then
if hp > 45 then
doSendMagicEffect(frompos, 2)
doSendMagicEffect(playerpos, 34)
doSendAnimatedText(playerpos, "Ah...", 100)
doCreatureAddHealth(cid,-65)
doSetItemActionId(item.uid, 3348)
doSetItemSpecialDescription(item.uid, "This cigarette is in 7/10 burned.")
return TRUE
else
doPlayerSendCancel(cid, "You are too weak for this!")
end
elseif item.itemid == 7499 and item.actionid == 3348 then
if hp > 40 then
doSendMagicEffect(frompos, 2)
doSendMagicEffect(playerpos, 34)
doSendAnimatedText(playerpos, "Uh...", 129)
doCreatureAddHealth(cid,-65)
doSetItemActionId(item.uid, 3349)
doSetItemSpecialDescription(item.uid, "This cigarette is in 8/10 burned.")
return TRUE
else
doPlayerSendCancel(cid, "You are too weak for this!")
end
elseif item.itemid == 7499 and item.actionid == 3349 then
if hp > 30 then
doSendMagicEffect(frompos, 2)
doSendMagicEffect(playerpos, 34)
doSendAnimatedText(playerpos, "Urght.", 129)
doCreatureAddHealth(cid,-65)
doSetItemActionId(item.uid, 3350)
doSetItemSpecialDescription(item.uid, "This cigarette is in 9/10 burned.")
return TRUE
else
doPlayerSendCancel(cid, "You are too weak for this!")
end
elseif item.itemid == 7499 and item.actionid == 3350 then
if hp > 30 then
doSendMagicEffect(frompos, 2)
doSendMagicEffect(playerpos, 34)
doSendAnimatedText(playerpos, "Urght!", 129)
doCreatureAddHealth(cid,-65)
doSetItemActionId(item.uid, 3351)
doSetItemSpecialDescription(item.uid, "This cigarette is burned.")
return TRUE
else
doPlayerSendCancel(cid, "You are too weak for this!")
end
elseif item.itemid == 7499 and item.actionid == 3351 then
doSendMagicEffect(frompos, 2)
doSendMagicEffect(playerpos, 2)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You can't smoke burned cigarette!")
elseif item.itemid == 7499 then
if hp > 15 then
doSendMagicEffect(frompos, 2)
doSendMagicEffect(playerpos, 34)
doSendAnimatedText(playerpos, "Buh...", 129)
doCreatureAddHealth(cid,-25)
doSetItemActionId(item.uid, 3342)
doSetItemSpecialDescription(item.uid, "This cigarette is in 1/10 burned.")
return TRUE
else
doPlayerSendCancel(cid, "You are too weak for this!")
end
end
return TRUE
end
Open actions.xml and add:
Code:
<action itemid="7499" script="cigarette.lua"/>
In items.xml search for:
Code:
<item id="7499" article="a" name="cigarette">
<attribute key="weight" value="200" />
</item>
Code:
<item id="7499" article="a" name="cigarette">
<attribute key="description" value="This cigarette is new."/>
<attribute key="weight" value="200"/>
</item>
That's it. On TFS 0.3.5 working correctly.