Forum

> > CS2D > Scripts > Merging
Forums overviewCS2D overview Scripts overviewLog in to reply

English Merging

7 replies
To the start Previous 1 Next To the start

old Merging

Nixo
User Off Offline

Quote
Hey there. i want to create a similar server to all thoose GTA,City,Town servers and i want to merge 2 scripts together which is the Admin script and Unlimited building script. i tryied a few things but it doesnt seem to work. Im sure i will add more scripts later on but i just want these 2 for now. Can anyone tell me how to merge them ?

old Re: Merging

GeoB99
Moderator Off Offline

Quote
To merge two scripts in one script, the easiest method is to copy the codes content from two scripts and paste in a single lua script file. However, you must consider that it'll lead to bugs and problems if they have same hooks, functions, etc. - you name it, in other words you must check carefully the code before you copy and merging it with another.

Merging more scripts is not worth at all and it would lead to problems even worse.

old Re: Merging

Nixo
User Off Offline

Quote
Alright ZxC thanks i'll be carefull. lennon : not everyone is a script expert like you

old Re: Merging

VADemon
User Off Offline

Quote
@user GeoB99, sorry, but your advise is shit.
@user Nixo, keep the scripts as separate files. There're files and folders for a reason: keeping everything clean and structured. Should you put both scripts into a single Lua file then you'll get more headache editing these scripts and fixing errors (I bet you'll post your bloated .lua file to us.de in a "help me fix that thing" thread) will become an horror for everyone.
All you need is to tell your server to load both (and possibly other) Lua scripts you have. The simplest way to accomplish that is to put the .lua files into /sys/lua/autorun/ and then those scripts will be executed AUTOMATICALLY. The lazy and simple way turns out to be the best way to do that.

old Re: Merging

Dousea
User Off Offline

Quote
@user GeoB99: That's not the "easiest" method. That's the worst method.

You can do what user VADemon said. But as an alternative, you can do files. Just create an empty Lua file and insert
1
2
dofile("sys/lua/<path to your unlimited building script>.lua")
dofile("sys/lua/<path to your admin script>.lua")
then you can save the file to autorun folder, or you can save the file anywhere and when you start your server you need to set the script as your server script, or you can do other similar way.

old Re: Merging

Nixo
User Off Offline

Quote
Havent Check on this thread for a while.. Cozen: thats what i tried a couple days ago and it worked perfectly. Doesnt take much time and easy. Thanks, and thanks to everyone else Who helped
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview