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 2297 298 299338 339 Next To the start

old Re: Lua Scripts/Questions/Help

RyceR
User Off Offline

Quote
how to add function for this?:
1
RR_msg(000255075,Test!,1)
000255075 = color
Test! = Message
1 = @C (when 1 with @C, when 0 without)

old Re: Lua Scripts/Questions/Help

RyceR
User Off Offline

Quote
@kato999
with menu commands like:
1
menu(id,"title,button1,button2,button3")
and use it with "menu" hook like:
1
2
3
4
5
6
7
8
9
10
11
addhook("menu",'n_menu")
function n_menu(id,title,sel)
	if title == "title" then
		if sel == 1 then
			-- whatever 1
		if sel == 2 then
			-- whatever 2
		if sel == 3 then
			-- whatever 3
		end
end

old Re: Lua Scripts/Questions/Help

RyceR
User Off Offline

Quote
@kato999 you want any1 like that?:
When u press button(from menu) then it do trigger?
if yes write in --whatever 1/2/3

how to add function for this?:
1
RR_msg(000255075,Test!,1)

000255075 = color
Test! = Message
1 = @C (when 1 with @C, when 0 without)

old Re: Lua Scripts/Questions/Help

EngiN33R
Moderator Off Offline

Quote
@RyceR

1
2
3
4
5
6
7
function RR_msg(color,text,mode)
if (mode==0) then
	msg("©"..color.." "..text)
elseif (mode==1) then
	msg("©"..color.." "..text.."@C")
end
end

old Re: Lua Scripts/Questions/Help

EngiN33R
Moderator Off Offline

Quote
@RyceR
1
2
3
4
5
6
7
function RR_msg(color,text,mode)
if (mode==0) then
     msg("©"..color.."   "..text)
elseif (mode==1) then
     msg("©"..color.."   "..text.."@C")
end
end

Add 2 more spaces in the gap between color and text in the msg() function... Don't know what is it...

Question: is there any way to set player's ammunition in a certain weapon or force the player to reload?

old Re: Lua Scripts/Questions/Help

EngiN33R
Moderator Off Offline

Quote
@loooser

About freeimage(id)

When you create an image, do it like that
image1=image("path",x,y,mode)
^
The ID

And then just use freeimage(image1) to free this image.

old Re: Lua Scripts/Questions/Help

Kurumi
User Off Offline

Quote
how i can trigger something whith message in the sertain position. i dont like that: where you want there you trigger. im making Return To Castle Wolfenstein Mission it wil help me

old Re: Lua Scripts/Questions/Help

EngiN33R
Moderator Off Offline

Quote
@kato999

1
2
3
4
5
6
7
8
9
10
-- these are the positions of player where to say (tiles!)
pos1=1337
pos2=1337

addhook("say","interact")
function interact(id,t)
	if (t=="hi" and player(id,"tilex")==pos1 and player(id,"tiley")==pos2) then
		parse("trigger door") -- for example
	end
end

old Re: Lua Scripts/Questions/Help

kNedLiik
User Off Offline

Quote
Kato you can change hi to ur message and pos1 and pos2 to tiles position and trigger door change door to triggered thing If you know that sorry for this post

old Re: Lua Scripts/Questions/Help

EngiN33R
Moderator Off Offline

Quote
@kato In the script I've written to you, you should change pos1 and pos2 to YOUR needed coordinates IN TILES, not in pixels. With menu it should be like that:

1
2
3
4
5
6
7
8
9
10
-- these are the positions of player where to say (tiles!)
pos1=1337
pos2=1337

addhook("say","interact")
function interact(id,t)
     if (t=="hi" and player(id,"tilex")==pos1 and player(id,"tiley")==pos2) then
          menu(id,"What ya wanna do?,Shut up,**** off,Open door")
     end
end

Fr'instance.

old Re: Lua Scripts/Questions/Help

EngiN33R
Moderator Off Offline

Quote
@Fehuziom
Find initArray function in my previous posts

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
dmgmode=initArray(32)

addhook("say","dmgmodefunc")
function dmgmodefunc(p,t)
if (t=="!dmg") then
dmgmode[p]=1
end
end

addhook("hit","moredmg")
function moredmg(id,source,w,hpdmg)
if (dmgmode[source]==1) then
parse("sethealth "..id.." "..(player(id,"health")-(hpdmg+2)))
end
end

old Re: Lua Scripts/Questions/Help

kNedLiik
User Off Offline

Quote
Someone try fix this pls??
1
2
3
4
5
6
7
position = {
"250 50 0"
}
addhook("spawn","admin")
function admin(id)
	parse("hudtxt "..id.." ©255000000 Admin:Urnamehere "..position)
end
To the start Previous 1 2297 298 299338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview