Forum

> > CS2D > Scripts > start weapon
Forums overviewCS2D overview Scripts overviewLog in to reply

English start weapon

9 replies
To the start Previous 1 Next To the start

old Re: start weapon

Anti-Grav
User Off Offline

Quote
This should work:

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
addhook("spawn","onspawn")
addhook("serveraction","buymenu")
addhook("menu","menuopen")

function onspawn(id)
menu(id,"Buy Menu,AK-47,M4A1,Deagle,HE")
menuopen()
end

function menuopen(id,title,button)
if title == "Buy Menu" then
if button == 1 then
             if player(id,"money") <= 1000 then
                  parse("setmoney "..id.." "..(player(id,"money")-1000))
                  parse("equip "..id.." 30")
            elseif button == 2 then
               if player(id,"money") <= 2000 then
          parse("setmoney "..id.." "..(player(id,"money")-2000))
          parse("equip "..id.." 32")
          elseif button == 3 then
               if player(id,"money") <= 500 then
          parse("setmoney "..id.." "..(player(id,"money")-500))
          parse("equip "..id.." 3")
          elseif button == 4 then
                if player(id,"money") <= 300 then
          parse("setmoney "..id.." "..(player(id,"money")-300))
          parse("equip "..id.." 51")
          end
end
end

Add a entity: info_nobuying in the map.

Fixed
edited 1×, last 24.08.11 01:49:22 pm

old Re: start weapon

Homam
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
Addhook("spawn","start")
function start(id)
	menu(id,"The menus name, First weapon, Second weapon, etc")
end

addhook("menu","tehmenu")
function tehmenu(id,t,b)
	if t == "The menus name" then
		if b == 1 then
			parse ("equip "..id.." 1") -- The 1 is the id of the weapon.
		end
	end
end

If you can't understand, just use Anti-Grav's script. My script was easier... I think.

old Re: start weapon

Homam
User Off Offline

Quote
There's a wrong in Anti-Grav script, he write "f" instead of "If"
Anyways, I will make a script, similar to Anti-Grav's one.

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
addhook("spawn","spawning")
function spawning(id)
	menu(id,"Buy menu, Ak-47 | 1000, M4A1 | 2000, Deagle | 500, HE | 300")
end

addhook("menu","tehmenu")
function tehmenu(id,t,b)
	if t == "Buy menu" then
		if b == 1 then
			if player(id,"money") >= 1000 then
				parse("setmoney "..id.." "..(player(id,"money")-1000))
				parse("equip "..id.." 30")
			end
		end
		if b == 2 then
			if player(id,"money") >= 2000 then
				parse("setmoney "..id.." "..(player(id,"money")-2000))
				parse("equip "..id.." 32")
			end
		end
		if b == 3 then
			if player(id,"money") >= 500 then
				parse("setmoney "..id.." "..(player(id,"money")-500))
				parse("equip "..id.." 3")
			end
		end
		if b == 4 then
			if player(id,"money") >= 300 then
				parse("setmoney "..id.." "..(player(id,"money")-300))
				parse("equip "..id.." 51")
			end
		end
	end
end

Not tested. Tell me if there's a wrong.

Edit: Fixed the <= to >=.
edited 2×, last 25.08.11 04:32:37 pm

old Re: start weapon

Cure Pikachu
User Off Offline

Quote
@ user Homam & user Anti-Grav
You got the queries for checking money all wrong. It's supposed to be >=, not <= when checking for a player's money.
More >

@ user Spook MQ Hacker
Use the script above, I patched that careless mistake he did, along with an extra treat.
edited 1×, last 25.08.11 04:34:57 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview