Advertisement
Guest User

Untitled

a guest
Aug 25th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.74 KB | None | 0 0
  1. local mapscript = {}
  2.  
  3. function SetUpBomb() --Step 1
  4.     print( "Function SetUpBomb called" )
  5.     bombkeypad:SetNWString("NZText", "")
  6.     uraniumkeypad:SetNWString("NZText", "Press E to re-route all extra power to the back-up system." )
  7.     print( debug.traceback() )
  8. end
  9.  
  10. function SetUpUranium() --Step 2
  11.     print( "Function SetUpUranium called" )
  12.     uraniumkeypad:SetNWString("NZText", "")
  13.     transportkeypad:SetNWString("NZText", "Press E to stop transportation of fuel to generator.")
  14. end
  15.  
  16. function SetUpTransport() --Step 3
  17.     print( "Function SetUpTransport called" )
  18.     transportkeypad:SetNWString("NZText", "")
  19.     serverkeypad:SetNWString("NZText", "Press E to restart the generator server.")
  20.     --DELETE ALL FUEL CELLS HERE
  21. end
  22.  
  23. function SetUpServer() --Step 4
  24.     print( "Function SetUpServer called" )
  25.     serverkeypad:SetNWString("NZText", "")
  26.     keyboard:SetNWString("NZText", "Press E to restart the system.")
  27. end
  28.  
  29. function SetUpKeyboard() --Step 5
  30.     print( "Function SetUpKeyboard called" )
  31.     keyboard:SetNWString("NZText", "The system has been restarted. It is safe to enter the generator room.")
  32.     ents.FindByClass( "invis_damage_wall" )[1]:Remove()
  33. end
  34.  
  35. function mapscript.OnGameBegin()
  36.     nzEE.Major:Cleanup()
  37.     nzEE.Major:SetCurrentStep(1)
  38.     print( "Game has begun, cleaning up steps" )
  39.  
  40.     --//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
  41.  
  42.     print( "Setting up bombkeypad" )
  43.     bombkeypad = ents.GetMapCreatedEntity( 1932 ) --Map placed keypad
  44.     bombkeypad:SetNWString("NZText", "You must turn on the power first.")
  45.     bombkeypad.OnUsed = function(self, ply)
  46.         if !nzElec.Active then return end
  47.         print( "bombkeypad has been pressed, step ", nzEE.Major.CurrentStep )
  48.         nzEE.Major:CompleteStep( 1 )
  49.     end
  50.  
  51.     --//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
  52.  
  53.     print( "Setting up uraniumkeypad" )
  54.     uraniumkeypad = ents.Create( "nz_script_prop" ) --At player spawn
  55.     uraniumkeypad:SetModel( "models/props_lab/keypad.mdl" )
  56.     uraniumkeypad:SetPos( Vector(2664.217773, -804.056030, -67.161697) )
  57.     uraniumkeypad:SetAngles( Angle(0.000, 0.000, 0.000) )
  58.     uraniumkeypad:Activate()
  59.     uraniumkeypad:SetNWString("NZText", "You must turn on the power first.")
  60.     uraniumkeypad.OnUsed = function(self, ply)
  61.         print( "uraniumkeypad has been pressed" )
  62.         nzEE.Major:CompleteStep( 2 )
  63.     end
  64.  
  65.     --//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
  66.  
  67.     print( "Setting up transportkeypad" )
  68.     transportkeypad = ents.Create( "nz_script_prop" ) --By the transport lines
  69.     transportkeypad:SetModel( "models/props_lab/keypad.mdl" )
  70.     transportkeypad:SetPos( Vector(2040.146973, 755.274475, -135.572998) )
  71.     transportkeypad:SetAngles( Angle(-0.000, -135.000, -0.000) )
  72.     transportkeypad:Activate()
  73.     transportkeypad:SetNWString("NZText", "You must turn on the power first.")
  74.     transportkeypad.OnUsed = function(self, ply)
  75.         print( "transportkeypad has been pressed" )
  76.         nzEE.Major:CompleteStep( 3 )
  77.     end
  78.  
  79.     --//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
  80.  
  81.     print( "Setting up serverkeypad" )
  82.     serverkeypad = ents.Create( "nz_script_prop" ) --By the server machine
  83.     serverkeypad:SetModel( "models/props_lab/keypad.mdl" )
  84.     serverkeypad:SetPos( Vector(896.641296, -2195.425781, 50.405800) )
  85.     serverkeypad:SetAngles( Angle(-0.000, 180.000, 0.000) )
  86.     serverkeypad:Activate()
  87.     serverkeypad:SetNWString("NZText", "You must turn on the power first.")
  88.     serverkeypad.OnUsed = function(self, ply)
  89.         print( "serverkeypad has been pressed" )
  90.         nzEE.Major:CompleteStep( 4 )
  91.     end
  92.  
  93.     --//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
  94.  
  95.     print( "Setting up keyboard" )
  96.     keyboard = ents.Create( "nz_script_prop" ) --Keyboard used as final step
  97.     keyboard:SetModel( "models/props_c17/computer01_keyboard.mdl" )
  98.     keyboard:SetPos( Vector(861.911011, -784.504089, -22.218945) )
  99.     keyboard:SetAngles( Angle(-11.044, 104.943, 0.009) )
  100.     keyboard:Activate()
  101.     keyboard:SetNWString("NZText", "You must turn on the power first.")
  102.     keyboard.OnUsed = function(self, ply)
  103.         print( "keyboard has been pressed" )
  104.         nzEE.Major:CompleteStep( 5 )
  105.     end
  106.  
  107.     print( "Checking button validity..." )
  108.     print( "'Uranium' keypad...", IsValid(uraniumkeypad) )
  109.     print( "'Transport' keypad...", IsValid(transportkeypad) )
  110.     print( "'Server' keypad...", IsValid(serverkeypad) )
  111.     print( "'Keyboard' keypad...", IsValid(keyboard) )
  112.     print( "Testing OnUse functionality...")
  113.     print( "'Uranium' keypad...", uraniumkeypad.OnUse )
  114.     print( "'Transport' keypad...", transportkeypad.OnUse )
  115.     print( "'Server' keypad...", serverkeypad.OnUse )
  116.     print( "'Keyboard' keypad...", keyboard.OnUse )
  117.  
  118.     print( "Caching steps 1-5 into gamemode" )
  119.     nzEE.Major:AddStep(SetUpBomb, 1)
  120.     nzEE.Major:AddStep(SetUpUranium, 2)
  121.     nzEE.Major:AddStep(SetUpTransport, 3)
  122.     nzEE.Major:AddStep(SetUpServer, 4)
  123.     nzEE.Major:AddStep(SetUpKeyboard, 5)
  124. end
  125.  
  126. --//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
  127.  
  128. -- Any function added to this table will automatically get hooked to the hook with the same name
  129. function mapscript.RoundInit()
  130.     --[[uraniumkeypad:Spawn()
  131.     transportkeypad:Spawn()
  132.     serverkeypad:Spawn()
  133.     keyboard:Spawn()]]
  134. end
  135.  
  136. function mapscript.ElectricityOn()
  137.     print( "Electricity has been turned on! Setting keypad strings..." )
  138.     bombkeypad:SetNWString("NZText", "Press E to de-activate the self-destruct systems.")
  139.     uraniumkeypad:SetNWString("NZText", "You must de-activate the self-destruct sytems before attempting to re-route the power.")
  140.     transportkeypad:SetNWString("NZText", "You must re-route extra power to the back-up system before stopping the fuel line.")
  141.     serverkeypad:SetNWString("NZText", "You must stop the transportation of fuel before restarting the generator server.")
  142.     keyboard:SetNWString("NZText", "The server must be restarted before any operations continue.")
  143. end
  144.  
  145. -- This one will be called at the start of each round
  146. function mapscript.RoundStart()
  147.  
  148. end
  149.  
  150. -- Will be called every second if a round is in progress (zombies are alive)
  151. function mapscript.RoundThink()
  152.  
  153. end
  154.  
  155. -- Will be called after each round
  156. function mapscript.RoundEnd()
  157.  
  158. end
  159.  
  160. -- Only functions will be hooked, meaning you can safely store data as well
  161. mapscript.TestPrint = "v0.0"
  162. local testprint2 = "This is cool" -- You can also store the data locally
  163.  
  164. -- Always return the mapscript table. This gives it on to the gamemode so it can use it.
  165. return mapscript
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement