Forum

> > CS2D > Scripts > Some ammo system
Forums overviewCS2D overview Scripts overviewLog in to reply

English Some ammo system

11 replies
To the start Previous 1 Next To the start

old Some ammo system

Masea
Super User Off Offline

Quote
Hi guys, Today i wanna make a ammo system like Half-Life.

but i got some problems, its really hard to make for me.

When i got glock, my ammo is 20/0 then if i pick any glock again i will get 20/0+20. I want this. I know, my english is really reallyyy bad... Hoping you understand this.

Anyways, thank you.

If you guys do it for me i will make very nice map/maps.

old Re: Some ammo system

THEMUD
User Off Offline

Quote
Try this code:
1
2
3
4
5
6
7
8
addhook("collect", "_collect")
function _collect(id, iid, type, ain, a, mode)
	local pl_item = player(id, "weapontype")
	if(iid == pl_item)
		then
		parse("setammo "..id.." "..pl_item.." "..ain.." "..a)
	end
end
I didn't test it, but hopefully will work.

old Re: Some ammo system

Masea
Super User Off Offline

Quote
Guys how can i reach glock18's ammo(not ammoin)? Please help me, i really need that.

old Re: Some ammo system

Masea
Super User Off Offline

Quote
Ok..

Did you play half life?
When I picked up a glock i will got 20 bullets already loaded to weapon(dont need reload) then I picked again other glock i will got 20 bullets ammo.. total is 20/20.
Did you understand me know?

1
parse("setammo "..id.." 2 20 "..I really dont know what i need to put here+20)

Everytime when i got glock it gives me 20 bullet, but i dont know how can i make this code. I try this codes but didnt work;
-itemtype(2,"ammo")+20
-item(1,"ammo")+20

old Re: Some ammo system

Mora
User On Online

Quote
Only need to change this shit, "..a+20.." i'm also don't know. Maybe this is just impossible?
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
unlock = {}

addhook("join","_join")
function _join(id)
unlock[id]=0
end

addhook("leave","_leave")
function _leave(id)
unlock[id]=0
end

addhook("walkover","_collect")
function _collect(id,iid,type,ain,a,mode)
	if type == 2 then
		if unlock[id]==0 then
		unlock[id]=1
	parse("equip "..id.." 2")
	parse("removeitem "..iid)
	parse("setammo "..id.." 2 20 0")
	return 1
		elseif unlock[id]==1 then
	parse("setammo "..id.." 2 1000 "..a+20 .."")
	parse("removeitem "..iid)
	return 1
		end
	end
end

addhook("drop","_drop")
function _drop(id)
return 1
end

old Re: Some ammo system

Masea
Super User Off Offline

Quote
Thanks all, I made it really!!
Now all weapons have own ammos!! THANKS MY GOD and you guys!

old Re: Some ammo system

Masea
Super User Off Offline

Quote
Dont waste your time for make comment for this thread guys. I made all what i want and i will make a video about this. :DD
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview