Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @@Blackjack
- @name Blackjack
- @inputs
- @outputs Status:string Dealer You
- @persist Player:entity Session Bet
- @trigger
- runOnChat(1)
- if(Session==0&chatClk()&lastSaid():lower()=="register"){
- Player=lastSpoke()
- Session=1
- Status="Playing"
- }
- if(Session==1&chatClk()&lastSaid():lower():left(4)=="bet$"&lastSpoke()==Player){
- Bet=clamp(int(lastSaid():right(lastSaid():length()-4):toNumber()),10,20000)
- askForMoney(lastSpoke(),Bet, "Blackjack Macheen!")
- }
- if(Session==1&deductClk()){
- Dealer=0
- Bet=deductAmount()
- Session=2
- Card1=randint(1,13)
- if(Card1>10){
- Status="Picture Card"
- } else {
- Status="You got a " + Card1:toString()
- }
- You=clamp(Card1,1,10)
- }
- if(Session==1&chatClk()&lastSaid():lower()=="leave"&(lastSpoke()==Player|lastSpoke()==owner())){
- Session=0
- Status="Open"
- }
- if(Session==2&chatClk()&lastSaid():lower()=="hit me"&lastSpoke()==Player){
- Card=randint(1,13)
- You=You+clamp(Card,1,10)
- if(Card>10){
- Status="Picture Card"
- } else {
- Status="You got a " + Card:toString()
- }
- if(You>21){
- Status="You got a " + Card:toString() + " and Bust"
- Session=1
- }
- }
- if(Session==2&chatClk()&lastSaid():lower()=="fold"&lastSpoke()==Player){
- Session=1
- Status="Playing"
- }
- if(Session==2&chatClk()&lastSaid():lower()=="sit"&lastSpoke()==Player){
- Dealer=randint(17,23)
- if(Dealer>21){
- Status="Dealer Bust"
- giveMoney(Player,Bet*2)
- Session=1
- exit()
- }
- if(You>Dealer){
- giveMoney(Player,Bet*2)
- Status="You Win!"
- if(You==21){
- giveMoney(Player,Bet*2)
- Status="You got 21!"
- }
- Session=1
- } else{
- Status="Dealer wins"
- Session=1
- }
- }
- @@Lottery
- @name Lottery
- @inputs Value CS:wirelink Play:entity Draw
- @outputs Players:array Values:array Jackpot Sum
- @persist WinChk Winner:entity
- @trigger
- if(deductClk()){
- Index=Players:count()+1
- Amount=deductAmount()
- Players[Index,entity]=deductPlayer()
- Values[Index,number]=Amount
- }
- if(Play:isPlayer()&Value>10){
- askForMoney(Play,Value)
- }
- X=0
- while(X<Players:count()){
- X++
- Name=Players:entity(X):name():left(23)
- CS:writeString(Name + ":$" + Values:number(X):toString(),0,X)
- }
- Sum=0
- X=0
- while(X<Players:count()){
- X++
- Sum=Sum+Values:number(X)
- }
- Jackpot=Sum
- if(Draw==1){
- X=0
- WinnerInt=randint(0,Sum)
- Sum=0
- while(X<Players:count()){
- X++
- if(WinnerInt>Sum&WinnerInt<(Sum+Values:number(X))){
- Winner=Players:entity(X)
- WinChk=1
- }
- Sum=Sum+Values:number(X)
- }
- }
- if(WinChk==1){
- CS:writeString(Winner:name():left(20) + " HAS WON",0,7,944,633,1)
- giveMoney(Winner,Jackpot)
- timer("reset",3000)
- WinChk=0
- }
- if(clk("reset")){
- Jackpot=0
- WinChk=0
- Players=array()
- Values=array()
- }
- @@Slotspinner
- @name SlotsSpinner
- @inputs Player:entity Go
- @outputs TxtClk Screen1:string Screen2:string Screen3:string
- @persist Gone SC1 SC2 SC3 ActivePlayer:entity
- @trigger
- TxtClk=1
- if(clk("go")){
- if(SC1-Gone<65){
- Screen1=toChar(91+(SC1-Gone-65))
- } else {
- Screen1=toChar(SC1-Gone)
- }
- if(SC2-Gone<65){
- Screen2=toChar(91+(SC2-Gone-65))
- } else {
- Screen2=toChar(SC2-Gone)
- }
- if(SC3-Gone<65){
- Screen3=toChar(91+(SC3-Gone-65))
- } else {
- Screen3=toChar(SC3-Gone)
- }
- Gone=Gone-1
- if(Gone>0){
- timer("go",600-(Gone*100))
- } else {
- Done=1
- }
- }
- if(deductClk()){
- SC1=randint(66,91)
- SC2=randint(66,91)
- SC3=randint(66,91)
- timer("go",100)
- Gone=5
- }
- if(Done==1){
- if(SC1==91&SC2==91&SC3==91){
- giveMoney(ActivePlayer,5000)
- }
- elseif(SC1==SC2&SC2==SC3){
- giveMoney(ActivePlayer,1000)
- }
- elseif(SC1==SC2|SC2==SC3|SC1==SC3){
- giveMoney(ActivePlayer,50)
- }
- }
- if(Go==1&Player:isPlayer()){
- askForMoney(Player,10, "Slots Machine!")
- ActivePlayer=Player
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement