• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Action] Death Scroll with Countdown

Joined
May 5, 2010
Messages
62
Reaction score
1
I currently have this script:

PHP:
function onUse(cid, item, frompos, item2, topos)

if item.itemid == 5952 then
doCreatureAddHealth(cid, -90000)
doCreatureAddHealth(cid, -90000)
doRemoveItem(item.uid,1)
end
end

But I want it to have a countdown added, for example, if someone clicks on it, it will say "You have 5 seconds of life, You have 4 seconds, 3, 2, 1" in orange letters, then he will die..
I hope its not too hard but I'm not good at doing scripts :p
Thanks.
 
try this
Lua:
function countDown(number, pos, effect, msgonend, effectonend)
  local n = number
       for i = 1, number do
           addEvent(doSendAnimatedText,i* 1000, pos, n > 1 and n.."" or msgonend .."", n < 6 and TEXTCOLOR_RED or TEXTCOLOR_GREEN)
		   addEvent(doSendMagicEffect,i* 1000, pos, n > 1 and effect or effectonend )

              n = n -1
	   end
      n = number
return true

function onUse(cid, item, frompos, item2, topos) 

if item.itemid == 5952 then 
 countDown(10, getThingPos(cid), 5, "DEAD!", 2)
doCreatureAddHealth(cid, -90000) 
doCreatureAddHealth(cid, -90000) 
doRemoveItem(item.uid,1) 
end 
end
 
it gives me this error
[Error - LuaScriptInterface::loadFile] data/actions/scripts/deathscroll.lua:12: 'end' expected (to close 'function' at line 1) near 'function'
[17/05/2012 17:48:44] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/deathscroll.lua)
[17/05/2012 17:48:44] data/actions/scripts/deathscroll.lua:12: 'end' expected (to close 'function' at line 1) near 'function'
 
Add another end at the end of the countDown function.
A for loop requires an end, so does the function.
 
Back
Top