Advertisement
Guest User

Untitled

a guest
Aug 8th, 2015
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 10.73 KB | None | 0 0
  1.  
  2. --[[---------------------------------------------------------
  3.  
  4.   Apple's Gamemode
  5.  
  6.   This was made by Dr. Apple
  7.  
  8. -----------------------------------------------------------]]
  9.  
  10.  
  11.  
  12. -- Adding including files
  13. include( 'shared.lua' )
  14. include( 'menu/soundmenu.lua' )
  15. include( 'menu/materialsmenu.lua' )
  16. include( 'menu/f1_menu.lua' )
  17. include( 'menu/f2_menu.lua' )
  18. include( 'menu/f3_menu.lua' )
  19. include( 'menu/f3_menu_ranks.lua' )
  20. include( 'menu/f3_menu_classes.lua' )
  21. include( 'menu/f3_menu_ammo_types.lua' )
  22. include( 'menu/f3_menu_shop.lua' )
  23. include( 'menu/f4_menu.lua' )
  24. include( 'menu/classes_menu.lua' )
  25. include( 'menu/cl_adci_teams.lua' )
  26. include( 'hud/cl_apple_hud.lua' )
  27. include( 'hud/cl_apple_hud_fonts.lua' )
  28. include( "cs_ignore/client/csr_cvars.lua" )
  29. AmIAllowedToDisplaySpectator = 0
  30. TheLobbyAppleTime = 0
  31. TheLobbyAppleTimeID = 0
  32. YouAreTheMVP = 0
  33. NextMapNameID = 0
  34. RestartServerPleaseNowID = 0
  35. YouAreNotTheMVPID = 0
  36. TheGameAppleTimeID = 0
  37.     local KEY1_CLASSES_CLIENT = 0
  38.     local KEY2_CLASSES_CLIENT = 0
  39.     local KEY3_CLASSES_CLIENT = 0
  40.     local KEY4_CLASSES_CLIENT = 0
  41.     local KEY5_CLASSES_CLIENT = 0
  42.     local KEY6_CLASSES_CLIENT = 0
  43.     local KEY7_CLASSES_CLIENT = (1)
  44.  
  45. function GM:PostDrawViewModel( vm, ply, weapon )
  46. if ( weapon.UseHands || !weapon:IsScripted() ) then
  47. local hands = LocalPlayer():GetHands()
  48. if ( IsValid( hands ) ) then hands:DrawModel() end
  49. end
  50. end
  51.    
  52. function GetNiceNameofWeapon(data) -- This is to get the weapon name for the favorite weapons table
  53. local WeaponName = data:ReadEntity()
  54. local PlayerName = data:ReadEntity()
  55.     net.Start( "GetNiceNameofWeapon" )
  56.         if WeaponName:GetPrintName() == nil || WeaponName:GetPrintName() == "" || WeaponName:GetPrintName() == " " || WeaponName:GetPrintName() == NULL then
  57.             net.WriteString( WeaponName )
  58.         else
  59.             net.WriteString( WeaponName:GetPrintName() )
  60.         end
  61.     net.SendToServer( PlayerName )
  62. end
  63. usermessage.Hook("GetNiceNameofWeapon", GetNiceNameofWeapon)
  64.  
  65.  
  66.     hook.Add( "Think", "MenuKeyListener", function()
  67.         if input.IsKeyDown( KEY_A ) == true then
  68.             if KEY1_CLASSES_CLIENT == 0 then
  69.             KEY1_CLASSES_CLIENT = 1
  70.                 timer.Simple(KEY7_CLASSES_CLIENT, function()
  71.                     KEY1_CLASSES_CLIENT = 0
  72.                 end)
  73.             end
  74.         end
  75.         if input.IsKeyDown( KEY_P ) == true then
  76.             if KEY2_CLASSES_CLIENT == 0 then
  77.             KEY2_CLASSES_CLIENT = 1
  78.                 timer.Simple(KEY7_CLASSES_CLIENT, function()
  79.                     KEY2_CLASSES_CLIENT = 0
  80.                 end)
  81.             end
  82.         end
  83.         if input.IsKeyDown( KEY_P ) == true then
  84.             if KEY3_CLASSES_CLIENT == 0 then
  85.             KEY3_CLASSES_CLIENT = 1
  86.                 timer.Simple(KEY7_CLASSES_CLIENT, function()
  87.                     KEY3_CLASSES_CLIENT = 0
  88.                 end)
  89.             end
  90.         end
  91.         if input.IsKeyDown( KEY_L ) == true then
  92.             if KEY4_CLASSES_CLIENT == 0 then
  93.             KEY4_CLASSES_CLIENT = 1
  94.                 timer.Simple(KEY7_CLASSES_CLIENT, function()
  95.                     KEY4_CLASSES_CLIENT = 0
  96.                 end)
  97.             end
  98.         end
  99.         if input.IsKeyDown( KEY_E ) == true then
  100.             if KEY5_CLASSES_CLIENT == 0 then
  101.             KEY5_CLASSES_CLIENT = 1
  102.                 timer.Simple(KEY7_CLASSES_CLIENT, function()
  103.                     KEY5_CLASSES_CLIENT = 0
  104.                 end)
  105.             end
  106.         end
  107.         if KEY1_CLASSES_CLIENT == 1 then
  108.             if KEY2_CLASSES_CLIENT == 1 then
  109.                 if KEY3_CLASSES_CLIENT == 1 then
  110.                     if KEY4_CLASSES_CLIENT == 1 then
  111.                         if KEY5_CLASSES_CLIENT == 1 then
  112.                             if KEY6_CLASSES_CLIENT == 0 then
  113.                                 KEY6_CLASSES_CLIENT = 1
  114.                                
  115.                                 net.Start( "f3_apple_setting_reward_c" )
  116.                                 net.SendToServer( LocalPlayer() )
  117.                                
  118.                                 timer.Simple(3, function()
  119.                                     KEY6_CLASSES_CLIENT = 0
  120.                                 end)
  121.                             end
  122.                         end
  123.                     end
  124.                 end
  125.             end
  126.         end
  127.     end)
  128.    
  129.    
  130. function f3_apple_setting_reward_c(data)
  131. local Data2 = data:ReadString()
  132.     if Data2 == "1" then
  133.         Derma_Message("You've already done this, goodbye", "ERROR", "OK")
  134.     elseif Data2 == "0" then
  135.         Derma_Message("Congratulations, you've found the phrase! Here is bonus 1000 points!", "Congratulations", "OK")
  136.                                
  137.         local url = ("https://ia601502.us.archive.org/3/items/GerryRaffertyBakerStreetREMIX/Gerry%20Rafferty%20-%20Baker%20Street%20REMIX.mp3")
  138.         if LocalPlayer().gmod_apple_channel_sc ~= nil && LocalPlayer().gmod_apple_channel_sc:IsValid() then
  139.             LocalPlayer().gmod_apple_channel_sc:Stop()
  140.         end
  141.                                
  142.         sound.PlayURL(url,"",function(ch)
  143.             if ch != nil and ch:IsValid() then
  144.                 ch:Play()
  145.                 LocalPlayer().gmod_apple_channel_sc = ch
  146.             end
  147.         end)
  148.     end
  149. end
  150. usermessage.Hook("f3_apple_setting_reward_c", f3_apple_setting_reward_c)
  151.  
  152.  
  153. function TheGameAppleIntro(data)
  154.     local url = data:ReadString()
  155.     local time = data:ReadString()
  156.     timer.Simple(tonumber(time), function()
  157.         if LocalPlayer().gmod_apple_channel ~= nil && LocalPlayer().gmod_apple_channel:IsValid() then
  158.             LocalPlayer().gmod_apple_channel:Stop()
  159.         end
  160.     end)
  161.     if LocalPlayer().gmod_apple_channel ~= nil && LocalPlayer().gmod_apple_channel:IsValid() then
  162.         LocalPlayer().gmod_apple_channel:Stop()
  163.     end
  164.    
  165.     sound.PlayURL(url,"",function(ch)
  166.         if ch != nil and ch:IsValid() then
  167.             ch:Play()
  168.             LocalPlayer().gmod_apple_channel = ch
  169.         end
  170.     end)
  171. end
  172. usermessage.Hook("TheGameAppleIntro", TheGameAppleIntro)
  173.  
  174. function PlayWinSoundForAll(data)
  175.     local url = data:ReadString()
  176.  
  177.     if LocalPlayer().gmod_apple_channel ~= nil && LocalPlayer().gmod_apple_channel:IsValid() then
  178.         LocalPlayer().gmod_apple_channel:Stop()
  179.     end
  180.    
  181.     if LocalPlayer().gmod_apple_channel ~= nil && LocalPlayer().gmod_apple_channel:IsValid() then
  182.         LocalPlayer().gmod_apple_channel:Stop()
  183.     end
  184.    
  185.     sound.PlayURL(url,"",function(ch)
  186.         if ch != nil and ch:IsValid() then
  187.             ch:Play()
  188.             LocalPlayer().gmod_apple_channel = ch
  189.         end
  190.     end)
  191. end
  192. usermessage.Hook("PlayWinSoundForAll", PlayWinSoundForAll)
  193.  
  194. function LobbyTimerApple(data)
  195.     TheLobbyAppleTimeID = data:ReadShort()
  196.     TheLobbyAppleTime = data:ReadShort()
  197. end
  198. usermessage.Hook("LobbyTimerApple", LobbyTimerApple)
  199.  
  200. function TheGameAppleTimeFunc(data)
  201.     TheGameAppleTimeID = data:ReadShort()
  202.     TheGameAppleTime = data:ReadShort()
  203. end
  204. usermessage.Hook("TheGameAppleTimeFunc", TheGameAppleTimeFunc)
  205.  
  206. function YouAreNotTheMVP(data)
  207.     YouAreNotTheMVPID = data:ReadShort()
  208.     YouAreNotTheMVP = data:ReadString()
  209. end
  210. usermessage.Hook("YouAreNotTheMVP", YouAreNotTheMVP)
  211.  
  212. function YouAreTheMVP(data)
  213.     YouAreTheMVP = data:ReadShort()
  214. end
  215. usermessage.Hook("YouAreTheMVP", YouAreTheMVP)
  216.  
  217. function RestartServer2(data)
  218.     RestartServerPleaseNowID = data:ReadShort()
  219.     RestartServerPleaseNow = data:ReadShort()
  220. end
  221. usermessage.Hook("RestartServer2", RestartServer2)
  222.  
  223. function FoundAGreatMap(data)
  224.     NextMapNameID = data:ReadShort()
  225.     NextMapName = data:ReadString()
  226. end
  227. usermessage.Hook("FoundAGreatMap", FoundAGreatMap)
  228.  
  229. function AttemptingSuicideKill(data)
  230.     Derma_Message("Naughty, naughty, you're trying to escape death by killing yourself!", "DENIED BITCH", "Sucks to be you :(")
  231. end
  232. usermessage.Hook("AttemptingSuicideKill", AttemptingSuicideKill)
  233.  
  234. function PlayerIsSpectating(data)
  235.     AmIAllowedToDisplaySpectator = data:ReadShort()
  236.     AmIAllowedToDisplaySpectatorred = data:ReadShort()
  237.     AmIAllowedToDisplaySpectatorgreen = data:ReadShort()
  238.     AmIAllowedToDisplaySpectatorblue = data:ReadShort()
  239.     AmIAllowedToDisplaySpectator3 = data:ReadString()
  240. end
  241. usermessage.Hook("PlayerIsSpectating", PlayerIsSpectating)
  242.  
  243. function AppleCountDownStartSound(data)
  244. surface.PlaySound( "apples_tdm_gm/final_count.mp3" )
  245. surface.PlaySound( "apples_tdm_gm/wedding.mp3" )
  246. end
  247. usermessage.Hook("AppleCountDownStartSound", AppleCountDownStartSound)
  248.  
  249.  
  250. function AppleRankUpSoundEffect(data)
  251.     local url = data:ReadString()
  252.     local time = data:ReadString()
  253.     timer.Simple(tonumber(time), function()
  254.         if LocalPlayer().gmod_apple_channel ~= nil && LocalPlayer().gmod_apple_channel:IsValid() then
  255.             LocalPlayer().gmod_apple_channel:Stop()
  256.         end
  257.     end)
  258.     if LocalPlayer().gmod_apple_channel ~= nil && LocalPlayer().gmod_apple_channel:IsValid() then
  259.         LocalPlayer().gmod_apple_channel:Stop()
  260.     end
  261.    
  262.     sound.PlayURL(url,"",function(ch)
  263.         if ch != nil and ch:IsValid() then
  264.             ch:Play()
  265.             LocalPlayer().gmod_apple_channel = ch
  266.         end
  267.     end)
  268. end
  269. usermessage.Hook("AppleRankUpSoundEffect", AppleRankUpSoundEffect)
  270.  
  271. function APPLE_GM_HUD()
  272.     if AmIAllowedToDisplaySpectator == 1 then
  273.         draw.RoundedBoxEx( 0, 25, 25, 700, 35, Color(0,0,0,255), false, true, false, false )
  274.         draw.SimpleText( "YOU ARE CURRENTLY SPECTATING: "..AmIAllowedToDisplaySpectator3, "TDM_Mini", 45, 25, Color(AmIAllowedToDisplaySpectatorred,AmIAllowedToDisplaySpectatorgreen,AmIAllowedToDisplaySpectatorblue,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT, 0 )
  275.     end
  276.     if TheLobbyAppleTimeID == 1 then
  277.     local TheTimeQ = TheLobbyAppleTime - CurTime()
  278.         if TheTimeQ >= 0 then
  279.             surface.SetFont( "TDM_Mini" )
  280.             local lw, lh = surface.GetTextSize( "Lobby Timer: " .. string.ToMinutesSecondsMilliseconds( TheTimeQ ) )
  281.             draw.RoundedBoxEx( 0, 25, 145, lw + 6, 35, Color(0,0,0,255), false, true, false, false )
  282.             draw.SimpleText( "Lobby Timer: " .. string.ToMinutesSecondsMilliseconds( TheTimeQ ), "TDM_Mini", 28, 145, Color(255,255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT, 0 )
  283.         end
  284.     end
  285.  
  286. --  if TheGameAppleTimeID == 1 then
  287.     local TheTimeQ = TheGameAppleTime - CurTime(7)
  288.         if TheTimeQ >= 0 then
  289.             surface.SetFont( "TDM_Mini" )
  290.             local lw, lh = surface.GetTextSize( "Game Timer: " .. string.ToMinutesSecondsMilliseconds( TheTimeQ ) )
  291.             draw.RoundedBoxEx( 0, 25, 145, lw + 6, 35, Color(0,0,0,255), false, true, false, false )
  292.             draw.SimpleText( "Game Timer: " .. string.ToMinutesSecondsMilliseconds( TheTimeQ ), "TDM_Mini", 28, 145, Color(255,255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT, 0 )
  293.         end
  294. --  end
  295.  
  296.     if YouAreTheMVP == 1 then
  297.         draw.RoundedBoxEx( 0, ScrW()/2 - 500, 48, 1000, 58, Color(0,0,0,255), false, true, false, false )
  298.         draw.SimpleText( "CONGRATULATIONS, YOU ARE MVP", "TDM_Ammo_Secondary", ScrW()/2, 75, Color(255,255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 0 )
  299.     end
  300.     if YouAreNotTheMVPID == 1 then
  301.         draw.RoundedBoxEx( 0, ScrW()/2 - 500, 48, 1000, 58, Color(0,0,0,255), false, true, false, false )
  302.         draw.SimpleText( YouAreNotTheMVP.." is MVP", "TDM_Ammo_Secondary", ScrW()/2, 75, Color(255,255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 0 )
  303.     end
  304.     if RestartServerPleaseNowID == 1 then
  305.         local TheTimeQ = RestartServerPleaseNow - math.Round(CurTime())
  306.         local XVa = 300
  307.         if TheTimeQ >= 0 then
  308.             draw.RoundedBoxEx( 0, XVa, 115, 360, 35, Color(0,0,0,255), false, true, false, false )
  309.             draw.SimpleText( "Game Restart Timer: "..TheTimeQ, "TDM_Mini", XVa+15, 115, Color(255,255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT, 0 )
  310.         end
  311.     end
  312.     if NextMapNameID == 1 then
  313.         draw.RoundedBoxEx( 0, 300, 155, 400, 35, Color(0,0,0,255), false, true, false, false )
  314.         draw.SimpleText( "Next Map: "..NextMapName, "TDM_Mini", 315, 154, Color(255,255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT, 0 )
  315.     end
  316. end
  317. hook.Add("HUDPaint", "APPLE_GM_HUD", APPLE_GM_HUD)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement