Forum

> > CS2D > Scripts > How many bullets have I used?
Forums overviewCS2D overview Scripts overviewLog in to reply

English How many bullets have I used?

24 replies
Page
To the start Previous 1 2 Next To the start

old Re: How many bullets have I used?

sheeL
User Off Offline

Quote
user Apache uwu has written
@user Avo: I've tested it, and it works fine.

Holding the attack button or pressing it adds to the attack counter appropriately.

For fast weapons such as the fn it will add to the counter faster than weapons such as the deagle.

user Avo has written
When I hold left mouse mouse it counts a lot of shots
-- that's normal


yeah , works for all wpns
and After Puts hudtxt2 "..id.." in script ...

old Re: How many bullets have I used?

Alistaire
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
BulletCount = {}
for i = 1000, 32255 do BulletCount[i] = 0 end

addhook('attack', 'BC_attack')
addhook('die', 'BC_die')
addhook('leave', 'BC_leave')

function BC_attack(id)
	BulletCount[player(id, 'weapontype') + id * 1000] = BulletCount[player(id, 'weapontype') + id * 1000] + 1
end

function BC_die(id)
	for i = id * 1000 + 1, id * 1000 + 255 do BulletCount[i] = 0 end
end

function BC_leave(id)
	for i = id * 1000 + 1, id * 1000 + 255 do BulletCount[i] = 0 end
end

old Re: How many bullets have I used?

Alistaire
User Off Offline

Quote
Spoiler >


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
BulletCount = {}
for i = 1000, 32255 do BulletCount[i] = 0 end

Weapons = {1, 2, 3, 4, 5, 6, 10, 11, 20, 21, 22, 23, 24, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40}

addhook('attack', 'BC_attack')
addhook('die', 'BC_die')
addhook('leave', 'BC_leave')

function BC_contains(Ctable, Ccontains)
	for _, Cvalue in pairs(Ctable) do
		if Cvalue == Ccontains then
			return true
		end
	end
	return false
end

function BC_attack(id)
	if BC_contains(Weapons, player(id, 'weapontype')) == true then
		BulletCount[player(id, 'weapontype') + id * 1000] = BulletCount[player(id, 'weapontype') + id * 1000] + 1
		parse('hudtxt 1 "©115115025'..BulletCount[player(id, 'weapontype') + id * 1000]..' Bullets fired with the current weapon 40 388 3')
	end
end

function BC_die(id)
	for i = id * 1000 + 1, id * 1000 + 255 do BulletCount[i] = 0 end
end

function BC_leave(id)
	for i = id * 1000 + 1, id * 1000 + 255 do BulletCount[i] = 0 end
end

Use dat.

old Re: How many bullets have I used?

EP
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
function hudtext2(id,tid,color,txt,x,y)
local toprint = ("©"..color.." "..txt)
parse('hudtxt2 '..id..' '..tid..' "'..toprint..'" '..x.." "..y)
end
function updateshots(id)
	hudtext2(id,1,"000255255","Shots = "..shots[id],490,400)
end
shots = {}
for i = 1,32 do
     shots[i] = 0
end
addhook("join","a")
function a(id)
shots[id] = 0
updateshots(id)
end
addhook("startround","b")
function b()
     for i = 1,32 do
          shots[i] = 0
          updateshots(i)
     end
end
addhook("attack","c")
function c(id)
shots[id] = shots[id] + 1
updateshots(id)
end
To the start Previous 1 2 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview