Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * WRITTEN BY BLUECRACK FROM HUNGARY!! (aka Bluerak)
- * This Program is FREE; So if you have this script, you didn't pay for it.
- * Thank you for using my scripts, do not forget to vote me and choose me for president.
- * Email: bluecrack@indamail.hu (Send me an email if you have some problems, or if you wanna talk with me)
- * All Rights Reserved.
- */
- /*
- SDName: npc_gamble
- SDCategory: Maybe fun? or wtf
- SDComplete: Ofcourse 100%
- SDComment: Star Wars the best movie what i've ever seen...
- Special Thanks: George Lucas
- */
- // How 2 set the chance:
- // if (roll >= 70) -- In this case the 70 is a percent number. Change it up if you want bigger chances and down to get lower chances.
- /* The Holy Changelog:
- v 1.0 - The script is done so far
- v 1.1 - new uint32 givenmoney
- v 1.2 - The script is done
- v 1.3 - Fixed TYPOS
- */
- class npc_gamble : public CreatureScript
- {
- public:
- npc_gamble()
- : CreatureScript("npc_gamble")
- {
- }
- uint32 roll;
- uint32 givenmoney;
- bool OnGossipHello(Player * player, Creature * pCreature)
- {
- player->ADD_GOSSIP_ITEM(0, "ROLL THE DICE!", GOSSIP_SENDER_MAIN, 1);
- return true;
- }
- bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
- {
- pPlayer->PlayerTalkClass->ClearMenus();
- switch (uiAction)
- {
- case 1:
- pPlayer->ADD_GOSSIP_ITEM(0, "Bet 10 gold(I don't want to lose so much)", GOSSIP_SENDER_MAIN, 100);
- pPlayer->ADD_GOSSIP_ITEM(0, "Bet 50 gold(I wanna win something)", GOSSIP_SENDER_MAIN, 200);
- pPlayer->ADD_GOSSIP_ITEM(0, "Bet 100 gold(I think I'm lucky!)", GOSSIP_SENDER_MAIN, 300);
- pPlayer->ADD_GOSSIP_ITEM(0, "Bet 500 gold(Let's play harder!)", GOSSIP_SENDER_MAIN, 400);
- pPlayer->ADD_GOSSIP_ITEM(0, "Bet 1000 gold(I'm ready to lose much! My men will pay back their loan soon!)", GOSSIP_SENDER_MAIN, 500);
- case 100:
- /** 10 Gold Part **/
- if(pPlayer->GetMoney() >= 100000) // Maybe 10 gold but I'm not sure.
- {
- pCreature->MonsterWhisper("You can bet 10 gold, you have enough money", pPlayer->GetGUID(), false);
- pPlayer->ModifyMoney(-100000); // Deletes the money from the player
- givenmoney = 100000;
- roll = urand (1, 100); // Selects a random number between 1 and 100
- if (roll >= 70) // IF the roll is 70 or bigger the player gets his money
- {
- pPlayer->ModifyMoney(givenmoney * 2);
- pCreature->MonsterWhisper("Congrats You won!", pPlayer->GetGUID(), false);
- } else
- pCreature->MonsterWhisper("You failed!", pPlayer->GetGUID(), false);
- }
- /** 10 Gold Part ends **/
- case 200:
- /** 50 Gold Part **/
- if(pPlayer->GetMoney() >= 500000) // Maybe 10 gold but I'm not sure.
- {
- pCreature->MonsterWhisper("You can bet 50 gold, you have enough money", pPlayer->GetGUID(), false);
- pPlayer->ModifyMoney(-500000); // Deletes the money from the player
- pCreature->MonsterTextEmote("The Dice is rolling... Get Ready!", 0, 0);
- givenmoney = 500000;
- roll = urand (1, 100); // Selects a random number between 1 and 100
- if (roll >= 70) // IF the roll is 70 or bigger the player gets his money
- {
- pPlayer->ModifyMoney(givenmoney * 2);
- pCreature->MonsterWhisper("Congrats You won!", pPlayer->GetGUID(), false);
- } else
- pCreature->MonsterWhisper("You failed!", pPlayer->GetGUID(), false);
- }
- /** 50 Gold Part ends **/
- case 300:
- /** 100 Gold Part **/
- if(pPlayer->GetMoney() >= 1000000) // Maybe 10 gold but I'm not sure.
- {
- pCreature->MonsterWhisper("You can bet 100 gold, you have enough money", pPlayer->GetGUID(), false);
- pPlayer->ModifyMoney(-1000000); // Deletes the money from the player
- pCreature->MonsterTextEmote("The Dice is rolling... Get Ready!", 0, 0);
- givenmoney = 1000000;
- roll = urand (1, 100); // Selects a random number between 1 and 100
- if (roll >= 70) // IF the roll is 70 or bigger the player gets his money
- {
- pPlayer->ModifyMoney(givenmoney * 2);
- pCreature->MonsterWhisper("Congrats You won!", pPlayer->GetGUID(), false);
- } else
- pCreature->MonsterWhisper("You failed!", pPlayer->GetGUID(), false);
- }
- /** 100 Gold Part ends **/
- case 400:
- /** 500 Gold Part **/
- if(pPlayer->GetMoney() >= 5000000) // Maybe 10 gold but I'm not sure.
- {
- pCreature->MonsterWhisper("You can bet 500 gold, you have enough money", pPlayer->GetGUID(), false);
- pPlayer->ModifyMoney(-5000000); // Deletes the money from the player
- pCreature->MonsterTextEmote("The Dice is rolling... Get Ready!", 0, 0);
- givenmoney = 5000000;
- roll = urand (1, 100); // Selects a random number between 1 and 100
- if (roll >= 70) // IF the roll is 70 or bigger the player gets his money
- {
- pPlayer->ModifyMoney(givenmoney * 2);
- pCreature->MonsterWhisper("Congrats You won!", pPlayer->GetGUID(), false);
- } else
- pCreature->MonsterWhisper("You failed!", pPlayer->GetGUID(), false);
- }
- /** 500 Gold Part ends **/
- case 500:
- /** 1000 Gold Part **/
- if(pPlayer->GetMoney() >= 10000000) // Maybe 10 gold but I'm not sure.
- {
- pCreature->MonsterWhisper("You can bet 1000 gold, you have enough money", pPlayer->GetGUID(), false);
- pPlayer->ModifyMoney(-10000000); // Deletes the money from the player
- pCreature->MonsterTextEmote("The Dice is rolling... Get Ready!", 0, 0);
- givenmoney = 10000000;
- roll = urand (1, 100); // Selects a random number between 1 and 100
- if (roll >= 70) // IF the roll is 70 or bigger the player gets his money
- {
- pPlayer->ModifyMoney(givenmoney * 2);
- pCreature->MonsterWhisper("Congrats You won!", pPlayer->GetGUID(), false);
- } else
- pCreature->MonsterWhisper("You failed!", pPlayer->GetGUID(), false);
- }
- /** 1000 Gold Part ends **/
- }
- return true;
- }
- };
- void AddSC_npc_gamble()
- {
- new npc_gamble();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement