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 2288 289 290338 339 Next To the start

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
BureX has written
Spoiler >

DarkByte i always get this error i even replaced '\'
like "\gate field"\ and \"gate field"\ and many stuff but still doesnt work
IMG:https://i51.tinypic.com/1zd7vhc.jpg


just use lua

1
2
3
4
5
6
7
8
9
10
11
12
addhook("buildattempt","nobuild") function nobuild(id,type,x,y)
	if type==1 then
		msg2(id,"©255000000You cant build this type of building@C")
		return 1
	elseif type>=6 and type<=7 then
		msg2(id,"©255000000You cant build this type of building@C")
		return 1
	elseif type==9 then
		msg2(id,"©255000000You cant build this type of building@C")
		return 1
	end
end

here are the building id's

1 - Barricade
2 - Barbed Wire
3 - Wall I
4 - Wall II
5 - Wall III
6 - Gate Field
7 - Dispenser
8 - Turret
9 - Supply
10 - Construction Site
11 - Dual Turret
12 - Triple Turret
13 - Teleporter Entrance
14 - Teleporter Exit
20 - Mine
21 - Laser Mine
22 - Orange Portal
23 - Blue Portal

old Re: Lua Scripts/Questions/Help

Banaan
User Off Offline

Quote
Skipper has written
Is it possible to make command look like:
1
parse("setpos '..id..' '..x..' '..y..'-1)
I want that a player is just moving a pixel downwards.
I hope you can help.


The it should be
1
parse("setpos "..id.." "..x.." "..y-1)

old no attack

Caelenn
User Off Offline

Quote
How to make script than when i attack with laser i do no damage?

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
Nelight has written
How to make script than when i attack with laser i do no damage?


1
2
3
4
5
addhook("hit","nohit") function nohit(id,src,wpn)
	if wpn==45 then
		return 1
	end
end

old Re: Lua Scripts/Questions/Help

maPmaKer
User Off Offline

Quote
maPmaKer has written
Does anybody knows a lua to replace the normal fog of war with a flashlight so it would look like flashlight?


Still need help with this. Any ideas? Any codes?

old Re: Lua Scripts/Questions/Help

Yasday
User Off Offline

Quote
Banaan has written
Skipper has written
Is it possible to make command look like:
1
parse("setpos '..id..' '..x..' '..y..'-1)
I want that a player is just moving a pixel downwards.
I hope you can help.


The it should be
1
parse("setpos "..id.." "..x.." "..y-1)

hmm this would just work like this i think or?
1
2
local x,y = player(id,'x'),player(id,'y')
parse("setpos "..id.." "..x.." "..y-1)

old Re: Lua Scripts/Questions/Help

TDShuft
User Off Offline

Quote
is there how i create an script item data base like
bh_item(itemid,"name")
or
bh_item(itemid,"price")
?

also can some 1 say what "~=" does ??
edited 1×, last 24.10.10 04:54:10 pm

old Re: Lua Scripts/Questions/Help

beckerchen
User Off Offline

Quote
TDShuft has written
also can some 1 say what "~=" does ??


if someone is not == then its ~=

as example

"if not x == y then " = " if x ~= y then "

old Re: Lua Scripts/Questions/Help

Lee
Moderator Off Offline

Quote
beckerchen has written
"if not x == y then " = " if x ~= y then "

That's not completely correct, == has one of the lowest order of operator precedence so that
1
not x == y
evaluates to
1
(not x) == y
The correct syntax would be
1
not (x == y)

old Re: Lua Scripts/Questions/Help

maPmaKer
User Off Offline

Quote
Does anybody has a lua script with a map voting menu. So it will not be needed to type the map that he want to vote just to press "F2" or "F3" and to see maps there. If it clicks on a map it will be automatically voted

Any code?

old Re: Lua Scripts/Questions/Help

TDShuft
User Off Offline

Quote
Arcas has written
Is it possible to make a script that is triggered by an in-map trigger?
If so, can I have scripts or ideas?

1
2
3
4
5
6
7
8
9
10
11
trigger(trigger,source)					on trigger (once per trigger)
-trigger: trigger name
-source: triggered by 0=map/1=script
>return:	0 - proceed normally
		1 - don't trigger

triggerentity(x,y)					on trigger (for triggered entities)
-x: entity x position (tiles)
-y: entity y position (tiles)
>return:	0 - proceed normally
		1 - don't trigger
Example :
1
2
3
4
5
6
7
8
9
10
11
12
13
addhook("trigger","trigger")
function trigger(t,s)
if t=="triggername" then
--your script here
end
end
--or
addhook("triggerentity","trigger")
function triggerentity(x,y)
if x==xtile and y==ytile then
--your script here
end
end
next time take a look in info.txt in your lua files

old Re: Lua Scripts/Questions/Help

Banaan
User Off Offline

Quote
Yasday has written
Banaan has written
Skipper has written
Is it possible to make command look like:
1
parse("setpos '..id..' '..x..' '..y..'-1)
I want that a player is just moving a pixel downwards.
I hope you can help.


The it should be
1
parse("setpos "..id.." "..x.." "..y-1)

hmm this would just work like this i think or?
1
2
local x,y = player(id,'x'),player(id,'y')
parse("setpos "..id.." "..x.." "..y-1)


Yes it would.
Yet a shift of 1 pixel is really tiny, that's 1/32 or 0,03125 tiles.

old Re: Lua Scripts/Questions/Help

Chex
User Off Offline

Quote
TDShuft has written
Arcas has written
Is it possible to make a script that is triggered by an in-map trigger?
If so, can I have scripts or ideas?

1
2
3
4
5
6
7
8
9
10
11
trigger(trigger,source)					on trigger (once per trigger)
-trigger: trigger name
-source: triggered by 0=map/1=script
>return:	0 - proceed normally
		1 - don't trigger

triggerentity(x,y)					on trigger (for triggered entities)
-x: entity x position (tiles)
-y: entity y position (tiles)
>return:	0 - proceed normally
		1 - don't trigger
Example :
1
2
3
4
5
6
7
8
9
10
11
12
13
addhook("trigger","trigger")
function trigger(t,s)
if t=="triggername" then
--your script here
end
end
--or
addhook("triggerentity","trigger")
function triggerentity(x,y)
if x==xtile and y==ytile then
--your script here
end
end
next time take a look in info.txt in your lua files

Okay, Ill take a look at it.
Btw, thanks for explaining it
To the start Previous 1 2288 289 290338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview