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 2217 218 219338 339 Next To the start

old Re: Lua Scripts/Questions/Help

Homer
User Off Offline

Quote
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.

old Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Quote
Levic has written
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

edited 1×, last 07.07.10 07:34:15 pm

old Re: Lua Scripts/Questions/Help

Starkkz
Moderator Off Offline

Quote
texnonikWP has written
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

old Re: Lua Scripts/Questions/Help

Homer
User Off Offline

Quote
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

old Re: Lua Scripts/Questions/Help

Icarus
COMMUNITY BANNED Off Offline

Quote
DC has written
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!

old Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Quote
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...

old Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Quote
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

old Re: Lua Scripts/Questions/Help

mafia_man
User Off Offline

Quote
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
To the start Previous 1 2217 218 219338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview