Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
Forums overviewCS2D overview Scripts overviewLog in to reply

English Lua Scripts/Questions/Help

6,770 replies
Page
To the start Previous 1 222 23 24338 339 Next To the start

old Re: Lua Scripts/Questions/Help

Mattman
User Off Offline

Quote
Eh, i have another question.

How do you make it so that only a player with a certain ID can choose that class (class 6 in this case)?

old Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Quote
set debuglua to 1

EDIT:

I need help here, if we admin, and the code like this
1
2
3
4
5
6
7
8
9
10
11
i = 1
   	while (i <= #admins) do
      	i = i + 1
	if (message == "!restart") then
	if (player(id, "usgn") == admins[i]) then
	msg("©255000000"..player(id, "name").." has restart the round")
	parse ("sv_restartround 1")
	return 1
	end
	end
	end

well, it's TheKilledDeath script tutorial i copied :D, anyway
if normal player type !restart and show message You cannot access to restart the game!, only admin can do this. help..
edited 2×, last 03.07.09 12:13:25 pm

old Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Quote
Heavy has written
@Admirdee: Did you add his/her USGN-ID to the #admins array?


what did you mean? add someone name to be admin?

old Re: Lua Scripts/Questions/Help

Alpha Beta
User Off Offline

Quote
Yep. Otherwise it dont work.
Arrays look like that:
1
admins = {USGNID, USGNID, USGNID,...}
Only ppl whose USGN-ID is in that array can use "!restart" at your script.
edited 1×, last 03.07.09 12:34:33 pm

old Re: Lua Scripts/Questions/Help

BetaM
User Off Offline

Quote
I have 2 questions. I wanted to make a football map with a lua script. I'm new to Lua, so I only managed to reduce te knife damage. My question is: how can I make that when I throw a snowball, and it hits the ground, it returns to the snowball's owner OR when the snowball hits the ground it creates itself on the ground. My second question is similar to the first: how can I make that when the snowball hits someone, the hit player gains a snowball?
So far I ended here:
1
2
3
4
5
6
7
8
addhook("hit","hit")
function hit(id,source,weapon,hpdmg,apdmg)
	parse("strip id")
	if (hpdmg > 0) then
		parse("strip id")
		parse("equip source 75")
	end
end
I put it in and... nothing.
edited 2×, last 03.07.09 01:34:30 pm

old Re: Lua Scripts/Questions/Help

ohaz
User Off Offline

Quote
Admirdee has written
I need help here, if we admin, and the code like this
..
well, it's TheKilledDeath script tutorial i copied :D, anyway
if normal player type !restart and show message You cannot access to restart the game!, only admin can do this. help..
1
2
3
4
5
6
7
8
9
10
11
12
13
i = 1
   	while (i <= #admins) do
      	i = i + 1
	if (message == "!restart") then
	if (player(id, "usgn") == admins[i]) then
	msg("©255000000"..player(id, "name").." has 	restart the round")
	parse ("sv_restartround 1")
	return 1
	else
	msg2(id,"You are not allowed to restart the game!")
	end
	end
	end

old Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Quote
thanks TKD,

and more,

1
2
3
4
5
6
7
addhook("reload","adm.classes.reload")
function adm.classes.reload(id,mode)
	if mode==1 then
	msg2(id,"©255255255Team: "..player(id,"name").." is reloading!")
	parse("sv_sound \"fun/reloading.wav\"")
	end
end

I want make reload sound, if someone reload a weapon, then sound reloading come like normal. but I only want that sound for team only, if teammate reloading, that team only can hear, opponent team can't hear that.
is that i'm to much?

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
@Mattman
I made script where only one Usgn id can join on "Admin" class.
(Admin have laser , speedmod and super armor)

I think your USGN ID is "19547" ... Right?

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
function initArray(m)
	local array = {}
	for i = 1, m do
		array[i]=0
	end
	return array
end

class=initArray(32)
function classmenu(id)
	menu(id,"Select your type,Simple User|Standart,Admin|19547")
end

addhook("team","team")
function team(id,team)
	if (team>0) then
		classmenu(id)
	end
end

addhook("menu","menus")
function menus(id,menu,sel)
	usgn = player(id, "usgn")
	if (menu=="Select your type") then
		if sel==1 then
			msg2(id,"©000255000Joined As Client@C")
			class[id]=1
		end
		if sel==2 then
			if usgn==19547 then
				msg2(id,"©000255000Joined As Admin@C")
				class[id]=2
			else
				msg2(id,"©255000000Usgn Id Dont Match@C")
				msg2(id,"©000255000Joined As Client@C")
				class[id]=1
			end
		end
	end
end

addhook("spawn","spawns")
function spawns(id)
	if class[id]==2 then
		parse ("setmaxhealth "..id.." 250")
		parse ("setarmor "..id.." 200")
		parse ("speedmod "..id.." 100")
		return "45,83,";
	end
end

old Re: Lua Scripts/Questions/Help

BetaM
User Off Offline

Quote
mat5b has written
So far I ended here:
1
2
3
4
5
6
7
8
addhook("hit","hit")
function hit(id,source,weapon,hpdmg,apdmg)
	parse("strip id")
	if (hpdmg > 0) then
		parse("strip id")
		parse("equip source 75")
	end
end
I put it in and... nothing.

I tried now again and it worked, but only for player id 1,2, and 3, how to make it to all players?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function hit(id,source,weapon,hpdmg,apdmg)
	if (hpdmg > 0) then
		if (id == 1) then
			parse("equip 1 75")
			parse("strip 2 75")
			parse("strip 3 75")
		end
		if (id == 2) then
			parse("equip 2 75")
			parse("strip 1 75")
			parse("strip 3 75")
		end
		if (id == 3) then
			parse("equip 3 75")
			parse("strip 2 75")
			parse("strip 1 75")
		end
	end
end
EDIT: Thanks.
edited 3×, last 03.07.09 04:12:50 pm

old Re: Lua Scripts/Questions/Help

Alpha Beta
User Off Offline

Quote
@mat5b:
1
2
3
4
5
6
7
8
9
addhook("hit","snowball")
function snowball(id,source,weapon,hpdmg,apdmg)
		if (hpdmg > 0) then
			if(weapon==75) then
				parse("strip "..source.." 75")
				parse("equip "..id.." 75")
			end
		end
end

Not tested.
edit:// worx for me
edited 1×, last 03.07.09 03:22:21 pm

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
Skipper has written
I need a Lua

For ZombieMod.

The Claw shouldn't kill a CT, it should make the CT to a T.

It's possible, I know

Same thing is not possible I think.

But possible to kill ct and make he spawn in same place he died.
edited 1×, last 17.01.10 12:35:20 am

old Re: Lua Scripts/Questions/Help

RAVENOUS
BANNED Off Offline

Quote
I don't meant that the Claw should kill the CT with 99999 damage.

Like this:

If Claw "touches" CT then make victim to T

Zombie will drop all weapons automatically?
To the start Previous 1 222 23 24338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview