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 2173 174 175338 339 Next To the start

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
No it's not possible because CS2D sound functions doesn't have that.

It's only possible to make players hear in certain area using sv_sound2

old Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Quote
1
parse("sv_sound2 \"snd path\"")

just this?

and can you help me?, i have bug :

1
msg("©255000000'..player(id,"name")..' is noob!")

What's wrong here?
edited 2×, last 11.03.10 09:32:06 pm

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
DRoNe has written
1
msg([b]"©255000000'[/b]..player(id,"name")..[b]' is noob!"[/b])

If you are starting string with " then you should finish the same.
√ 'string'
√ "string"
× 'string"
× "string'

old Re: Lua Scripts/Questions/Help

byengul
User Off Offline

Quote
Hi guyz;

I'm making a big Role-Playing Map and i want a level script how can i make a script like this;

•Killing Players Gives Exp
•Breaking Breakable things Gives Exp

I've another question but first i must know this level script

old Re: Lua Scripts/Questions/Help

Homer
User Off Offline

Quote
Umm, I got a question about triggers and about detecting a players weapons.
1: With a trigger, could you use the for i=1,32 do for it?
2: I am trying to strip a primary weapon or secondary weapon if they have one, and equip another one, Can I see the type of weapons they have?

old Re: Lua Scripts/Questions/Help

goweiwen
User Off Offline

Quote
Use this
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function addWeapon(id,wpnid, type)
	local haswpn
	for i, v in ipairs(playerweapons(id)) do
		if type == 1 then
			for j, k in ipairs{10,11,20,21,22,23,24,38,39,30,32,31,33,34,35,36,37,40} do
				if v == k then
					parse('strip '..id..' '..v)
					haswpn = true
					break
				end
			end
		else
			for j, k in ipairs{1,2,3,4,5,6} do
				if v == k then
					parse('strip '..id..' '..v)
					haswpn = true
					break
				end
			end
		end
		if haswpn then parse('equip '..wpnid) return true end
	end
	return false
end
Use the function addWeapon(id,wpnid,1 for primary or 2 for secondary) to add a weapon to the player.
edited 3×, last 12.03.10 12:03:07 pm

old Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Quote
Blazzingxx has written
DRoNe has written
1
msg([b]"©255000000'[/b]..player(id,"name")..[b]' is noob!"[/b])

If you are starting string with " then you should finish the same.
√ 'string'
√ "string"
× 'string"
× "string'


It's very useful for me, thank you

old Re: Lua Scripts/Questions/Help

Noxic
User Off Offline

Quote
I'm having trouble with the color-coding in HUD. Instead of changing the color of my text, it adds "©255000000" in front of the text.

I think it might have to do with the character encoding I use in my lua scripts, but changing doesn't seem to help.

old Re: Lua Scripts/Questions/Help

Dictatus Papae
User Off Offline

Quote
Can someone please tell me how to make a spawn script as in the cc rp, so when a player joins he can only join Ts and if he tries to be CT he will spawn as a T. If the player's logged in as an admin, he can join bofe teams, but if not, he wil always spawn as a T.

old Re: Lua Scripts/Questions/Help

archmage
User Off Offline

Quote
Noxic has written
I'm having trouble with the color-coding in HUD. Instead of changing the color of my text, it adds "©255000000" in front of the text.

I think it might have to do with the character encoding I use in my lua scripts, but changing doesn't seem to help.

The '©#' MUST be first before any other characters

old Re: Lua Scripts/Questions/Help

goweiwen
User Off Offline

Quote
@Terminator
I'm not sure if there's any method to force the player to join the T team, but this will just not allow them to choose a CT.
1
2
3
4
5
6
addhook('team','onSelectTeam')
function onSelectTeam(id, team, look)
	if team == 2 then
		return 1
	end
end

old Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Quote
DRoNe has written
Quote
put the entities ct_info near the t_info


OMG...........i mean in lua


OMG, that not possible and OMG you need to setpos

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
Some funny stuff written by me...
Few basics misc from CSH objects script.

Note: shoot/attack to see the effect.

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
-- Projectiles Stuff Example --
-- Lua Scripting Tutorial Example
-- Not Finshed --

obj = {x = {}, y = {}, rot = {}, img = {}, id = {}}

addhook("always","obj_update")
addhook("attack","obj_add")

function obj_remove(id)
	local k, v
	if obj.img[id] then freeimage(obj.img[id]) end
	for k, v in pairs(obj) do table.remove(obj[k], id) end
end

function obj_add(p)
	local x , y, rot , id = player(p,"x"), player(p,"y"), player(p,"rot")
	id = image("gfx/sprites/flare2.bmp",x,y,1)
	imageblend(id, 1)
	table.insert(obj.img, id)
	table.insert(obj.x, x)
	table.insert(obj.y, y)
	table.insert(obj.id, p)
	table.insert(obj.rot, rot)
end

function obj_update()
	local del, id, n = {}
	for id, n in pairs(obj.img) do
		obj.x[id] = obj.x[id] + math.cos(math.rad(obj.rot[id] - 90)) * 10
		obj.y[id] = obj.y[id] + math.sin(math.rad(obj.rot[id] - 90)) * 10
		imagepos(n, obj.x[id], obj.y[id], obj.rot[id])
		if tile( math.ceil(obj.x[id] / 32) - 1, math.ceil(obj.y[id] / 32) - 1, "wall") then
			parse("explosion "..obj.x[id].." "..obj.y[id].." 50 250 "..obj.id[id])
			table.insert(del, id)
		end
	end
	for id, n in ipairs(del) do obj_remove(n) end
end
To the start Previous 1 2173 174 175338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview