SHARE
TWEET

Untitled

a guest Jun 20th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @name Printer collect
  2. @outputs Fire
  3. @persist [Bitminers]:array [Bitclass]:table UserFound Gray:vector CollectNum Collecting User:entity
  4. @autoupdate
  5. #[How to use this piece of shit:
  6. Put it down somewhere.
  7. Put a user real close to it.
  8. Pull out your grav gun.
  9. Aim at a bit miner.
  10. Click.
  11. Carry on about your day.]#
  12.  
  13. if(first()){
  14.     timer("collect",300000)
  15.     timer("userfind",250)
  16.     findIncludePlayerProps(owner())
  17.    
  18.     Bitclass["sent_elegant_printer",number] = 1
  19.  
  20.     Gray = vec(150,150,150)
  21.    
  22.     function number entExists(Ent:entity,Ar:array){
  23.         foreach(I,E:entity = Ar){
  24.             if(E == Ent){
  25.                 return I
  26.             }
  27.         }
  28.         return 0
  29.     }
  30. }
  31.  
  32. #Finding the user
  33. if(clk("userfind")){
  34.     findByClass("gmod_wire_user")
  35.     foreach(I,E:entity = findToArray()){
  36.         if(E:pos():distance(entity():pos()) < 20){
  37.             User = E
  38.             User:createWire(entity(),"Fire","Fire")
  39.             User:setPos(entity():pos() + vec(0,0,10))
  40.             User:setAng(ang(0,0,180))
  41.             UserFound = 1
  42.             printColor(Gray,"User found.")
  43.             break
  44.         }
  45.     }
  46.     if(!UserFound){
  47.         timer("userfind",250)
  48.     }
  49. }
  50.  
  51. #Adding Printers
  52. if(owner():weapon():type() != "weapon_physcannon"){
  53.     interval(100)
  54.     runOnTick(0)
  55. }
  56. else{
  57.     runOnTick(1)
  58.     if(owner():keyAttack1()){
  59.         local Ent = owner():aimEntity()
  60.         if(Bitclass[Ent:type(),number]){
  61.             if(!entExists(Ent,Bitminers)){
  62.                 Bitminers:pushEntity(Ent)
  63.                 printColor(Gray,"Printer added.")
  64.             }
  65.         }
  66.     }
  67. }
  68.  
  69. #Collecting money
  70. if(clk("collect")){
  71.     if(Bitminers:count()){
  72.         Collecting = 1
  73.         CollectNum = 1
  74.         timer("col1",100)
  75.         printColor(Gray,"Collecting from "+Bitminers:count()+" Printers...")
  76.     }
  77.     else{
  78.         timer("collect",300000)
  79.         printColor(vec(255,0,0),"No Printers to collect from.")
  80.     }
  81. }
  82.  
  83. if(Collecting){
  84.     if(clk("col1")){
  85.         User:setPos(Bitminers[CollectNum,entity]:pos() + vec(0,0,5))
  86.         timer("col2",250)
  87.     }
  88.     if(clk("col2")){
  89.         Fire = 1
  90.         timer("col3",250)
  91.     }
  92.     if(clk("col3")){
  93.         Fire = 0
  94.         CollectNum++
  95.         if(CollectNum > Bitminers:count()){
  96.             timer("collect",300000)
  97.             printColor(Gray,"Collection completed!")
  98.             User:setPos(entity():pos() + vec(0,0,10))
  99.             User:setAng(ang(0,0,180))
  100.             Collecting = 0
  101.             CollectNum = 0
  102.         }
  103.         else{
  104.             timer("col1",250)
  105.         }
  106.     }
  107. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top