Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: umar4911 on Aug 09, 2017, 03:06 PM

Title: client side script, dofile
Post by: umar4911 on Aug 09, 2017, 03:06 PM
I am making my own server in vcmp. I know javascript so I understand squirrel a little. Due to lack of squirrel knowledge, I am unable to perform some tasks. Plz, help me.
My questions are:
how to install client side script?(I don't know so I am unable to add registration system)

Whenever I use dofile option, the file doesn't attach and give an error that script load not executed. How to correctly use the option and where to the file to be attached?

Title: Re: client side script, dofile
Post by: EK.IceFlake on Aug 09, 2017, 06:00 PM
You need to place your client-side scripts in store/script and name your entry script (the script that is loaded first) main.nut.
Title: Re: client side script, dofile
Post by: umar4911 on Aug 10, 2017, 02:07 PM
Quote from: EK.IceFlake on Aug 09, 2017, 06:00 PMYou need to place your client-side scripts in store/script and name your entry script (the script that is loaded first) main.nut.
Thank you. My first question is answered. Now plz tell me that where to put the file which is going to be loaded by dofile. I have many server and client sided scripts to be installed. Should I merge all files into main.nut in store/script or these can be link? if can then how?
Title: Re: client side script, dofile
Post by: KAKAN on Aug 10, 2017, 04:00 PM
Quote from: umar4911 on Aug 10, 2017, 02:07 PM
Quote from: EK.IceFlake on Aug 09, 2017, 06:00 PMYou need to place your client-side scripts in store/script and name your entry script (the script that is loaded first) main.nut.
Thank you. My first question is answered. Now plz tell me that where to put the file which is going to be loaded by dofile. I have many server and client sided scripts to be installed. Should I merge all files into main.nut in store/script or these can be link? if can then how?
Place all those files in store\script.
For ex: This are files in store\script:-
main.nut
hello.nut
smd.nut
In your main.nut, you can simply use dofile("hello.nut") or dofile("smd.nut"); to load the respective files.
Title: Re: client side script, dofile
Post by: umar4911 on Aug 10, 2017, 06:06 PM
Quote from: KAKAN on Aug 10, 2017, 04:00 PM
Quote from: umar4911 on Aug 10, 2017, 02:07 PM
Quote from: EK.IceFlake on Aug 09, 2017, 06:00 PMYou need to place your client-side scripts in store/script and name your entry script (the script that is loaded first) main.nut.
Thank you. My first question is answered. Now plz tell me that where to put the file which is going to be loaded by dofile. I have many server and client sided scripts to be installed. Should I merge all files into main.nut in store/script or these can be link? if can then how?
Place all those files in store\script.
For ex: This are files in store\script:-
main.nut
hello.nut
smd.nut
In your main.nut, you can simply use dofile("hello.nut") or dofile("smd.nut"); to load the respective files.
In which main.nut we have to dofile.  The client sided or server sided. I have another question. How to add delay such as in most of the servers,  there is delay in heal cmd that he have to wait 5 second to heal
Title: Re: client side script, dofile
Post by: Xmair on Aug 10, 2017, 07:23 PM
This applies to where you want to load the file, also for the delay, use the NewTimer function @server side
Title: Re: client side script, dofile
Post by: KAKAN on Aug 11, 2017, 08:24 AM
For server scripts, use server's main.nut.
For client, use client's main.nut.
Both are different.
Also, for timers and everything else, check the Unmaintained wiki (http://wiki.vc-mp.org/wiki/Main_Page)
Title: Re: client side script, dofile
Post by: umar4911 on Aug 11, 2017, 03:19 PM
Thank you. Problem solved