Files

> > CS2D > Lua Scripts > [R] Multiple Weapon Buy
Files overviewCS2D overviewLua Scripts overview

English [R] Multiple Weapon Buy >

17 comments614 b, 508 Downloads

old [R] Multiple Weapon Buy

Ridho
User Off Offline

hi all

this is an easy script, only 43 lines
this script allows player to buy multiple weapons without dropping,

just edit the
1
jumlahminimum=2
"2" means total weapon that can be bought

Quote
Q: why only primary weapons!?
A: you can edit it by yourself


Rules
• You can use it, edit it,
or even reupload it (if you are brave enough to against the rules ) anyway I don't really care about it

FIXED
@user Talented Doge for finding free buy bug

thank you cookies
edited 4×, last 29.05.15 07:02:17 am
Approved by Infinite Rain

Download Download

614 b, 508 Downloads

Comments

17 comments
To the start Previous 1 Next To the start

Log in!

You need to log in to be able to write comments!Log in

old

DaisukeOno
User Off Offline

Don't see bad comments my friend, you're working hard for this. That is enough.
Quote
Indonesian : jumlah minimum=2
English : minimum amount=2

old

Ridho
User Off Offline

user Yates Im newbie lua scripter, what's the matter

user Stinger Im too lazy to translate to english

old

Stinger
User Off Offline

i like the "jumlahminimum" word at ur lua, lmao
I like it!

old

Rainoth
Moderator Off Offline

@user Yates: Decent coding. He just didn't add tabs.

old

Yates
Reviewer Off Offline

dat coding

old

Captione
User Off Offline

To be honest with you, it's 6 & 50. I looked at the script.
I like it!

old

Ridho
User Off Offline

user Captione yes, you can edit it but I think it's not really fun to buy many postols, in the script there's
1
weapon>6 and weapon <41     --If Im not forgot
it means weapon with id above 6 and below 41 (id 7 to 40) is allowed to buy multply

user VADemon I tried to find how to collect the dropped weapon when a player already has an equipped weapon, but I failed

old

VADemon
User Off Offline

user Talented Doge you forgot to check whether the player has enough money

I like the idea, but there's room for improvement. When it's possible to buy multiple weapons then the players must be able to pick up additional (up to the limit) weapons.
I like it!

old

Talented Doge
User Off Offline

Rewritten your code
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
limit = {}
limit.prim = {}
limit.sec = {}
primary_limit = 2
secondary_limit = 2

addhook("spawn", "_s")
addhook("buy", "_b")

function _s(p)
	limit.prim[p], limit.sec[p] = 0, 0
end

function _b(p, w)
	local m = player(p, "money") - itemtype(w, "price")
	if w >= 10 and w <= 40 then
		if limit.prim[p] < primary_limit and player(p, "money") >= m then
			limit.prim[p] = limit.prim[p] + 1
			buyit (p, w, m)
			return 1
		else return 0 end
	elseif w >= 1 and w <= 6 then
		if limit.sec[p] < secondary_limit and player(p, "money") >= m then
			limit.sec[p] = limit.sec[p] + 1
			buyit (p, w, m)
			return 1
		else return 0 end
	end
end

function buyit(p, w, m)
	parse ("setmoney "..p.." "..m)
	parse ("equip "..p.." "..w)
	parse ("setweapon "..p.." "..w)
end

I added checking secondary weapon, but not grenades, because rebuying grenades is...
edited 1×, last 22.05.15 10:57:33 pm

old

Pehlivan
User Off Offline

@user Captione: Nope, it can't or just with primary weapons (FAQ)

old

Captione
User Off Offline

@user Ridho: Currently using it. Can it do the same with nades, pistols, shields or non buy-able weapons?
I like it!

old

Ridho
User Off Offline

user Pseudon ya, the weapon won't dropped unless the "jumlahminimum" is reached, if It happened, the older weapon will be dropped

old

Pseudon
User Off Offline

It does so? If it does so, ok.
I like it!

old

Ridho
User Off Offline

user Talented Doge ew I forget to check it, I'll fix it soon, thanks

old

Talented Doge
User Off Offline

The players can buy for no cost...
To the start Previous 1 Next To the start