Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: umar4911 on Sep 17, 2017, 08:39 AM

Title: Divide the main.nut file
Post by: umar4911 on Sep 17, 2017, 08:39 AM
My code is on thousands of lines and tons of cmds. Can playercmds and function divided into other .nut files or not
Title: Re: Divide the main.nut file
Post by: Anik on Sep 17, 2017, 08:54 AM
why not
Title: Re: Divide the main.nut file
Post by: umar4911 on Sep 17, 2017, 02:32 PM
Quote from: Anik on Sep 17, 2017, 08:54 AMwhy not
What??
Title: Re: Divide the main.nut file
Post by: Zone_Killer on Sep 17, 2017, 02:43 PM
Yes you can.
put it in your on script load
dofile( "NUT 1.nut" );
dofile( "NUT 2.nut" );
Title: Re: Divide the main.nut file
Post by: umar4911 on Sep 17, 2017, 03:32 PM
Quote from: Zone_Killer on Sep 17, 2017, 02:43 PMYes you can.
put it in your on script load
dofile( "NUT 1.nut" );
dofile( "NUT 2.nut" );
It says cannot open file
Title: Re: Divide the main.nut file
Post by: NicusorN5 on Sep 17, 2017, 06:25 PM
Use the full relative location to the server. Example: "scripts/your script.nut" .
Title: Re: Divide the main.nut file
Post by: =RK=MarineForce on Sep 17, 2017, 09:52 PM
Function On script load

dofile( "script/commands.nut" );

Title: Re: Divide the main.nut file
Post by: umar4911 on Sep 18, 2017, 03:07 PM
Quote from: Rampages Killers on Sep 17, 2017, 09:52 PMFunction On script load

dofile( "script/commands.nut" );


Quote from: NicusorN5 on Sep 17, 2017, 06:25 PMUse the full relative location to the server. Example: "scripts/your script.nut" .
still no
Title: Re: Divide the main.nut file
Post by: Cool on Sep 18, 2017, 03:11 PM
Guys he is newbie give him example snippet
Title: Re: Divide the main.nut file
Post by: ! on Sep 18, 2017, 03:51 PM
Quote from: Cool on Sep 18, 2017, 03:11 PMGuys he is newbie give him example snippet


Make a file in server_directory/scripts/cmds.nut

Now cut all commands and paste in cmds.nut
Your cmds.nut file will be something like this
function onPlayerCommand( player, commands, text )
{
bla bla bla
nub nub nub
bla bla bla
nub nub nub
}

Now open main.nut and add this line
//add in function onServerStart()
dofile( "scripts/Cmds.nut" );








Video Tutorial
(https://alexlehmpost.files.wordpress.com/2012/09/2d0b8-twirler.gif)
Title: Re: Divide the main.nut file
Post by: umar4911 on Sep 22, 2017, 09:39 AM
Quote from: zeus on Sep 18, 2017, 03:51 PM
Quote from: Cool on Sep 18, 2017, 03:11 PMGuys he is newbie give him example snippet


Make a file in server_directory/scripts/cmds.nut

Now cut all commands and paste in cmds.nut
Your cmds.nut file will be something like this
function onPlayerCommand( player, commands, text )
{
bla bla bla
nub nub nub
bla bla bla
nub nub nub
}

Now open main.nut and add this line
//add in function onServerStart()
dofile( "scripts/Cmds.nut" );








Video Tutorial
(https://alexlehmpost.files.wordpress.com/2012/09/2d0b8-twirler.gif)

Ahh!!
I was using it on scriptload. My mistake. xD
Problem Solved.