Forum

> > CS2D > Scripts > How to create lua script ?
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch How to create lua script ?

10 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt How to create lua script ?

BlackSoul
User Off Offline

Zitieren
hi, how to create lua script ?
what is addhook or more.. i dont know what is this,,
please share to me basic basic lua and how to create lua
and what application to create lua

Thanks.

alt Re: How to create lua script ?

Rainoth
Moderator Off Offline

Zitieren
Well for starters. Open your cs2d folder then go to lua folder and keep navigating until you find 'samples'. Read those. They are pretty good to learn some stuff.

As for how things work, user Starkkz made a nice lua scripting tutorial. Check it out.

For your question about hooks - when you perform things on CS2D (or when a certain time amount passes), you can use a hook to trigger a function. You could say that a hook would be starting up the car and function would be driving the car. You can find info on hooks (and not just them) at cs2d.com

People choose different programs to write code so searching google will help. As for me, I use Notepad++ when I need to write a lua code.

Hope that helps. Good luck.

alt Re: How to create lua script ?

THEMUD
User Off Offline

Zitieren
Well, what did @user Rainoth said is truth.
But, if you created a script and you want to test it, then just put your .lua file in /sys/lua/.
And to run it, go to file called "server.lua" and then put this code below:
1
dofile("sys/lua/filename.lua")

Otherwise, you should have some knowledge about Lua programming and writing codes, well I will give you an URL to learn some Lua as well.
Click here to enter !
It will helps you very much, although it will gives you a Compilar, IDE and Editor.
But for more comfortableness, use Notepad++ or Sublime Text 3.

Also, I will give you a simple basic code:
It's for saying colors !

1
2
3
4
addhook("say", "color")
function color(id, text)
msg("©255255255"..player(id, "usgn")..": "..text)
end
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht