Forum

> > CS2D > Scripts > Need Frags LUA scripts
Forums overviewCS2D overview Scripts overviewLog in to reply

English Need Frags LUA scripts

5 replies
To the start Previous 1 Next To the start

old Need Frags LUA scripts

-DIE Wolf-
User Off Offline

Quote
Hey us ! I need one LUA scripts like this:

If player press F2 then
Show menu like:
Quote
HE          5 frags
Flash          6 frags
Smoke     7 frags


That mean if u have 5 frags, u can buy HE!
If u have 7 frags, u can buy Smoke!
> If not enough frags, show something like : "U need more money!"

> Frag Should be show on the screen, like at bottom of the screen, show: " You frags : 5 "

If player join the game, frags=0

Help me if u can!

old Re: Need Frags LUA scripts

Alistaire
User Off Offline

Quote
To start off; do you have a way to count frags or do you not have a Lua script anyways? If you have one, what's the name of "frags" in the script, and probably, are they different for every id?

old Re: Need Frags LUA scripts

Alistaire
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
stats = {
	['kills'] = {}
}

for i = 1, 32 do stats.kills[i] = 0

addhook('kill', 'AA_kill')
addhook('menu', 'AA_menu')
addhook('serveraction', 'AA_serveraction')

function AA_kill(id, victim)
	stats.kills[id] = stats.kills[id] + 1
end

function AA_menu(id, title, button)
	if title == 'Fragmenu' then
		if button == 1 then
			if _checkkills(id, 5) then
				parse('equip '..id..' 51')
			end
		elseif button == 2 then
			if _checkkills(id, 6) then
				parse('equip '..id..' 52')
			end
		elseif button == 3 then
			if _checkkills(id, 7) then
				parse('equip '..id..' 53')
			end
		end
	end
end

function AA_serveraction(id, action)
	if action == '1' then
		_fragmenu(id)
	end
end

function _checkkills(id, nr)
	if stats.kills[id] >= nr then
		stats.kills[id] = stats.kills[id] - nr
		return true
	else
		msg2(id, '©200050050You do not have enough frags to buy this item')
	end
end

function _fragmenu(id)
	menu(id, 'Fragmenu,HE|5 frags,Flash|6 frags,Smoke|7 frags)
end

Didn't test; you're way to unclear about anything either.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview