Forum

> > CS2D > General > Lua scripting
Forums overviewCS2D overviewGeneral overviewLog in to reply

English Lua scripting

31 replies
Page
To the start Previous 1 2 Next To the start

old Re: Lua scripting

wolfteam32
User Off Offline

Quote
1. I dont know why it is "lua.lua" in folder is just "server.lua" and nothing else
2. I have that file because when im put this sound file when someone is killing someone that sound has be played
1
2
parse("sv_sound \"fun/sonofabitch.wav\"")
msg (player(killer,"name").." is killing like Duke Nukem!! "..level.." KILLS!@C")

Edit: Yay its works thx so much guys!!!

Edit2: another question: How to play another sound when CT or T win ?? In Hero script i see this and i cant do that always i have error pls help!
edited 3×, last 02.07.09 05:51:31 pm

old Re: Lua scripting

SQ
Moderator Off Offline

Quote
Wait.
I will make in same method like in my super hero
(5 mins)
Its not changing sound.
Round start + type of winning sound

old Re: Lua scripting

SQ
Moderator Off Offline

Quote
There is my example.
(I havent tested it , but thats the way im using in my super hero script)

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
addhook("team","choseteam")
function choseteam(id,team)
	pteam[id]=team
end

addhook("startround","startr")
function startr()
	local i
	for i=1,32 do
		twin=game("winrow_t")
		ctwin=game("winrow_ct")
		if ctwin>0 then
			if pteam[i]==1 then parse("sv_sound2 "..i.." \"hero/roundend.ogg\"");end
			if pteam[i]==2 then parse("sv_sound2 "..i.." \"hero/roundend2.ogg\"");end
		end
		if twin>0 then
			if pteam[i]==2 then parse("sv_sound2 "..i.." \"hero/roundend.ogg\"");end
			if pteam[i]==1 then parse("sv_sound2 "..i.." \"hero/roundend2.ogg\"");end
		end
	end
end

function initArray(m)
local array = {}
	for i = 1, m do
	array[i]=0
	end
return array
end

pteam=initArray(32)

old Re: Lua scripting

wolfteam32
User Off Offline

Quote
thx work

Edit: How to do a comands for sample person. Np only for me and if this lua is on another serwer I type !laser and i got laser and anybody cant. PLs help!!

Edit 2: It is correct??
1
2
check (p,"name") if (name=="Sakarji") then
if (txt=="!laser") then parse("equip "..p.." 45"); end
edited 2×, last 06.07.09 05:53:54 pm

old Re: Lua scripting

wups
User Off Offline

Quote
mortyr22, can you stop flood your message everywhere about shoot 2 and then reload.

Why not use the noreload code at the filessection?
And then recode it.
To the start Previous 1 2 Next To the start
Log in to replyGeneral overviewCS2D overviewForums overview