Guest User

Untitled

a guest
Jul 22nd, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.57 KB | None | 0 0
  1. --新浪微博:@戈登走過去
  2. --Twitter:@Gordonwalkedby
  3. --just a changed version of garrysmod/garrysmod/gamemodes/sandbox/gamemode/cl_init.lua
  4.  
  5. CreateConVar( "HIDE_SboxNotifyAll", 0 , 128, "Make me into 1 to mute and hide the notify of Sandbox Undo, Unfroze, CLEANUP, Limit. " )
  6. CreateConVar( "HIDE_SboxNotifysound", 0 , 128, "Make me into 1 to mute the sound of Sandbox Undo, Unfroze, CLEANUP, Limit. " )
  7. CreateConVar( "HIDE_SboxNotifytext", 0 , 128, "Make me into 1 to hide the notify of Sandbox Undo, Unfroze, CLEANUP, Limit. " )
  8.  
  9. --[[---------------------------------------------------------
  10.  
  11. Sandbox Gamemode
  12.  
  13. This is GMod's default gamemode
  14.  
  15. -----------------------------------------------------------]]
  16.  
  17. include( 'shared.lua' )
  18. include( 'cl_spawnmenu.lua' )
  19. include( 'cl_notice.lua' )
  20. include( 'cl_hints.lua' )
  21. include( 'cl_worldtips.lua' )
  22. include( 'cl_search_models.lua' )
  23. include( 'gui/IconEditor.lua' )
  24.  
  25. --
  26. -- Make BaseClass available
  27. --
  28. DEFINE_BASECLASS( "gamemode_base" )
  29.  
  30.  
  31. local physgun_halo = CreateConVar( "physgun_halo", "1", { FCVAR_ARCHIVE }, "Draw the physics gun halo?" )
  32.  
  33. function GM:Initialize()
  34.  
  35. BaseClass.Initialize( self )
  36.  
  37. end
  38.  
  39. function GM:LimitHit( name )
  40.  
  41. if GetConVarNumber( "HIDE_SboxNotifyAll" ) == 1 then return end
  42.  
  43. if GetConVarNumber( "HIDE_SboxNotifytext" ) == 0 then self:AddNotify( "#SBoxLimit_"..name, NOTIFY_ERROR, 6 ) end
  44. if GetConVarNumber( "HIDE_SboxNotifysound" ) == 0 then surface.PlaySound( "buttons/button10.wav" ) end
  45.  
  46. end
  47.  
  48. function GM:OnUndo( name, strCustomString )
  49.  
  50. if GetConVarNumber( "HIDE_SboxNotifyAll" ) == 1 then return end
  51.  
  52. if GetConVarNumber( "HIDE_SboxNotifytext" ) == 0 then
  53. if ( !strCustomString ) then
  54. self:AddNotify( "#Undone_"..name, NOTIFY_UNDO, 2 )
  55. else
  56. self:AddNotify( strCustomString, NOTIFY_UNDO, 2 )
  57. end
  58. end
  59.  
  60. -- Find a better sound :X
  61. if GetConVarNumber( "HIDE_SboxNotifysound" ) == 0 then surface.PlaySound( "buttons/button15.wav" ) end
  62.  
  63. end
  64.  
  65. function GM:OnCleanup( name )
  66.  
  67. if GetConVarNumber( "HIDE_SboxNotifyAll" ) == 1 then return end
  68.  
  69. if GetConVarNumber( "HIDE_SboxNotifytext" ) == 0 then self:AddNotify( "#Cleaned_"..name, NOTIFY_CLEANUP, 5 ) end
  70.  
  71. -- Find a better sound :X
  72. if GetConVarNumber( "HIDE_SboxNotifysound" ) == 0 then surface.PlaySound( "buttons/button15.wav" ) end
  73.  
  74. end
  75.  
  76. function GM:UnfrozeObjects( num )
  77.  
  78. if GetConVarNumber( "HIDE_SboxNotifyAll" ) == 1 then return end
  79.  
  80. if GetConVarNumber( "HIDE_SboxNotifytext" ) == 0 then self:AddNotify( "Unfroze "..num.." Objects", NOTIFY_GENERIC, 3 ) end
  81.  
  82. -- Find a better sound :X
  83. if GetConVarNumber( "HIDE_SboxNotifysound" ) == 0 then surface.PlaySound( "npc/roller/mine/rmine_chirp_answer1.wav" ) end
  84.  
  85. end
  86.  
  87. function GM:HUDPaint()
  88.  
  89. self:PaintWorldTips()
  90.  
  91. -- Draw all of the default stuff
  92. BaseClass.HUDPaint( self )
  93.  
  94. self:PaintNotes()
  95.  
  96. end
  97.  
  98. --[[---------------------------------------------------------
  99. Draws on top of VGUI..
  100. -----------------------------------------------------------]]
  101. function GM:PostRenderVGUI()
  102.  
  103. BaseClass.PostRenderVGUI( self )
  104.  
  105. end
  106.  
  107. local PhysgunHalos = {}
  108.  
  109. --[[---------------------------------------------------------
  110. Name: gamemode:DrawPhysgunBeam()
  111. Desc: Return false to override completely
  112. -----------------------------------------------------------]]
  113. function GM:DrawPhysgunBeam( ply, weapon, bOn, target, boneid, pos )
  114.  
  115. if ( physgun_halo:GetInt() == 0 ) then return true end
  116.  
  117. if ( IsValid( target ) ) then
  118. PhysgunHalos[ ply ] = target
  119. end
  120.  
  121. return true
  122.  
  123. end
  124.  
  125. hook.Add( "PreDrawHalos", "AddPhysgunHalos", function()
  126.  
  127. if ( !PhysgunHalos || table.Count( PhysgunHalos ) == 0 ) then return end
  128.  
  129.  
  130. for k, v in pairs( PhysgunHalos ) do
  131.  
  132. if ( !IsValid( k ) ) then continue end
  133.  
  134. local size = math.random( 1, 2 )
  135. local colr = k:GetWeaponColor() + VectorRand() * 0.3
  136.  
  137. halo.Add( PhysgunHalos, Color( colr.x * 255, colr.y * 255, colr.z * 255 ), size, size, 1, true, false )
  138.  
  139. end
  140.  
  141. PhysgunHalos = {}
  142.  
  143. end )
  144.  
  145.  
  146. --[[---------------------------------------------------------
  147. Name: gamemode:NetworkEntityCreated()
  148. Desc: Entity is created over the network
  149. -----------------------------------------------------------]]
  150. function GM:NetworkEntityCreated( ent )
  151.  
  152. --
  153. -- If the entity wants to use a spawn effect
  154. -- then create a propspawn effect if the entity was
  155. -- created within the last second (this function gets called
  156. -- on every entity when joining a server)
  157. --
  158.  
  159. if ( ent:GetSpawnEffect() && ent:GetCreationTime() > (CurTime() - 1.0) ) then
  160.  
  161. local ed = EffectData()
  162. ed:SetOrigin( ent:GetPos() )
  163. ed:SetEntity( ent )
  164. util.Effect( "propspawn", ed, true, true )
  165.  
  166. end
  167.  
  168. end
Add Comment
Please, Sign In to add comment