View difference between Paste ID: EFNEmpek and RAW8X0ub
SHOW: | | - or go back to the newest paste.
1
if CLIENT then
2
	resource.AddFile("materials/ending/cafebene.vtf")
3
	resource.AddFile("materials/ending/cafebene.vmt")
4
	resource.AddFile("materials/ending/ivyclub.vtf")
5
	resource.AddFile("materials/ending/ivyclub.vmt")
6
	resource.AddFile("materials/ending/afreecatv.vtf")
7
	resource.AddFile("materials/ending/afreecatv.vmt")
8
	resource.AddFile("materials/ending/afreecatv2.vtf")
9
	resource.AddFile("materials/ending/afreecatv2.vmt")
10
	resource.AddFile("materials/vgui/entities/ending_swep_bj.vtf")
11
	resource.AddFile("materials/vgui/entities/ending_swep_bj.vmt")
12
	
13
	SWEP.PrintName = "엔딩 건(Ending SWEP) 모든BJ용"
14
	SWEP.Author = "명박오니"
15
	SWEP.Instructions = "왼쪽:엔딩 오른쪽:라이플(데미지 셈)  총 안보이는게 정상입니다."
16
	SWEP.Slot = 1
17
	SWEP.SlotPos = 1
18
	SWEP.iconletter = "f"
19
	
20
	surface.CreateFont(
21
		"ProduceSupport", 
22
		{
23
			font 		= "malgun",
24
			size 		= 30,
25
			weight 		= 1000,
26
			blursize 	= 0,
27
			scanlines 	= 0,
28
			antialias 	= true,
29
			underline 	= false,
30
			italic 		= false,
31
			strikeout 	= false,
32
			symbol 		= false,
33
			rotary 		= false,
34
			shadow 		= true,
35
			additive 	= false,
36
			outline 	= true
37
		}
38
	)
39
end
40
41
SWEP.Category = "Other"
42
SWEP.Spawnable = true
43
SWEP.AdminOnly = true
44
SWEP.AdminSpawnable = true
45
SWEP.ViewModel = "models/weapons/v_pistol.mdl"
46
SWEP.WorldModel = "models/weapons/w_pistol.mdl"
47
SWEP.ViewModelFlip = true
48
SWEP.ViewModelFOV = 75.000
49
SWEP.Weight = 5
50
SWEP.AutoSwitchTo = false
51
SWEP.AutoSwitchFrom = false
52
SWEP.HoldType = "Pistol"
53
SWEP.FiresUnderwater = true
54
SWEP.DrawCrosshair = false
55
SWEP.DrawAmmo = true
56
SWEP.ReloadSound = "sound/weapons/alyxgun/alyx_gun_reload.wav"
57
58
-- General settings 일반 설정
59
CreateConVar("ending_white_enabled", "1")
60
61
-- PrimaryFire Settings 좌클릭 정보
62
SWEP.Primary.Sound = "weapons/ending/ending.wav"
63
SWEP.Primary.Damage = 999999999999999
64
SWEP.Primary.TakeAmmo = 1
65
SWEP.Primary.ClipSize = 10
66
SWEP.Primary.Ammo = "Pistol"
67
SWEP.Primary.DefaultClip = 500
68
SWEP.Primary.Spread = 0.1
69
SWEP.Primary.NumberofShots = 1
70
SWEP.Primary.Automatic = false
71
SWEP.Primary.Recoil = 1
72
SWEP.Primary.Delay = 2
73
SWEP.Primary.Force = 9999999999999
74
75
--SecondaryFire settings 우클릭 정보
76
SWEP.Secondary.Sound = "weapons/usp/usp1.wav"
77
SWEP.Secondary.Damage = 99999999999999999
78
SWEP.Secondary.TakeAmmo = 1
79
SWEP.Secondary.ClipSize = 45
80
SWEP.Secondary.Ammo = "Pistol"
81
SWEP.Secondary.DefaultClip = 500
82
SWEP.Secondary.Spread = 0.1
83
SWEP.Secondary.NumberofShots = 1
84
SWEP.Secondary.Automatic = true
85
SWEP.Secondary.Recoil = 1
86
SWEP.Secondary.Delay = 0.08
87
SWEP.Secondary.Force = 9999999999999999999
88
89
--SWEP:Initialize 초기화
90
function SWEP:Initialize() 
91
	util.PrecacheSound(self.Primary.Sound) 
92
	self:SetWeaponHoldType(self.HoldType)
93
end 
94
95
--SWEP:Deploy 무기를 들었을 때
96
function SWEP:Deploy()
97
98
	if SERVER then
99
		self:GetOwner():DrawViewModel(false)
100
	end
101
	
102
	if CLIENT then
103
		if game.SinglePlayer() then
104
			chat.AddText(Color(255,255,255), ply, "총 안보이는게 정상입니다.")
105
			chat.AddText(Color(255,0,0), ply, "싱글 플레이 상태입니다. 광고가 보이지 않습니다.")
106
		else
107
			chat.AddText(Color(255,255,255), ply, "총 안보이는게 정상입니다.")
108
		end
109
	end
110
	
111
end
112
113
--SWEP:PrimaryAttack 좌클릭 함수
114
function SWEP:PrimaryAttack()
115
116
	if not self:CanPrimaryAttack() then return end
117
	
118-
	--[[local owner = self:GetOwner()
118+
119
	
120
	local bullet = {}
121
		bullet.Num = self.Primary.NumberofShots -- is this correct? (lower case "of")
122
		bullet.Src = owner:GetShootPos()
123
		bullet.Dir = owner:GetAimVector()
124
		bullet.Spread = Vector(1, 1, 0) * self.Primary.Spread * 0.1
125
		bullet.Tracer = 0
126
		bullet.Force = self.Primary.Force
127
		bullet.Damage = self.Primary.Damage
128
		bullet.AmmoType = self.Primary.Ammo
129
	owner:FireBullets(bullet)
130
131
	local recoil = self.Primary.Recoil
132
	owner:ViewPunch(Angle(recoil * -1, recoil * math.Rand(-1, 1), recoil * -1))
133
	
134
	self:TakePrimaryAmmo(self.Primary.TakeAmmo)
135
	
136-
	self:ShootEffects()]]
136+
137
	self:EmitSound(self.Primary.Sound)
138
	self:DoSlowMotion(true)
139
140
	self:SetNextPrimaryFire(CurTime() + self.Primary.Delay)
141
end
142
143
SWEP.SecondaryAttack = SWEP.PrimaryAttack
144-
function SWEP:SecondaryAttack()
144+
145-
	--[[if not self:CanSecondaryAttack() then return end
145+
146
--[[function SWEP:SecondaryAttack()
147
	if not self:CanSecondaryAttack() then return end
148
149
	local owner = self:GetOwner()
150
	
151
	local bullet = {}
152
		bullet.Num = self.Secondary.NumberofShots
153
		bullet.Src = owner:GetShootPos()
154
		bullet.Dir = owner:GetAimVector()
155
		bullet.Spread = Vector(1, 1, 0) * self.Secondary.Spread * 0.1
156
		bullet.Tracer = 0
157
		bullet.Force = self.Secondary.Force
158
		bullet.Damage = self.Secondary.Damage
159
		bullet.AmmoType = self.Secondary.Ammo
160
	owner:FireBullets(bullet)
161
	
162
	self:TakeSecondaryAmmo(self.Secondary.TakeAmmo)
163
	
164
	self:ShootEffects()
165-
	self:SetNextSecondaryFire(CurTime() + self.Secondary.Delay)]]
165+
166
	
167
	self:SetNextSecondaryFire(CurTime() + self.Secondary.Delay)
168
end]]
169
170
do -- slowmotion
171
172
	local speed = 0.25 -- speed multiplier
173
	local pow = 2 -- This will make the sine curve shaper if you think it'S too smooth. Normal is 1
174-
	local F, NF, W, H = 0, 0, 0, 0
174+
175
	local F, F2, NF, W, H = 0, 0, 0, 0, 0
176
177
	if CLIENT then
178
		SWEP.Textures = {}
179
			
180
		function SWEP:DrawTexture(name)
181
			self.Textures[name] = self.Textures[name] or surface.GetTextureID(name)
182
			surface.SetTexture(self.Textures[name])
183
			surface.SetDrawColor (255, 255, 255, 255)
184
			surface.DrawTexturedRect(W /2 - 70, H -166, 256, 85)
185
		end
186
	end	
187
188
	-- time starts from 0 counts up.
189
	function SWEP:SlowMotionUpdate(time)
190
		time = time * speed
191
		
192
		F = math.sin(time * math.pi)
193
		F2 = math.sin((time * math.pi) * 8)
194
		NF = -F + 1
195
		
196
		if CLIENT then
197
			W, H = ScrW(), ScrH()
198
			
199
			local params = {}
200
201
				params["$pp_colour_addr"] = 0
202-
				params["$pp_colour_brightness"] = (F ^ pow) * 0.5
202+
203
				params["$pp_colour_addb"] = 0
204
				params["$pp_colour_brightness"] = (F2 ^ pow) * 0.5
205
				params["$pp_colour_contrast"] = 1
206
				params["$pp_colour_colour"] = NF
207
				params["$pp_colour_mulr"] = 0
208
				params["$pp_colour_mulg"] = 0
209
				params["$pp_colour_mulb"] = 0
210
			
211
			DrawColorModify(params)
212
213
			-- add alpha, draw alpha, delay
214
			DrawMotionBlur(NF + 0.25, 1, 0)
215
			
216
			DrawBloom(
217
				0, -- darken
218
				1, -- multiply
219
				
220
				2, -- sizex 
221
				2, -- sizey
222
				
223
				3, -- passes
224
				
225
				0, -- color
226
				
227
				0, -- red multiplier
228
				0, -- green multiplier
229
				0 -- blue multiplier
230
				
231
			)
232
			
233
			surface.SetFont("ProduceSupport")		
234
			surface.SetTextPos(W /2 - 190, H -140)
235
			surface.SetTextColor(255, 255, 255, 255)
236
			surface.DrawText("제작지원")
237
			
238
			-- I don't know if this order is correct..
239
									
240
			if time < 0.25 then
241
				self:DrawTexture("ending/cafebene")
242
			elseif time < 0.5 then
243
				self:DrawTexture("ending/ivyclub")
244
			elseif time < 0.75 then
245
				self:DrawTexture("ending/afreecatv")
246
			elseif time < 0.8 then	
247
				self:DrawTexture("ending/afreecatv2")
248
			end
249
		end
250
		
251
		if SERVER then
252
			-- setting it lower than 0.25 might cause the game to run into sync problems
253
			game.SetTimeScale(math.Clamp(NF, 0.25, 1))
254
		end
255
		
256
		if F < 0 then
257
			return false
258
		end		
259
	end
260
261
	if CLIENT then
262
		net.Receive("cafe_slomo", function()
263
			local self = net.ReadEntity()
264
			if self:IsValid() then
265
				self:DoSlowMotion()
266
			end
267
		end)
268
	end
269
	
270
	if SERVER then
271
		util.AddNetworkString("cafe_slomo")
272
	end
273
	
274
	function SWEP:DoSlowMotion(broadcast)
275
	
276
		local owner = self:GetOwner()
277
	
278
		if broadcast and CLIENT and owner ~= LocalPlayer() then return end
279
	
280
		if SERVER and broadcast then
281
			local clients = {}
282
			
283
			for _, ply in pairs(player.GetAll()) do
284
				if ply ~= owner then
285
					table.insert(clients, ply)
286
				end
287
			end
288
		
289
			net.Start("cafe_slomo")
290
				net.WriteEntity(self)
291
			net.Send(clients)
292
		end
293
		
294
		self.slomo_start = UnPredictedCurTime()
295
					
296
		local name = CLIENT and "RenderScreenspaceEffects" or "Think"
297
298
		hook.Add(name, tostring(self), function()
299
			if 
300
				not self:IsValid() or 
301
				not self:GetOwner():IsValid() or 
302
				self:GetOwner():GetActiveWeapon() ~= self or 
303
				self:SlowMotionUpdate(UnPredictedCurTime() - self.slomo_start) == false 
304
			then
305
				hook.Remove(name, tostring(self))
306
				self.slomo_start = nil
307
			end
308
		end)
309
	end
310
end