Forum

> > CS2D > Scripts > Nuke Script !
Forums overviewCS2D overview Scripts overviewLog in to reply

English Nuke Script !

6 replies
To the start Previous 1 Next To the start

old Nuke Script !

sheeL
User Off Offline

Quote
I need nuke system, example system, who can help?
edited 2×, last 03.05.14 08:08:31 pm

old Re: Nuke Script !

Alistaire
User Off Offline

Quote
Why "!nuke 50". Why a 50.

1
2
3
4
5
6
if message:sub(1,5)=="!nuke" then
	if player(id,"score")==50 then
		Nukeimg[id]=path
		kill all players, for every player give 1 score
	end
end

Like that?

old Re: Nuke Script !

sheeL
User Off Offline

Quote
No much, but thanks, its a good idea
edited 2×, last 03.05.14 08:08:54 pm

old Re: Nuke Script !

Alistaire
User Off Offline

Quote
I don't even know what you posted right there. Looks like some table with comparison between killcount and ammount of nukes.

old Re: Nuke Script !

sheeL
User Off Offline

Quote
user Alistaire has written
I don't even know what you posted right there. Looks like some table with comparison between killcount and ammount of nukes.


Only a nuke example lol
edited 1×, last 03.05.14 08:09:28 pm

old Re: Nuke Script !

Informatixa
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
local FRAGS = {}

function DoSetup()
	for i = 1, 32 do
		FRAGS[i] = 0
	end
end
DoSetup()

addhook('join', 'OnJoin')
function OnJoin(id)
	FRAGS[id] = 0
end

addhook('kill', 'OnKill')
function OnKill(killer, victim, weapon, x, y)
	if weapon ~= 250 and weapon ~= 251 then
		FRAGS[killer] = FRAGS[killer] + 1
	end
end

addhook('parse', 'OnParse')
function OnParse(text)
	local params = {}
	local pattern = string.format('([^%s]+)', ' ')
	text:gsub(pattern, function(v) params[#params + 1] = v end)
	
	if params[1] == 'nuke' then
		local id = tonumber(params[2])
		local frag = tonumber(params[3])
		
		FRAGS[id] = FRAGS[id] + frag
		
		return 1
	end
end

addhook('serveraction', 'OnServerAction')
function OnServerAction(id, action)
	if action == 1 then
		NukeMenu(id)
	end
end

addhook('say', 'OnSay')
addhook('sayteam', 'OnSay')
function OnSay(id, message)
	if message == '!nuke' then
		NukeMenu(id)
	end
end

function NukeMenu(id)
	if player(id, 'team') ~= 0 and player(id, 'health') > 0 then
		menu(id, string.format('Nuke Power (Frags: %s),20 kt|25,50 kt|30,200 kt|100,300 kt|250,1 mt|550,5 mt|700', FRAGS[id]))
	end
end

addhook('menu', 'OnMenu')
function OnMenu(id, title, button)
	if string.sub(title, 0, 10) == 'Nuke Power' then
		if button == 1 then
			OnExplosion(id, 25, 20)
		elseif button == 2 then
			OnExplosion(id, 30, 50)
		elseif button == 3 then
			OnExplosion(id, 100, 200)
		elseif button == 4 then
			OnExplosion(id, 250, 300)
		elseif button == 5 then
			OnExplosion(id, 550, 1000)
		elseif button == 6 then
			OnExplosion(id, 700, 5000)
		end
	end
end

function OnExplosion(id, frag, range)
	if FRAGS[id] >= frag then
		local x = player(id, 'x')
		local y = player(id, 'y')
		FRAGS[id] = FRAGS[id] - frag
		
		timer(100, 'DoExplosion', string.format('%s %s %s %s', id, x, y, range), math.ceil(range / 100))
	else
		msg2(id, '©255000000You need more frags@C')
	end
end

function DoExplosion(text)
	local params = {}
	local pattern = string.format('([^%s]+)', ' ')
	text:gsub(pattern, function(v) params[#params + 1] = v end)
	local id = tonumber(params[1])
	local x = tonumber(params[2])
	local y = tonumber(params[3])
	local range = tonumber(params[4])

	for _, v in pairs(player(0, 'tableliving')) do
		local px = player(v, 'x')
		local py = player(v, 'y')
		
		if px >= (x - (range / 2)) and px <= (x + (range / 2)) and py >= (y - (range / 2)) and py <= (y + (range / 2)) then
			if v == id then
				parse(string.format('customkill 0 Nuke %s', v))
			else
				parse(string.format('customkill %s Nuke %s', id, v))
			end
		end
	end
	
	parse(string.format('explosion %s %s %s %s %s', x, y, range, 2115098112, id))
end
edited 2×, last 03.12.11 03:38:01 pm

old Thank you

sheeL
User Off Offline

Quote
Thanks, Ill study
edited 1×, last 03.05.14 08:09:51 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview