Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local NPC_ID = 44007
- local multi = 2
- function Gambler_Gossip(event, plr, unit)
- plr:GossipMenuAddItem(6, "You ready to gamble, "..plr:GetName().."?", 0, 1, true, "Insert amount of gold you want to gamble with!")
- plr:GossipMenuAddItem(0, "Nevermind", 0, 2)
- plr:GossipSendMenu(1, unit)
- end
- function Gambler_Event(event, plr, unit, sender, intid, code)
- local chance = math.random(1,2) -- This'll give you a 50% chance to win. 1/2 = 50% 1/3 = 33% 1/4 = 25% 1/5 = 20%
- if(intid == 1) then
- if (tonumber(code)) then -- Check if player actually specified an amount in numbers
- if(plr:GetCoinage() < tonumber(code*10000)) then
- plr:SendBroadcastMessage("|cFFFFFF9F"..unit:GetName().." says: You do not have "..tonumber(code).." gold!")
- else
- if(chance == 1) then
- plr:SendBroadcastMessage("|cFFFFFF9F"..unit:GetName().." says: Congratulations! You won "..math.ceil(code*multi).." gold!")
- gold = (math.ceil(tonumber(code*10000)*multi))
- plr:GiveCoinage(gold)
- else
- plr:SendBroadcastMessage("|cFFFFFF9F"..unit:GetName().." says: Too bad "..plr:GetName()..", better luck next time!")
- plr:RemoveCoinage(tonumber(code*10000))
- end
- end
- else
- plr:SendBroadcastMessage("|cFFFFFF9F"..unit:GetName().." says: You need to use numbers, not letters.")
- end
- end
- plr:GossipComplete()
- end
- RegisterCreatureGossipEvent(NPC_ID, 1, Gambler_Gossip)
- RegisterCreatureGossipEvent(NPC_ID, 2, Gambler_Event)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement