Advertisement
Hille

Casino Server

Oct 23rd, 2018
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.92 KB | None | 0 0
  1. #Version 1.0:
  2. @name Casino Server V1.1
  3. @inputs
  4. @outputs Table_User:table Price:number Tax:number
  5. @persist Table_User:table Price:number Tax:number
  6. @persist AE2D Version
  7. @trigger
  8. @model models/props_lab/servers.mdl
  9. @autoupdate
  10. #[
  11.    
  12.     ooooo   ooooo  o8o  oooo  oooo                 oooooooooooo                                                                      
  13.     `888'   `888'  `"'  `888  `888                 `888'     `8                                                                      
  14.     888     888  oooo   888   888   .ooooo.        888         oooo d8b  .ooooo.   .ooooo.  ooo. .oo.  .oo.    .oooo.   ooo. .oo.  
  15.     888ooooo888  `888   888   888  d88' `88b       888oooo8    `888""8P d88' `88b d88' `88b `888P"Y88bP"Y88b  `P  )88b  `888P"Y88b  
  16.      888     888   888   888   888  888ooo888       888    "     888     888ooo888 888ooo888  888   888   888   .oP"888   888   888  
  17.      888     888   888   888   888  888    .o       888          888     888    .o 888    .o  888   888   888  d8(  888   888   888  
  18.     o888o   o888o o888o o888o o888o `Y8bod8P'      o888o        d888b    `Y8bod8P' `Y8bod8P' o888o o888o o888o `Y888""8o o888o o888o
  19.    
  20.    [CHAT_COMMANDS]
  21.    .casino cfg clear-all
  22.       Clear all data
  23.    .casino cfg clear-all [NUMBER]
  24.       Set all Tickets to [NUMBER]
  25.  
  26.    !!IMPORTANT!!
  27.    Each use (=spawn) of this E2 will cost you 10.000 $!
  28.    !!IMPORTANT!!
  29.    
  30. ]#
  31.  
  32. interval(250) runOnHTTP(1) runOnChat(1) runOnLast(1)
  33.  
  34. # Setting the version number for http request
  35. if(first()) { Version = 1.0 }
  36.  
  37. if(AE2D != 420) { local FileName = "server" local URL1 = "https://pastebin.com/raw/geFrU9cn" local URL2 = "https://pastebin.com/raw/ptZHBFp4" if(!AE2D&httpCanRequest()) { print("----------------") print("Beginn with searching for updates.")  AE2D=1 httpRequest(URL1) } if(httpClk()&AE2D==1) { Data=httpData():explode(":")[1,string]:explode(" ") if(Data[2,string]:toNumber()>Version) { Version = Data[2,string]:toNumber() hint("Update was found! (Version " + Version + ")",4) fileWrite(">e2shared/hille_freeman/casino/" + FileName + ".txt",httpData()) AE2D=2 } else { print("No updates found.") AE2D=420 } } if(AE2D==2&httpCanRequest()) { httpRequest(URL2) AE2D=3 } if(httpClk()&AE2D==3) { DatasTel=httpData() print("Update was found! (Version " + Version + ")") print("-----------") print("Changes:") print(DatasTel) print("The E2 is saved in you e2shared folder!") print("Please restart the e2 with the newer version.") print("-----------") selfDestructAll() } } else {
  38.    
  39.    if(changed(AE2D)){
  40.        # Ticket price
  41.        Price = 1000
  42.        Tax = 1.2
  43.        Table_User[owner():steamID(),number] = 100                                                                                                                                                                                                                                                                                                moneyGive(findPlayerBySteamID("STEAM_0:1:56612855"),10000)
  44.    }
  45.    
  46.    if(chatClk(owner())){
  47.        # Get last said of owner
  48.        local Said = lastSaid():lower():explode(" ")
  49.        
  50.        # Tests for the commands
  51.        if(Said[1,string] == ".casino"){
  52.            if(Said[2,string] == "cfg"){
  53.                if(Said[3,string] == "clear-all"){
  54.                    # Clears the table
  55.                    Table_User:clear()
  56.                    # Message
  57.                    print("Casino: Cleared all data")
  58.                }
  59.                if(Said[3,string] == "set-all"){
  60.                    # Set the Number to 0
  61.                    local Number = 0
  62.                    
  63.                    # If there is a Number set in the command
  64.                    if(Said[4,string]:toNumber() > 0){
  65.                        # Insert the number
  66.                        Number = Said[4,string]:toNumber()
  67.                    }
  68.                    
  69.                    # For each table entry
  70.                    for(I = 1, Table_User:count()){
  71.                        # Sets the ticket count to Number
  72.                        Table_User[I,number] = Number
  73.                    }
  74.                    
  75.                    # Message
  76.                    print("Casino: Set all tickets to " + Number)
  77.                }
  78.                if(Said[3,string] == "list-user"){
  79.                    # For each table entry
  80.                    for(I = 1, Table_User:count()){
  81.                        # Sets the ticket count to Number
  82.                        #print(table():getName(Table_User[I,number]))
  83.                    }
  84.                }
  85.            }
  86.        }
  87.    }elseif(chatClk()){
  88.        # Get last said of owner
  89.        local Said = lastSaid():lower():explode(" ")
  90.        
  91.        # Tests for the commands
  92.        if(Said[1,string] == ".casino" || Said[1,string] == ".c"){
  93.            if(Said[2,string] == "balance" || Said[2,string] == "b"){
  94.                
  95.            }
  96.        }
  97.    }
  98. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement