Divide the main.nut file

Started by umar4911, Sep 17, 2017, 08:39 AM

Previous topic - Next topic

umar4911

My code is on thousands of lines and tons of cmds. Can playercmds and function divided into other .nut files or not
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

Anik


umar4911

RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

Zone_Killer

Yes you can.
put it in your on script load
dofile( "NUT 1.nut" );
dofile( "NUT 2.nut" );
Bohemia Is God Of Punjabi Rap
Yo Yo Honey Singh tou chutiya hai

umar4911

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
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

NicusorN5

Use the full relative location to the server. Example: "scripts/your script.nut" .

=RK=MarineForce

Function On script load

dofile( "script/commands.nut" );


umar4911

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
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

Cool

Guys he is newbie give him example snippet

!

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


Discord: zeus#5155

umar4911

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


Ahh!!
I was using it on scriptload. My mistake. xD
Problem Solved.
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter