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 2217 218 219338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

Homer
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
addhook("say","myposfind")
function myposfind(id, txt)
if player(id,"health") > 0 then
	if txt == "!mypos" then
	msg2(id, "Your Position X Pixels: "..player(id,"x"))
	msg2(id, "Your Position Y Pixels: "..player(id,"y"))
	msg2(id, "Your Position X Tiles: "..player(id,"tilex"))
	msg2(id, "Your Position Y Tiles: "..player(id,"tiley"))
	end
end
end
I don't know, that might work.

alt Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Zitieren
Levic hat geschrieben
dont work


this will work

1
2
3
4
5
6
7
addhook ("say","text")
function text(p,t)
if t=="!mypos" then 
parse ("sv_msg2 "..p.." Your position is Tile X ="..player(p,"tilex").."  Tile Y ="..player(p,"tiley").."") 
parse ("sv_msg2 "..p.." Your position is Pixel X ="..player(p,"x").."  Pixel Y ="..player(p,"y").."") 
end
end

1× editiert, zuletzt 07.07.10 19:34:15

alt Re: Lua Scripts/Questions/Help

Starkkz
Moderator Off Offline

Zitieren
texnonikWP hat geschrieben
Why dont working ?

[ code ]addhook("startround","sample.ut.startround")
function sample.ut.startround()
     local game=math.random(1,4)
     if game==1 then
          parse("trigger a1")
          sample.trigger="a1"
     elseif game==2 then
          parse("trigger a2")
          sample.trigger="a2"
     elseif game==3 then
          parse("trigger a3")
          sample.trigger="a3"
     elseif game==4 then
          parse("trigger a4")
          sample.trigger="a4"
          end
     end
end[ /code ]


1
2
3
4
5
6
addhook("startround","sample.startround")
function sample.startround()
	local game = math.random(1,4)
	parse("trigger a"..game)
	sample.trigger = "a"..game
end

alt Re: Lua Scripts/Questions/Help

Homer
User Off Offline

Zitieren
Lol, Levic I tried it to make sure, works perfectly, except I didn't know if you wanted the return so just add return 1 and then it works without showing !mypos
1
2
3
4
5
6
7
8
9
10
11
12
addhook("say","myposfind")
function myposfind(id, txt)
if player(id,"health") > 0 then
     if txt == "!mypos" then
     msg2(id, "Your Position X Pixels: "..player(id,"x"))
     msg2(id, "Your Position Y Pixels: "..player(id,"y"))
     msg2(id, "Your Position X Tiles: "..player(id,"tilex"))
     msg2(id, "Your Position Y Tiles: "..player(id,"tiley"))
	return 1
     end
end
end

alt Re: Lua Scripts/Questions/Help

Icarus
COMMUNITY BANNED Off Offline

Zitieren
DC hat geschrieben
Please use this thread to post your CS2D Lua Scripts or to to ask questions about Lua!

Moreover you can upload finished and good scripts there:
> Lua Scripts file section

I recommend to use the [ code ] your script [ /code ] tags (without the spaces) to post your scripts.

> NEW ALTERNATIVE: CS2D.org
Lee established a page for your Lua questions! Visit www.CS2D.org


h i wona learn something about lua can you please say me the basics? thank you!

alt Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Zitieren
I would like to get such a script...

when u say !hide a wall 3 or wall 2 etc. appears.

Its good for construction mod when u can hide between buildings

I managed to make 1 ,but when i say it a supply appears on ALL of players... Idk how to make this code thingy...

i would write it...

parse("mp_building_health supply 10000")

addhook("say","build")
function build(id,txt)
for id=1,32 do
if (txt=="!hide") then
parse("spawnobject 9 "..player(id,"tilex").." "..player(id,"tiley").." 1 1 1 1")
end
end
end

plz help...

alt Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Zitieren
Hi all can any body show me how to write this symbol??

©

I have copied it out of a other text.
But i need it for colours in lua scripting.
Help pls

alt Re: Lua Scripts/Questions/Help

mafia_man
User Off Offline

Zitieren
Some time ago i see a man who want to create a parkour mod it's possible to make very easy.

Define a one variable isjump

If player click F2 and if he don't jumping now then he jump
And then addtimer to set variable isjump to 0 when he end jumping

if isjump is 1 then use sin and cos and rad to make player move with his direction

And then on map add a tile and if player stay on it and isjump is 0 then he got killed and spawned
Zum Anfang Vorherige 1 2217 218 219338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht