Reaper7
dunno wat 2 rite here
- Joined
- Feb 18, 2011
- Messages
- 133
- Reaction score
- 1
Hi there!
I'm trying to optymalize my script but it doesn't want to work propely.
This is it:
the math.random doesn't work - it always uses the first option. Second one, hasn't been used yet. I don't now what to do, so I ask you guys, for help.
I'm trying to optymalize my script but it doesn't want to work propely.
This is it:
PHP:
--[[
Script by Elff/Reaper7
-]]
function onUse(cid, item, fromPosition, itemEx, toPosition)
local number = math.random(1,2)
if item.itemid == 2123 and number==1 then
doCreatureAddHealth(cid,20)
doPlayerSendTextMessage(cid,22,"Just chill out man!")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
doRemoveItem(item.uid, 1)
return 1
elseif number==2 then
doCreatureAddHealth(cid,20)
doPlayerSendCancel(cid,22,"<Coughs> I think that drugs, aren't good for me...")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
doRemoveItem(item.uid, 1)
end
return 1
end