Forum

> > CS2D > Scripts > Human Bomb script sugestion
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Human Bomb script sugestion

5 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Human Bomb script sugestion

Mechanolith
User Off Offline

Zitieren
How can i do a script that the player can place a bomb on himself to sacrifice and explode other players, and when he is with the bomb equipped it shows a bomb on his back (a gfx).
The bomb could have a timer too, and it should cost 2000 and only Ts can have it.

Can someone make it to me, or only upload one at the File Archuive? please, i need it so much (i made a Iraq map and want to it have Human Bombs too). :p

alt Re: Human Bomb script sugestion

EngiN33R
Moderator Off Offline

Zitieren
I'm making the script two ways - with say hook and with serveraction hook. Tell me if it doesn't work, I'll fix it.

I'm not doing the GFX though, you have to do it yourself. I've replaced the image path with "yourimagepath".

You press F2 to explode, write "!bomb" to buy a bomb.

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
function initArray2(f,v)
	local cmd={}
	for i=1,f do
		cmd[i]=v
	end
	return cmd
end	

carriesbomb=initArray2(32,false)		
bombgfx=initArray2(32,0)

addhook("say","saybuy")
function saybuy(id,t)
	if (t=="!bomb" and player(id,"team")==1) then
		bombgfx[id]=image("yourimagepath",1,0,200+id)
		carriesbomb[id]=true
		parse("setmoney "..id.." "..(player(id,"money")-2000))
		return 1
	end
end

addhook("serveraction","explode")
function explode(id,a)
	if (a==1 and carriesbomb[id]) then
		timer(5000,"parse","explosion "..player(id,"x").." "..player(id,"y").." 96 100 "..id)
		msg2(id,"5 seconds until explosion...")
		timer(1000,"parse","lua msg2(id,\"4...\")")
		timer(2000,"parse","lua msg2(id,\"3...\")")
		timer(3000,"parse","lua msg2(id,\"2...\")")
		timer(4000,"parse","lua msg2(id,\"1...\")")
		timer(5000,"parse","lua carriesbomb["..id.."]=false")
		timer(5000,"parse","lua freeimage(bombgfx["..id.."])")
		timer(5000,"parse","lua bombgfx["..id.."]=0")
	end
end

SERVERACTION EDITION
You press F2 to explode, F3 to buy the bomb.

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
function initArray2(f,v)
	local cmd={}
	for i=1,f do
		cmd[i]=v
	end
	return cmd
end	

carriesbomb=initArray2(32,false)		
bombgfx=initArray2(32,0)

addhook("serveraction","explode")
function explode(id,a)
	if (a==1 and carriesbomb[id]) then
		msg2(id,"5 seconds until explosion...")
		timer(1000,"parse","lua msg2(id,\"4...\")")
		timer(2000,"parse","lua msg2(id,\"3...\")")
		timer(3000,"parse","lua msg2(id,\"2...\")")
		timer(4000,"parse","lua msg2(id,\"1...\")")
		timer(5000,"parse","lua carriesbomb["..id.."]=false")
		timer(5000,"parse","lua freeimage(bombgfx["..id.."])")
		timer(5000,"parse","lua bombgfx["..id.."]=0")
	end
	if (a==2 and player(id,"team")==1) then
		bombgfx[id]=image("yourimagepath",1,0,200+id)
		carriesbomb[id]=true
		parse("setmoney "..id.." "..(player(id,"money")-2000))
	end
end

alt Re: Human Bomb script sugestion

Mechanolith
User Off Offline

Zitieren
Thank you so much
But when the bomb explodes, the player don't die
There are still some bugs:
•Player can buy how much bombs he want (he should buy once at round).
•Bomb explodes where the player activated it (it should explode where he is when the timer reach 0).
•Anyone die with the explosion (it should kill the bomb player, and the near players, even the teammates if FF is on).

I only found that 3 ones, i hope you could fix it, i would be much thankful
1× editiert, zuletzt 08.01.11 16:51:51

alt Re: Human Bomb script sugestion

EngiN33R
Moderator Off Offline

Zitieren
I'm redoing the say hook, I'm too lazy to do the serveraction edition too.

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
function initArray2(f,v)
     local cmd={}
     for i=1,f do
          cmd[i]=v
     end
     return cmd
end     

carriesbomb=initArray2(32,false)          
bombgfx=initArray2(32,0)

addhook("say","saybuy")
function saybuy(id,t)
     if (t=="!bomb" and player(id,"team")==1 and not carriesbomb[id]) then
          bombgfx[id]=image("yourimagepath",1,0,200+id)
          carriesbomb[id]=true
          parse("setmoney "..id.." "..(player(id,"money")-2000))
          return 1
     end
end

addhook("serveraction","explode")
function explode(id,a)
     if (a==1 and carriesbomb[id]) then
          timer(5000,"parse","explosion "..player(id,"x").." "..player(id,"y").." 96 100 "..id)
          timer(5000,"parse","killplayer "..id)
     end
end

Tell me whether this has the bugs fixed or not. PM me for further development of this script.

alt Re: Human Bomb script sugestion

Mechanolith
User Off Offline

Zitieren
Well... i think that it's working 100%
Thanks, but im not the stealer kind
Ill not publish it, it was my idea only, you made the whole script, so, publish it if u want
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht