Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Lua Scripts/Questions/Help

6.770 Antworten
Seite
Zum Anfang Vorherige 1 2288 289 290338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Zitieren
BureX hat geschrieben
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

alt Re: Lua Scripts/Questions/Help

Banaan
User Off Offline

Zitieren
Skipper hat geschrieben
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)

alt no attack

Caelenn
User Off Offline

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

alt Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Zitieren
Nelight hat geschrieben
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

alt Re: Lua Scripts/Questions/Help

maPmaKer
User Off Offline

Zitieren
maPmaKer hat geschrieben
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?

alt Re: Lua Scripts/Questions/Help

Yasday
User Off Offline

Zitieren
Banaan hat geschrieben
Skipper hat geschrieben
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)

alt Re: Lua Scripts/Questions/Help

TDShuft
User Off Offline

Zitieren
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 ??
1× editiert, zuletzt 24.10.10 16:54:10

alt Re: Lua Scripts/Questions/Help

beckerchen
User Off Offline

Zitieren
TDShuft hat geschrieben
also can some 1 say what "~=" does ??


if someone is not == then its ~=

as example

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

alt Re: Lua Scripts/Questions/Help

Lee
Moderator Off Offline

Zitieren
beckerchen hat geschrieben
"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)

alt Re: Lua Scripts/Questions/Help

maPmaKer
User Off Offline

Zitieren
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?

alt Re: Lua Scripts/Questions/Help

TDShuft
User Off Offline

Zitieren
Arcas hat geschrieben
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

alt Re: Lua Scripts/Questions/Help

Banaan
User Off Offline

Zitieren
Yasday hat geschrieben
Banaan hat geschrieben
Skipper hat geschrieben
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.

alt Re: Lua Scripts/Questions/Help

Chex
User Off Offline

Zitieren
TDShuft hat geschrieben
Arcas hat geschrieben
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
Zum Anfang Vorherige 1 2288 289 290338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht