Forum

> > CS2D > General > Multiple Lua Scripts
Forums overviewCS2D overviewGeneral overviewLog in to reply

English Multiple Lua Scripts

11 replies
To the start Previous 1 Next To the start

old Multiple Lua Scripts

Proplayer
User Off Offline

Quote
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

old Re: Multiple Lua Scripts

mozilla1
User Off Offline

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

old Re: Multiple Lua Scripts

Chingy
User Off Offline

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

old Thanks

Proplayer
User Off Offline

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

old Re: Multiple Lua Scripts

VADemon
User Off Offline

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

old Re: Multiple Lua Scripts

Proplayer
User Off Offline

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

old Re: Multiple Lua Scripts

ohaz
User Off Offline

Quote
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

old Re: Multiple Lua Scripts

VADemon
User Off Offline

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

old Re: Multiple Lua Scripts

Divine
User Off Offline

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

old Re: Multiple Lua Scripts

TopNotch
User Off Offline

Quote
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.
To the start Previous 1 Next To the start
Log in to replyGeneral overviewCS2D overviewForums overview