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 250 51 52338 339 Next To the start

old Re: Lua Scripts/Questions/Help

BetaM
User Off Offline

Quote
How to compare values that are NOT equal to themselves. I mean something like value1-=value2, or value1~=value2. What do you think?

old need help

Smither
User Off Offline

Quote
i made a Lua , Well only i change the sounds , etc.
But it doesnt works, i put the sounds.. Where is the Problem?
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
-- INITIAL SETUP     --
-----------------------
function initArray(m)
	local array = {}
	for i = 1, m do
		array[i]=0
	end
	return array
end
sample.ut.timer=initArray(32)
sample.ut.level=initArray(32)
sample.ut.fblood=0


-----------------------
-- PREPARE TO FIGHT! --
-----------------------
addhook("startround","sample.ut.startround")
function sample.ut.startround()
	parse("sv_sound \"female/prepare.wav\"")
	sample.ut.fblood=0
end


-----------------------
-- KILL SOUNDS+MSGS  --
-----------------------
addhook("kill","sample.ut.kill")
function sample.ut.kill(killer,victim,weapon)
	if (os.clock()-sample.ut.timer[killer])>3 then
		sample.ut.level[killer]=0;
	end
	level=sample.ut.level[killer]
	level=level+1
	sample.ut.level[killer]=level
	sample.ut.timer[killer]=os.clock()
	-- FIRST BLOOD?
	if (sample.ut.fblood==0) then
		sample.ut.fblood=1
		parse("sv_sound \"fun/firstblood.wav\"");
		msg (player(killer,"name").." sheds FIRST BLOOD by killing "..player(victim,"name").."!")
	end
	-- HUMILIATION? (KNIFEKILL)
	if (weapon==50) then
		-- HUMILIATION!
		parse("sv_sound \"female/f_humiliation.wav\""); 
		msg (player(killer,"name").." humiliated "..player(victim,"name").."!")
	else
		-- REGULAR KILL
		if (level==1) then
			-- Single Kill! Nothing Special!
		elseif (level==2) then
			parse("sv_sound \"female/f_multikill.wav\"");
			msg (player(killer,"name").." made a Multikill!")
		elseif (level==3) then
			parse("sv_sound \"female/f_megakill.wav\"")
			msg (player(killer,"name").." made a Megakill!")
		elseif (level==4) then
			parse("sv_sound \"female/f_ultrakill.wav\"")
			msg (player(killer,"name").." made an ULTRAKILL!")
		elseif (level==5) then
			parse("sv_sound \"female/f_monsterkill.wav\"")
			msg (player(killer,"name").." made a MO-O-O-O-ONSTERKILL-ILL-ILL!")
                                elseif (level==6) then
                                                parse("sv_sound \"female/f_ludacrisskill.wav\"")
                                                msg (player(killer,"name").." made a LUDICROUS KILL-LL-LL-LL!")
                                elseif (level==7) then
                                                parse("sv_sound \"female/f_holyshit.wav\"")
                                                msg (player(killer,"name").." made a HOLYSHIT!")
                               elseif (level==8) then
                                                parse("sv_sound \"female/f_godlike.wav\"")
                                                msg (player(killer,"name").." made a GODLIKE!")
                              elseif (level==9) then
                                                parse("sv_sound \"female/f_wickedsick.wav\"")
                                                msg (player(killer,"name").." made a Wicked-Sick!!")                              	
		else
			parse("sv_sound \"female/f_unstoppable.wav\"")
			msg (player(killer,"name").." is UNSTOPPABLE! "..level.." KILLS!")
		end
	end
end

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
mat5b has written
How to compare values that are NOT equal to themselves. I mean something like value1-=value2, or value1~=value2. What do you think?


Do you mean...
1
2
3
4
if x <= y then...
if x >= y then...
if x ~= y then...
if not x == y then...
??

@Smither:
What's this?
1
parse("sv_sound \"female/f_multikill.wav\"");

Just keep it simple like this
1
parse("sv_sound 'female/f_multikill.wav'")

old Re: Lua Scripts/Questions/Help

New Rex
User Off Offline

Quote
Hey. I'm making a script based on what I saw yesterday in CS 1.6.
It says that a end is expected at 75 <eof> or something.

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
----------------------
-- Ultimate Female Sounds Script by Xt3ND3d --
-- Version 0.5 Alpha --
-- © 11.09.2009 Xt3ND3d Productions --
-----------------------
function initArray(m)
     local array = {}
     for i = 1, m do
          array[i]=0
     end
     return array
end
sample.ut.timer=initArray(32)
sample.ut.level=initArray(32)
sample.ut.fblood=0


-----------------------
-- Killing sounds and messages --
-----------------------
addhook("kill","sample.ut.kill")
function sample.ut.kill(killer,victim,weapon)
     if (os.clock()-sample.ut.timer[killer])>3 then
          sample.ut.level[killer]=0;
     end
     level=sample.ut.level[killer]
     level=level+1
     sample.ut.level[killer]=level
     sample.ut.timer[killer]=os.clock()

     -- Humiliation (Killed with knife)
     if (weapon==50) then
          parse("sv_sound 'fun/f_humiliation.wav'");
          msg (player(killer,"name").." humiliated "..player(victim,"name").."!")
          msg "You humiliated me..."
     else
          -- First kill.
          if (level==1) then
               -- Doesn't do nothing at his point.
          if (level==2) then
              -- Doesn't do anything either. This is unfinished version.
          elseif (level==3) then
              -- Megakill. 
               parse("sv_sound 'fun/f_megakill.wav'")
               msg (player(killer,"name").." made a Megakill!")
          elseif (level==4) then
              -- Ultrakill.   
               parse("sv_sound 'fun/f_ultrakill.wav'")
               msg (player(killer,"name").." made an ULTRAKILL.")
          elseif (level==5) then
              -- Monsterkill.
               parse("sv_sound 'fun/f_monsterkill.wav'")
               msg (player(killer,"name").." made a MONSTERKILL! W00t!")
          elseif (level==6) then
              -- Ludacriskill.  
               parse("sv_sound 'fun/f_ludacrisskill.wav'")
               msg (player(killer,"name").." made a LUDACRISKILL!")
          elseif (level==7) then
             -- Holyshit. 
              parse("sv_sound \"fun/f_holyshit.wav\"")
              msg (player(killer,"name").." made a HOLYSHIT!")
          elseif (level==8) then
             -- Godlike. 
              parse("sv_sound \"fun/f_godlike.wav\"")
              msg (player(killer,"name").." is a GODLIKE!!!")
          elseif (level==9) then
             -- Wicked-Sick. 
              parse("sv_sound \"fun/f_wickedsick.wav\"")
              msg (player(killer,"name").." made a Wiiickeeed-Siiick!!")      
          else
              parse("sv_sound \"fun/f_unstoppable.wav\"")
               msg (player(killer,"name").." is UNNNSTOPPABLE...! Made "..level.." kills!!!")
          end
     end
end

Where?

--- Edit ---
Didn't actually saw Smither's post. But my problem is still other. I didn't steal nothing, I promise in case you think I stole from him.

old Re: Lua Scripts/Questions/Help

DC
Admin Off Offline

Quote
oh wow. this is my UT sounds sample script with all tabs removed and minimalistic changes. it still even uses the sample.ut table. lol. why the fuck did someone remove the tabs? it's absolutely unreadable this way and it's impossible to find a missing end without the tabs.

open sys/lua/samples/utsfx.lua
there is the original script. it works and is readable because it is properly indented.

it's okay that people take and modify my sample scripts. that's why they are there. however it's not okay to fuck up the indent. It's really horrible to see how this script has been ruined!

old Re: Lua Scripts/Questions/Help

DC
Admin Off Offline

Quote
and I think that he just doesn't know what he is doing

of course it's hard to find the right position for the missing end in this script. no indent = WAR!!!

you would INSTANTLY see the problem with proper indent.

old Re: Lua Scripts/Questions/Help

playa slaya
COMMUNITY BANNED Off Offline

Quote
hey,im having trouble with my script i get a error msg saying "unexpected symble near then" and i tried to fix but couldnt figure it out
Spoiler >
this is a script i want to make so just tell me how to fix it dont fix it for me

old Re: Lua Scripts/Questions/Help

Lee
Moderator Off Offline

Quote
1
2
3
parse("equip "..id.." 45") then
          parse("equip "..id.." 83") then
          parse("speedmod "..id.." 25") then

The then keyword can only be postfixed to an if statement. IE: Take off the 'then' from the none-if statements.

old Re: Lua Scripts/Questions/Help

playa slaya
COMMUNITY BANNED Off Offline

Quote
yay i made my script by myself without editing some elses script it took abot 4hrs because idid not know as much as now.thx for explaining the 'then' thing leegao.now i can make some of my own scripts ive made like 3 today all thx to TKD and his script guide.
well heres the hardest one (it was hard for me)i made today.
Spoiler >


what it does

speedmod 25 (when you say !godlike)
ivincibilty (when you say !godlike)
laser (when you say !godlike)
super armor (when you say !godlike)
godlike sfx (when you say !godlike)
players name is godlike (msg "playersname is godlike")
and soon infinit grenades.(possibly)
edited 6×, last 12.09.09 09:39:22 am

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
Banana-Phone has written
how ccan i make a script in when finish the round change the terrorist

You mean each round start make everyone terrorists?

Im not on my PC so I cant make script for you.

But, if you know how to script a bit,
I will show how it should work:

1
2
3
4
5
6
7
8
function round()
	local i
	for i = 1,32 do
		if (player(i,"team") == 2) then
			parse('maket '..i)
		end
	end
end

Anyway same thing is already in my zombie plague 1.0
edited 1×, last 12.09.09 12:31:10 pm

old Re: Lua Scripts/Questions/Help

New Rex
User Off Offline

Quote
I don't know anything about Lua.
Indents, values, wtf is that?
I just edited and made all stuff organised. Don't see problem...

old Re: Lua Scripts/Questions/Help

New Rex
User Off Offline

Quote
I noticed there was errors.
I fixed them and still same...
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
----------------------
-- Ultimate Female Sounds Script by Xt3ND3d --
-- Version 0.5 Alpha --
-- © 11.09.2009 Xt3ND3d Productions --
-----------------------
function initArray(m)
     local array = {}
     for i = 1, m do
          array[i]=0
     end
     return array
end
sample.ut.timer=initArray(32)
sample.ut.level=initArray(32)
sample.ut.fblood=0


-----------------------
-- Killing sounds and messages --
-----------------------
addhook("kill","sample.ut.kill")
function sample.ut.kill(killer,victim,weapon)
     if (os.clock()-sample.ut.timer[killer])>3 then
          sample.ut.level[killer]=0;
     end
     level=sample.ut.level[killer]
     level=level+1
     sample.ut.level[killer]=level
     sample.ut.timer[killer]=os.clock()

     -- Humiliation (Killed with knife)
     if (weapon==50) then
          parse("sv_sound 'fun/f_humiliation.wav'");
          msg (player(killer,"name").." humiliated "..player(victim,"name").."!")
          msg "You humiliated me..."
     else
          -- First kill.
          if (level==1) then
               -- Doesn't do nothing at his point.
          if (level==2) then
              -- Doesn't do anything either. This is unfinished version.
          elseif (level==3) then
              -- Megakill. 
               parse("sv_sound 'fun/f_megakill.wav'")
               msg (player(killer,"name").." made a Megakill!")
          elseif (level==4) then
              -- Ultrakill.   
               parse("sv_sound 'fun/f_ultrakill.wav'")
               msg (player(killer,"name").." made an ULTRAKILL.")
          elseif (level==5) then
              -- Monsterkill.
               parse("sv_sound 'fun/f_monsterkill.wav'")
               msg (player(killer,"name").." made a MONSTERKILL! W00t!")
          elseif (level==6) then
              -- Ludacriskill.  
               parse("sv_sound 'fun/f_ludacrisskill.wav'")
               msg (player(killer,"name").." made a LUDACRISKILL!")
          elseif (level==7) then
             -- Holyshit. 
              parse("sv_sound 'fun/f_holyshit.wav'")
              msg (player(killer,"name").." made a HOLYSHIT!")
          elseif (level==8) then
             -- Godlike. 
              parse("sv_sound 'fun/f_godlike.wav'")
              msg (player(killer,"name").." is a GODLIKE!!!")
          elseif (level==9) then
             -- Wicked-Sick. 
              parse("sv_sound 'fun/f_wickedsick.wav'")
              msg (player(killer,"name").." made a Wiiickeeed-Siiick!!")      
          else
              parse("sv_sound 'fun/f_unstoppable.wav\'")
               msg (player(killer,"name").." is UNNNSTOPPABLE...! Made "..level.." kills!!!")
          end
     end
end

Error: 'end' expected at line 22 (near <eof>).
WTF?
To the start Previous 1 250 51 52338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview