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

Winning Lottery Ticket!

Majeski20

New Member
Joined
Apr 21, 2008
Messages
602
Reaction score
4
Location
Sweden
Hi there.

Is it possible to make a script on a Winning Lottery ticket.
When u click on the ticket you will get any reward, just random item like, Mpa,Golden legs,MMS.
Not to hard script just simple, maybe an effect when using it.

Thanks!
I'll rep you.
 
Last edited:
@ Majeski20

Try it and check if work :peace:

on actions.xml put that (the item id cam be as you like)
actions.xml
Code:
<action itemid="5957" event="script" value="lottery_ticket.lua"/>

Put that on actions\scripts
lottery_ticket.lua
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local chance = 30 -- chance in % to get the prize
local prize = 5958
local lose = 7696
        if math.random(1,100) <= chance then
                doSendMagicEffect(fromPosition, CONST_ME_SOUND_YELLOW)
                doPlayerSendTextMessage(cid,22,'Congratulations, you have won in lottery!')
				rep.add(cid, 1, TEXTCOLOR_LIGHTBLUE)
                doTransformItem(item.uid, prize)
        else
                doSendMagicEffect(fromPosition, CONST_ME_POFF)
                doPlayerSendTextMessage(cid,22,'Seems like you got a blank, try again!')
                doTransformItem(item.uid, lose)
        end
        return TRUE
end
 
Code:
local t = {
	chance = 30,
	rewards = {2472, 2470, 2514}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if math.random(100) <= t.chance then
		doSendMagicEffect(fromPosition, CONST_ME_SOUND_YELLOW)
		doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Congratulations, you have won in lottery!')
		doTransformItem(item.uid, t.rewards[math.random(#t.rewards)])
	else
		doSendMagicEffect(fromPosition, CONST_ME_POFF)
		doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Seems like you got a blank, try again!')
		doTransformItem(item.uid, 7696)
	end
	return true
end
 
Back
Top