Forum




creating script
13 replies








One year ago when I started to script in lua (CS2D scripts), I have been creating script like this:
1
2
3
4
2
3
4
addhook("minute","info") function info() 	msg("It's my own CS2D script!") end
or:
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
addhook("say","weapon") function iweapon(id,txt) 	if txt=="!help" then 		parse("equip "..id.." 69") 		parse("equip "..id.." 3") 		parse("equip "..id.." 41") 	end end
Now I make scripts like my



edited 2×, last 10.04.12 02:20:32 pm

1
2
3
4
2
3
4
addhook("minute","info") function info() msg("It's my own CS2D script!") end
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
addhook("say","weapon") function iweapon(id,txt) if txt=="!help" then parse("equip "..id.." 69") parse("equip "..id.." 3") parse("equip "..id.." 41") end end

If you ask what is it code:
CS2D execute code from lua scripts

edited 1×, last 10.04.12 10:02:03 pm



It also wouldn't hurt to read all the packaged lua function classes such as math, os, io, etc.
To really use lua, you need to understand how cs2d uses it as well with hooks. I'd say cs2d's addhook is similar to actionscript and javascripts "add listener".

Very funny.
edited 1×, last 11.04.12 09:26:45 pm

Then save as *.lua
It's easiest way. You can also download lua editor, but I use notepad.
My Computer -> Tools -> View -> Hide Extensions For Known File Types -> Uncheck -> OK
Hangoooovver Says :
1
and do you know editor?
What are you talking about?



