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 27 8 9338 339 Next To the start

old Re: Lua Scripts/Questions/Help

Zellon
User Off Offline

Quote
Hello,

I would like to download the latest version of CS2D. I would like to keep my settings though... is there any way I can do that?

I am sorry if this has already been answered somewhere... I tried searching but couldn't find anything.

old Re: Lua Scripts/Questions/Help

DC
Admin Off Offline

Quote
download and install/extract cs2d to a new folder or make a backup of your old sys folder (this is the folder in your cs2d folder which contains all settings).
afterwards copy&paste the sys folder in the new cs2d folder and overwrite existing files.

you should only do this if your current version is 0.1.0.5 or newer.

btw: this is the wrong thread for this problem. this thread is about Lua only.

old Re: Lua Scripts/Questions/Help

Zellon
User Off Offline

Quote
Ah. Sorry bout that.

Ok thank you DC. I was wondering if that is what I had to do... but I didn't want to mess anything up.

old Re: Lua Scripts/Questions/Help

horus
User Off Offline

Quote
I desperately need some help on how to make a team-specific class system [t, pl0x] using the LUA for the normal class mod. kthxbai in advance

old Re: Lua Scripts/Questions/Help

Adware
User Off Offline

Quote
What does item type mean in the select hook? Same as item mode, what do i need to type in? I was going to make a script wherein when you select Chainsaw you get speedmod which makes it faster than knife.

old Re: Lua Scripts/Questions/Help

Killahamsta
User Off Offline

Quote
I need an alternative money system for players with these available commands:

!givemoney <name> <amount>= gives a certain amount of money to the target person and lose your equivalent

!grantmoney <name> <amount>= gives money without losing yours.

!mymoney =shows you the amount of money you have

I'm planning to make an RPG style gameplay for my happytown style map, It will feature buying, selling, and acquiring items, I'll ask for the basics above first.

old Re: Lua Scripts/Questions/Help

vrkiller
User Off Offline

Quote
• Q1:

I was wondering if there was a function that you could use when you wanted the current map to "trigger" a specefic variable, like; you create a dynwall with name "lol"
and you juse the function trigger("lol"); so it would trigger "lol", on the current map your server is enabled on? or so will there be one function like that.

• Q2:

will there be a register with all the functions you can use in lua-cs2d, and maybe a single forum?

• Q3: ( new edited )

What function should i use to disable the ( menu you can change if you want to be t or ct, and what type of doll you want to choose?)
edited 1×, last 24.05.09 01:21:24 am

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
vrkiller has written
• Q1:

I was wondering if there was a function that you could use when you wanted the current map to "trigger" a specefic variable, like; you create a dynwall with name "lol"
and you juse the function trigger("lol"); so it would trigger "lol", on the current map your server is enabled on? or so will there be one function like that.


You have to
parse("trigger lol")

old Re: Lua Scripts/Questions/Help

Lee
Moderator Off Offline

Quote
vrkiller has written
• Q3: ( new edited )

What function should i use to disable the ( menu you can change if you want to be t or ct, and what type of doll you want to choose?)


You can't, there's 2 events on team change, the team switch itself and then the look, the team hook doesn't get triggered however until both have completed. You can however add a hook to hook_join to change the player immediately into either T or CT as thus

1
2
3
4
5
6
addhook("join", "h_join")
function h_join(p)
	team = {"t", "ct"}
	math.randomseed(os.time())
	parse("make"+team[math.random(1, 2)])
end

Quote
Q2:

will there be a register with all the functions you can use in lua-cs2d, and maybe a single forum?


Go on Lua and type in the following into server.lua

1
2
3
for key, val in pairs(_G) do
	if type(val) == "function" then print(key) end
end

or alternatively use

1
funcs()

old Re: Lua Scripts/Questions/Help

Kaka024
User Off Offline

Quote
How to disable timer in quake sounds? I know it is kinda easy, but i can't do that. I wan't them until you die (you don't have to kill all people in a few secs). And 2nd: How to make 2 last messages (if im not wrong its unstopable and monster kill) on the center? And 3rd: how to change colours of the messages?
Thanks a lot

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
Kaka024 has written
How to disable timer in quake sounds? I know it is kinda easy, but i can't do that. I wan't them until you die (you don't have to kill all people in a few secs). And 2nd: How to make 2 last messages (if im not wrong its unstopable and monster kill) on the center? And 3rd: how to change colours of the messages?
Thanks a lot

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
-------------------------------------------------
-- UT+Quake Sounds Script by Unreal Software    --
-- 22.02.2009 - www.UnrealSoftware.de           --
-- Adds UT and Quake Sounds to your Server      --
--------------------------------------------------

if sample==nil then sample={} end
sample.ut={}

-----------------------
-- 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 \"fun/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 \"fun/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 \"fun/doublekill.wav\"");
			msg (player(killer,"name").." made a Doublekill!")
		elseif (level==3) then
			parse("sv_sound \"fun/multikill.wav\"")
			msg (player(killer,"name").." made a Multikill!")
		elseif (level==4) then
			parse("sv_sound \"fun/ultrakill.wav\"")
			msg (player(killer,"name").." made an ULTRAKILL!")
		elseif (level==5) then
			parse("sv_sound \"fun/monsterkill.wav\"")
			msg (player(killer,"name").." made a MO-O-O-O-ONSTERKILL-ILL-ILL!@C")
		else
			parse("sv_sound \"fun/unstoppable.wav\"")
			msg (player(killer,"name").." is UNSTOPPABLE! "..level.." KILLS!@C")
		end
	end
end
Replease the original one by this one, I've set them to make the counter last until you die and centered the UNSTOPPABLE and MONSTERKILL messages
edited 1×, last 26.05.09 06:33:23 pm

old Message color

KimKat
GAME BANNED Off Offline

Quote
Kaka024 has written
How to disable timer in quake sounds? I know it is kinda easy, but i can't do that. I wan't them until you die (you don't have to kill all people in a few secs). And 2nd: How to make 2 last messages (if im not wrong its unstopable and monster kill) on the center? And 3rd: how to change colours of the messages?
Thanks a lot
You can change colors of the messages by the RRRGGGBBB (Red Green Blue color value)

Here is some simple examples of LUA msgs in console:

msg("©255000000" "This message is RED!")
msg("©000255000" "This message is GREEN!")
msg("©000000255" "This message is BLUE!")

//@DC: I hope this works, I am not a master at LUA.

Don't forget the "©" color symbol (aka. copyright symbol) before adding those color values.
edited 1×, last 26.05.09 04:09:05 pm

old Re: Lua Scripts/Questions/Help

DC
Admin Off Offline

Quote
there is a little problem with your examples: you either have to add quotes in front of This in each line or you have to remove ".. in each line.

old Re: Lua Scripts/Questions/Help

sonnenschein
User Off Offline

Quote
How can I make value script?
like people wants to have their own number of speedmod
I would like script to behave like this

!speed <number>

And !armor <number>

old Re: Lua Scripts/Questions/Help

Kaka024
User Off Offline

Quote
DC, so what to delete and where to place it? After "msg" or before text of msg?

@edit
something is wrong with quake sounds

[09:25:59] LUA: Calling hooked function 'sample.ut.kill'
[09:25:59] LUA ERROR: sys/lua/samples/utsfx.lua:46: attempt to index field 'timer' (a nil value)

WTF?

old Re: Lua Scripts/Questions/Help

Lee
Moderator Off Offline

Quote
Kaka024 has written
DC, so what to delete and where to place it? After "msg" or before text of msg?

@edit
something is wrong with quake sounds

[09:25:59] LUA: Calling hooked function 'sample.ut.kill'
[09:25:59] LUA ERROR: sys/lua/samples/utsfx.lua:46: attempt to index field 'timer' (a nil value)

WTF?


find

1
--sample.ut.timer=initArray(32)

and change it to

1
sample.ut.timer=initArray(32)

old Re: Lua Scripts/Questions/Help

DC
Admin Off Offline

Quote
my sample scripts work fine as far as I can tell. I tested them. you must have changed something which led to these errors.

old Re: Lua Scripts/Questions/Help

Kaka024
User Off Offline

Quote
Ok now it works, but current level isnt reseted when i die. I mean when i kill 1 person, i die, i kill a man, i have double kill sound. I shouldn't have it.
To the start Previous 1 27 8 9338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview