Forum

> > CS2D > Scripts > additional secondary weapon collecting
Forums overviewCS2D overview Scripts overviewLog in to reply

English additional secondary weapon collecting

3 replies
To the start Previous 1 Next To the start

old additional secondary weapon collecting

_oops
User Off Offline

Quote
i trying to make script that let players can carry additional secondary weapons by using cs2d lua hook walkover.
when player try to collect weapon that player already has, the dropped weapon will disappear and their ammo will fill the player's secondary weapon's ammo.

ex) player has usp and ammo is 12|5, and dropped usp's ammo is 3|9, when player collect it, player's ammo will be 12|14.

i think cs2d lua cmd playerweapons will be the solution. and i tried it but i failed.

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
function initArray(m) 
local array = {} 
for i = 1, m do 
array[i]=0 
end 
return array 
end 


player_Weaponlimit=initArray(32)

addhook("walkover","secondarywep")
function secondarywep(id,iid,tp,ain,a)
	if (tp >= 1 and tp <= 6) then
		if player_Weaponlimit[id]<=1 then
		parse("equip "..id.." "..tp.."")
		parse("setammo "..id.." "..tp.." "..ain.." "..a.."")
		parse("removeitem "..iid.."")
		parse("setweapon "..id.." "..tp.."")
		parse("sv_sound2 "..id.." \"items/pickup.wav\"")
		player_Weaponlimit[id]=player_Weaponlimit[id]+1
		end
	end
end

addhook("drop","secondarydrop")
function secondarydrop(id,iid,tp)
	if tp>=1 and tp<=6 then
	player_Weaponlimit[id]=player_Weaponlimit[id]-1
	end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview