Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Gamble NPC.
- --For Arcemu , copyright by AlaMiku.
- local NPC_ID = Npc_id
- local TOKEN_ID = token_id
- function Gambler_Gossip(unit, event, plr)
- unit:GossipCreateMenu(1, plr, 0)
- unit:GossipMenuAddItem(6, "You ready to gamble, "..plr:GetName().."?", 1, 1, "Insert ammount of tokens you want to gamble!")
- unit:GossipMenuAddItem(0, "Nevermind", 2, 0)
- unit:GossipSendMenu(plr)
- end
- function Gambler_Event(unit, event, plr, id, intid, code)
- local chance = math.random(1,5)
- if(intid == 1) then
- if(plr:GetItemCount(TOKEN_ID) < tonumber(code)) then
- plr:SendBroadcastMessage("|cFFFFFF9F"..unit:GetName().." says: You do not have "..code.." tokens!")
- else
- if(chance == 1) then
- plr:SendBroadcastMessage("|cFFFFFF9F"..unit:GetName().." says: Congratulations! You won "..math.ceil(code*1.0).." Tokens!")
- plr:AddItem(TOKEN_ID, math.ceil(code*1.0))
- else
- plr:SendBroadcastMessage("|cFFFFFF9F"..unit:GetName().." says: Too bad "..plr:GetName()..", better luck next time!")
- plr:RemoveItem(TOKEN_ID, code)
- end
- end
- end
- plr:GossipComplete()
- end
- RegisterUnitGossipEvent(NPC_ID, 1, "Gambler_Gossip")
- RegisterUnitGossipEvent(NPC_ID, 2, "Gambler_Event")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement