• 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!

[request] Random premium onuse

auzdin

New Member
Joined
Mar 8, 2008
Messages
13
Reaction score
0
What i mean is you have a scroll and use it 1/10 times you will get a premium account, 9/10 times you wont and the scroll will disappear. This is what i have so far

PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)

if item.itemid == 8189 then
if math.random(1, 2) == 1 then
doPlayerAddPremiumDays(cid, 30)
doPlayerSendTextMessage(cid,22,"You received 30 days of Premium Account")
doSendMagicEffect(toPosition, CONST_ME_GIFT_WRAPS)
doRemoveItem(item.uid, 1)
end
else
if math.random(1, 2) == 2 then
doPlayerSendTextMessage(cid,22,"Sorry not a winner")
doSendMagicEffect(toPosition, CONST_ME_POFF)
doRemoveItem(item.uid, 1)
end
end
end


it works for the most part except i cant get more then 1-2 math.random to work, and when math.random = 2 the scroll wont do anything at all but when math.random = 1 everything works fine
 
Back
Top