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 2321 322 323338 339 Next To the start

old Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Quote
@GeNeSiS_MaSoN

1. Impossible.
2. Also Impossible unless if you put your own image on top of where it shows (needs to be transparent).
3. Easily done.

1
2
3
4
5
6
7
8
addhook('second','smallhealth');
function smallhealth()
	for p=1,32 do --Players 1-32
	     if player(p,"exists") and player(p,"health")<45 then
		parse('sv_sound2 '..p..' 'cod_breathing.ogg')
	     end
	end
end

Btw, maybe you could try to learn some lua scripting?
just a suggestion.
-CmDark

old Re: Lua Scripts/Questions/Help

Jake-rus
User Off Offline

Quote
whats wrong ???

1
2
3
parse("hudtxt 9 "'..name..'" 260 5")
parse("hudtxt 8 "©000200200VERSION:'..ver_update..'" 260 10")
parse("hudtxt 7 "©000200000CREATOR AND MAIN IDEA: JaKe" 260 15")

old Re: Lua Scripts/Questions/Help

wjcf1290
User Off Offline

Quote
Jake-rus has written
whats wrong ???

1
2
3
parse("hudtxt 9 "'..name..'" 260 5")
parse("hudtxt 8 "©000200200VERSION:'..ver_update..'" 260 10")
parse("hudtxt 7 "©000200000CREATOR AND MAIN IDEA: JaKe" 260 15")


hudtxt <hudid> <"text"> <x> <y> <align>

align.

old Re: Lua Scripts/Questions/Help

Kurumi
User Off Offline

Quote
CmDark has written
@GeNeSiS_MaSoN

1. Impossible.
2. Also Impossible unless if you put your own image on top of where it shows (needs to be transparent).
3. Easily done.

1
2
3
4
5
6
7
8
addhook('second','smallhealth');
function smallhealth()
	for p=1,32 do --Players 1-32
	     if player(p,"exists") and player(p,"health")<45 then
		parse('sv_sound2 '..p..' 'cod_breathing.ogg')
	     end
	end
end

Btw, maybe you could try to learn some lua scripting?
just a suggestion.
-CmDark
dont work

old Re: Lua Scripts/Questions/Help

Fasttt
User Off Offline

Quote
parse('hudtxt 9 '..name..' 260 5')
parse('hudtxt 8 "©000200200VERSION:'..ver_update..'" 260 10')
parse('hudtxt 7 "©000200000CREATOR AND MAIN IDEA: JaKe" 260 15')

old Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Quote
@GeNeSiS MaSoN There is no reason that that script shouldn't work unless if you did not have the cod_breathing.ogg file in your sfx folder.

old Re: Lua Scripts/Questions/Help

Fasttt
User Off Offline

Quote
GeNeSiS_MaSoN has written
CmDark has written
@GeNeSiS_MaSoN

1. Impossible.
2. Also Impossible unless if you put your own image on top of where it shows (needs to be transparent).
3. Easily done.

1
2
3
4
5
6
7
8
addhook('second','smallhealth');
function smallhealth()
	for p=1,32 do --Players 1-32
	     if player(p,"exists") and player(p,"health")<45 then
		parse('sv_sound2 '..p..' 'cod_breathing.ogg')
	     end
	end
end

Btw, maybe you could try to learn some lua scripting?
just a suggestion.
-CmDark
dont work

parse('sv_sound2 '..p..' cod_breathing.ogg')

old Re: Lua Scripts/Questions/Help

Marcell
Super User Off Offline

Quote
Hi,
Can run program with lua?
So can i do thats in the lua when i press f3 serveraction start program in C:/ so
pl:. When i press f3 start the mediaplayer!

old Re: Lua Scripts/Questions/Help

Loooser
User Off Offline

Quote
i want to script something with effects can somebody list me the effects that are existing
i mean this
effect <effect> <x> <y> <p1> <p2> <r> <g> <b>

old Re: Lua Scripts/Questions/Help

RAVENOUS
BANNED Off Offline

Quote
loooser has written
i want to script something with effects can somebody list me the effects that are existing
i mean this
effect <effect> <x> <y> <p1> <p2> <r> <g> <b>


- smoke
- fire
- steam
- colorsmoke
- waves (?)

old Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Quote
I tried to fix the code :
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
function initArray(m)
local array = {}
for i = 1, m do
array[i]=0
end
return array
end
level=initArray(32)
exp=initArray(32)
credits=initArray(32)
points=initArray(32)
streak=initArray(32)
hacker=initArray(32)
medikit=initArray(32)

function string.split(text,b)
local cmd = {}
if b then
b = b
else
b = "%s"
end
b = "[^"..b.."]+"
for o in string.gmatch(text,b) do
table.insert(cmd,o)
end
return cmd
end

if hacker==nil then hacker={} end
hacker={}

addhook("second","hack")
function hack()
for p = 1,32 do
if (hacker[p]==1) then
credits[id]=credits[id]+15
	end
end
end

addhook("spawn","class")
function class(id)
parse("equip "..id.." 56") -- Equips Ct's with defuse kit.
hacker[id] = 1 -- The Hacker Special is on
	parse("strip "..id)

But i get error every second and when i press "Buy Credits"
Screenshots



Question : Could i make something like

1
2
3
4
function bla(id)
menu("lol",stuff,stuff,bla,bla...")
addhook server action bla bla...
function ye ye
lol(id)

old Re: Lua Scripts/Questions/Help

zygint
User Off Offline

Quote
can any one help my i need to make a script from exaples to make more then 9 classes but i need the next and back can anyone help my with that?

old Re: Lua Scripts/Questions/Help

EngiN33R
Moderator Off Offline

Quote
@batlaizys

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
function initArray(m)
local array = {}
for i = 1, m do
array[i]=0
end
return array
end
level=initArray(32)
exp=initArray(32)
credits=initArray(32)
points=initArray(32)
streak=initArray(32)
hacker=initArray(32)
medikit=initArray(32)

function string.split(text,b)
local cmd = {}
if b then
b = b
else
b = "%s"
end
b = "[^"..b.."]+"
for o in string.gmatch(text,b) do
table.insert(cmd,o)
end
return cmd
end

if hacker==nil then hacker={} end
hacker={}

addhook("second","hack")
function hack()
for p = 1,32 do
if (hacker[p]==1) then
credits[p]=credits[p]+15
     end
end
end

addhook("spawn","class")
function class(id)
parse("equip "..id.." 56") -- Equips Ct's with defuse kit.
hacker[id] = 1 -- The Hacker Special is on
     parse("strip "..id)

The problem was here
1
2
3
4
for p = 1,32 do
if (hacker[p]==1) then
	credits[id]=credits[id]+15
end
You made p=1,32, but then tried to define credits[id], and id variable didn't exist.

@zygintas
Try to make two separate menu functions - like that
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
function menu1(id)
	menu(id,"Class Menu 1,Class 1, Class 2,...,Class 8,Next")
end
function menu2(id)
	menu(id,"Class Menu 2,Class 1, Class 2,...,Class 8,Back")
end

addhook("menu","twomenus")
function twomenus(id,menu,sel)
	if (menu=="Class Menu 1") then
		if (sel==1) then
			...
		...
		if (sel==9) then
			menu2(id)
		end
	end
	if (menu=="Class Menu 2") then
		if (sel==1) then
			...
		...
		if (sel==9) then
			menu1(id)
		end
	end
end
Insert the needed code parts in the gaps.

old Re: Lua Scripts/Questions/Help

Loooser
User Off Offline

Quote
hi guys i wonder how to find out with the object function wether the object is a snark and not a zombie or a headkrap.
im talking about

object(id,"value")

and i tried it with

object(id,"type")

i know how to find out that it is a npc.

old Re: Lua Scripts/Questions/Help

Yates
Reviewer Off Offline

Quote
Anyone have a car buy menu where i can change the car pics and name maybe money dont know..
But i saw one on this site not so long ago..
but it's gone i think..
I searched car and buy but couldnt find anything
Anyone know where some sort of script is..?

old Re: Lua Scripts/Questions/Help

JONY
User Off Offline

Quote
Is it possible to make so that a turret attacks everyone except the player who created it? It can be effectively used with Deathmatch mod

I assume that currently, that as soon as the turret sees a player it checks whether he is T or CT and decides to shoot or not, but it would be cool to make so that it checks player's id and decides to kill this player or not.

Regards,
J.
To the start Previous 1 2321 322 323338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview