Forum

> > CS2D > General > Multiple Lua Scripts
ForenübersichtCS2D-ÜbersichtGeneral-ÜbersichtEinloggen, um zu antworten

Englisch Multiple Lua Scripts

11 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Multiple Lua Scripts

Proplayer
User Off Offline

Zitieren
Hey Guys,

I have a doubt about one thing...
I am using a lua script which i downloaded from the lua section of the forum.
I want to download one more script..
How can i run two scripts at the same time?
Thanks in Advance

ProPlayer

alt Re: Multiple Lua Scripts

mozilla1
User Off Offline

Zitieren
If they are complex scripts, it would have an incompatibility.
Usually it occurs with hooks and tables (same name, values, etc).

alt Re: Multiple Lua Scripts

Chingy
User Off Offline

Zitieren
As example:
If both have the command !ban and you will use it, it could occur an error which is maybe able to crash the server.

alt Thanks

Proplayer
User Off Offline

Zitieren
Thanks guy for helping me out.
I guess i have to use only on lua script for now

alt Re: Multiple Lua Scripts

VADemon
User Off Offline

Zitieren
Generally you can use as many scripts as you want, but due to stupidness of our scripters they use the "same names" for every script. You can use just one name at once. Like I said scripters there are dumb and use the same names that lead to the incompabitility.

alt Re: Multiple Lua Scripts

Proplayer
User Off Offline

Zitieren
i have a script which i downloaded from lua section and named the file as server.lua for my convenience.
It has many scripts.
If i have to add one more should paste the whole script in the server.lua file?

alt Re: Multiple Lua Scripts

ohaz
User Off Offline

Zitieren
usually, you don't have any "real" script in your server.lua
You have other files for your scripts (like script1.lua and script2.lua) and only "start" these scripts via the server.lua
To do that, you have to use the dofile() command. If you have a script1.lua and a script2.lua, your server.lua should look like this:
1
2
dofile("sys/lua/script1.lua")
dofile("sys/lua/script2.lua")
NEVER EVER paste scripts to the server.lua. It just completely destroys the use of it and makes multiple scripts unmanageable

alt Re: Multiple Lua Scripts

VADemon
User Off Offline

Zitieren
I don't mean the file names but the scripts itself.
1
addhook("attack", "_attack") --script 1
1
addhook("attack", "_attack") --script 2
When you get 2 scripts of the above then they're incompatible with each other.

alt Re: Multiple Lua Scripts

Divine
User Off Offline

Zitieren
There can be multiple scripts as long as they dont use the same command/keyword or menu such as f2, f3, f4.

alt Re: Multiple Lua Scripts

TopNotch
User Off Offline

Zitieren
You can use the autorun folder or like @user ohaz: said.
Just be sure the scripts aren't using the same serveractions(F2,F3,F4) or hooks.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antwortenGeneral-ÜbersichtCS2D-ÜbersichtForenübersicht