Forum

> > CS2D > Scripts > Using a Different Scope & gun
Forums overviewCS2D overview Scripts overviewLog in to reply

English Using a Different Scope & gun

13 replies
To the start Previous 1 Next To the start

old Using a Different Scope & gun

Sparty
Reviewer Off Offline

Quote
I wonder is there anyway you can use a different Scope image(PNG)
For each Different gun like Famas scope.png
when you add the Red Dot Sight, ACOG Scope or something

1
2
Left Click and Scope for the gun comes on,
Click it again then comes off
Same as Sniper
edited 1×, last 16.12.11 12:23:16 pm

old Re: Using a Different Scope & gun

DevGru
User Off Offline

Quote
user Sparty has written
I wonder is there anyway you can use a different Scope image(PNG)
For each Different gun like Famas scope.png

1
2
Left Click and Scope for the gun comes on,
Click it again then comes off
Same as Sniper


But Famas doesn't have scope.

old Re: Using a Different Scope & gun

Sparty
Reviewer Off Offline

Quote
user DevGru has written
user Sparty has written
I wonder is there anyway you can use a different Scope image(PNG)
For each Different gun like Famas scope.png

1
2
Left Click and Scope for the gun comes on,
Click it again then comes off
Same as Sniper


But Famas doesn't have scope.

have you played mw3 not kind of that scope
but thanks
edited 1×, last 16.12.11 12:24:07 pm

old Re: Using a Different Scope & gun

Alistaire
User Off Offline

Quote
It's possible with Lua, but if you use a Famas for it, right clicking will activate the burst mode. You'll need an actionkey for it, which would work with every weapon after you figured out how to.

old Re: Using a Different Scope & gun

Informatixa
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
local Scope = {}
local Sprite = {}
local Weapons = {}

table.insert(Weapons, 30, {35, 55})
table.insert(Weapons, 32, {35, 55})

function DoSetup(id, img)
	if id ~= nil then
		Scope[id] = 0
		
		if img == true then
			if Sprite[id] ~= nil then
				for i = 1, 5 do
					freeimage(Sprite[id][i])
				end
			end
			
			Sprite[id] = {
				image('gfx/scope.png', -1280, -960, 3, id),
				image('gfx/gui_shade.bmp', -1280, -960, 3, id),
				image('gfx/gui_shade.bmp', -1280, -960, 3, id),
				image('gfx/gui_shade.bmp', -1280, -960, 3, id),
				image('gfx/gui_shade.bmp', -1280, -960, 3, id)
			}
			
			for i = 2, 5 do
				imagecolor(Sprite[id][i], 0, 0, 0)
				imageblend(Sprite[id][i], 3)
			end
		elseif Sprite[id] ~= nil then
			for i = 1, 5 do
				imagepos(Sprite[id][i], -1280, -960, 0)
			end
		end
	else
		for i = 1, 32 do
			DoSetup(i, true)
		end
	end
end
DoSetup()

function OnJoin(id)
	DoSetup(id)
end
addhook('join', 'OnJoin')

function OnAlways()
	reqcld(0, 2)
end
addhook('always', 'OnAlways')

function OnClientData(id, mode, x, y)
	if (mode == 2) then
		if Scope[id] > 0 then
			imagepos(Sprite[id][1], x, y, 0)
			imagepos(Sprite[id][2], x, y - 290, 0)
			imagepos(Sprite[id][3], x + 370, y, 0)
			imagepos(Sprite[id][4], x, y + 290, 0)
			imagepos(Sprite[id][5], x - 370, y, 0)
				
			imagescale(Sprite[id][2], 128, 38, 0)
			imagescale(Sprite[id][3], 54, 96, 0)
			imagescale(Sprite[id][4], 128, 38, 0)
			imagescale(Sprite[id][5], 54, 96, 0)
		end
	end
end
addhook('clientdata', 'OnClientData')

function DoScope(id)
	if player(id, 'team') > 0 and player(id, 'health') > 0 and Weapons[player(id, 'weapontype')] ~= nil then
		local mode = Scope[id] + 1
		
		OnScope(id, mode)
		
		if mode > 2 then
			DoSetup(id)
		else
			Scope[id] = mode
		end
	end
end

function OnServerAction(id, action)
	if action == 1 then
		DoScope(id)
	end
end
addhook('serveraction', 'OnServerAction')

function OnDie(victim, killer, weapon, x, y)
	DoSetup(victim)
end
addhook('die', 'OnDie')

function OnSelect(id, type, mode)
	DoSetup(id)
end
addhook('select', 'OnSelect')

function OnHit(id, source, weapon, hpdmg, apdmg)
	if Weapons[weapon] ~= nil then
		if Scope[source] == 1 then
			msg2(source, '-- 1x Zoom ('.. Weapons[weapon][1] ..')')
		elseif Scope[source] == 2 then
			msg2(source, '-- 2x Zoom ('.. Weapons[weapon][2] ..')')
		end
	end
end
addhook('hit', 'OnHit')

function OnScope(id, mode)
	
end
edited 2×, last 19.12.11 05:50:43 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview