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

Broadcast rare lottey win

Swiff

Member
Joined
Apr 6, 2009
Messages
366
Reaction score
12
Location
Sweden
Hello!
I have a lottery system that you can play on my ot. I got the idea that if a player get something that is good, and rare to get through lottery, it should be broadcasted like so:
"playername just won gold nugget in lottery!"

I would like some kind of table to configure what items are considered "rare" and should be broadcasted upon winning them. like:~
local rare = {
2157, -- gold nugget
2390, -- magic longsword
10521} -- moon backpack

And if the player wins any of the "rare" it should be broadcasted ^^
Here's my script:
Code:
function onUse(cid, item, frompos, item2, topos)
local itemreq = 2157
local prize = {
2157,
2390,
2153,
2154,
2155,
10521,
2156}
local actionid = 1337
local count = 1

if item.actionid == actionid and getPlayerItemCount(cid, itemreq) >= 1 then
doPlayerRemoveItem(cid, itemreq, 1)
local randomChance = math.random(1, 7)
doPlayerAddItem(cid, prize[randomChance], count)
doSendMagicEffect(fromPosition, 27)
else
doPlayerSendCancel(cid, "You need a gold nugget to play the lottery.")
end
return true
end
I didn't make this script, but I would be really happy if someone could help me expand it :)
 
Last edited:
Code:
function onUse(cid, item, frompos, item2, topos)
local prize, rare = {2157,2390,2153,2154,2155,10521,2156}, {2157,2390,10521}
local actionid = 1337
if item.actionid == actionid and doPlayerRemoveItem(cid, 2157, 1) then
local randomChance = prize[math.random(1, #prize)]
doPlayerAddItem(cid, randomChance, 1)
if isInArray(rare, randomChance) then doBroadcastMessage("[LOTTERY SYSTEM] Winner: " .. getCreatureName(cid) .. ", Reward: 1 " .. getItemNameById(randomChance) .. "s! Congratulations!") end
doSendMagicEffect(fromPosition, 27)
else
doPlayerSendCancel(cid, "You need a gold nugget to play the lottery.")
end
return true
end
 
Back
Top