Forum

> > CS2D > Scripts > Merging
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Merging

7 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Merging

Nixo
User Off Offline

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

alt Re: Merging

GeoB99
Moderator Off Offline

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

alt Re: Merging

Nixo
User Off Offline

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

alt Re: Merging

VADemon
User Off Offline

Zitieren
@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.

alt Re: Merging

Dousea
User Off Offline

Zitieren
@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.

alt Re: Merging

Nixo
User Off Offline

Zitieren
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
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht