Jump to content
nanos GbR
Jan C.

JC3:MP Server Emulator - Start Scripting your Gamemodes

Recommended Posts

Hello future Server Owners and Scripters!

Today we are very happy to release the jcmp-server-emulator. It is basically what some people might now as "STA" from GTA:MP times. It allows you to work on your gamemodes using the JC3:MP Scripting API without the server being released (yet). It has some limitations right now
but we'll get to that later.

# Installation
For Installation notes, see the repository. You need to have node.js (which bundles npm with it) installed.

# Starting empty
The server emulator will load all packages from the "packages" directory. Just create the following structure:

- packages
  - my-package
    - package.json
    - main.js

package.json content should just be "{}" for now. For users who already know npm, you can just use the npm init command.
You can now write your script in the main.js. Simply run the jcmp-server command (if you installed it globally) and you're good to go!

# Spawning fake Players
A server without players is boring. The server emulator provides several utility functions such as the ability to spawn a fake player.
Just call emulator.createFakePlayer('Some Player Name'); and a new Player will be created.

# What other functions do we get?
Please read the documentation. The 'emulator' object is available in every package.

# Where do I find the scripting documentation?

here.

# What are the current drawbacks?
The server emulator misses some functionality right now. If you are interested in helping out, please have a look at the jcmp-server-emulator and jcmp-stubs package.

A short list of things missing:
- Setting Vehicle.driver will not change the "vehicle" property of a Player.
- Vehicle.SetOccupant does nothing
- Similar to Vehicle.SetOccupant, other functions might have no functionality.
- To print objects, you have to use emulator.print(object).
- Players can only have one weapon in the 'Player.weapons' array.
- The Server Config is empty.

 

# When will we be able to test the actual server and client?

Unfortunately, we have no date for this yet.

  • Upvote 5

Share this post


Link to post
Share on other sites

Anyone else getting this error? 

C:\Users\xxxx\AppData\Roaming\npm\node_modules\jcmp-server-emulator\index.js:19
const { Emulator } = require('./emulator');
      ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (C:\Users\xxxxxx\AppData\Roaming\npm\node_modules\jcmp-server-emulator\bin\jcmp-server.js:3:1)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)

C:\Users\xxxxxx\AppData\Roaming\npm>pause
Press any key to continue . . .

I went through the code and there is certainly handling for the lack of a packages folder so I'm sure it isn't that. Is it a bug or a fault on my side? 

Share this post


Link to post
Share on other sites

Ok, I'm not gonna lie. I dont understand one single bit of this. Can someone give me some tutorials for whatever scripting language you use? Just give me anything that might get me into this. And I'm not a complete programming noob, I know c# and VB.net.

Share this post


Link to post
Share on other sites
38 minutes ago, Vinc62 said:

How can I download the online of Just Cause 3 please ?

The mod is not yet released - you can not play JC3:MP at the moment. It will be released by the end of 2016

  • Upvote 1

Share this post


Link to post
Share on other sites
1 hour ago, ahk1221 said:

Ok, I'm not gonna lie. I dont understand one single bit of this. Can someone give me some tutorials for whatever scripting language you use? Just give me anything that might get me into this. And I'm not a complete programming noob, I know c# and VB.net.

please? Anyone?

Share this post


Link to post
Share on other sites
14 hours ago, ahk1221 said:

please? Anyone?

It uses Javascript via NodeJS. Currently there is no big documentation on JC3:MP scripting available because the mod is not out yet. If you do not understand the current emulator then I guess it is best to wait till the full mod, server and API is released together with tutorials and a proper wiki.

  • Upvote 1

Share this post


Link to post
Share on other sites

I really suck at coding but I'm good at making maps in unreal engine 4... *Sigh*. If I were good at coding I'd definetely make a RP server. Any coder who wants to give it a shot?

Share this post


Link to post
Share on other sites
2 hours ago, Xaniac said:

I really suck at coding but I'm good at making maps in unreal engine 4... *Sigh*. If I were good at coding I'd definetely make a RP server. Any coder who wants to give it a shot?

Oh that feeling...

I'll give you a tip, never stop trying... if you really want to make a  RP server, then do it!

Soon you will be a good programmer, you just have to learn it, that's life.

  • Upvote 2

Share this post


Link to post
Share on other sites
Quote

# Spawning fake Players
A server without players is boring. The server emulator provides several utility functions such as the ability to spawn a fake player.
Just call emulator.createFakePlayer('Some Player Name'); and a new Player will be created.

I think that I've installed the emulator correctly... However, how do I connect with a "fake player"?

A more detailed version would be much appreciated!

Edited by Anzo

Share this post


Link to post
Share on other sites

You should just be able to paste the mentioned snippet in your main.js for example. Just put it at the end of your file and try it out. If you still cant get it to work, hit me up on Discord or reply here. 

Share this post


Link to post
Share on other sites
1 hour ago, Jan C. said:

You should just be able to paste the mentioned snippet in your main.js for example. Just put it at the end of your file and try it out. If you still cant get it to work, hit me up on Discord or reply here. 

b59509c4347b3fdb97ce82ef5390bd62.png

Looks like it worked, thank you very much!

One more question though. Is there a way to act as the fake player like you could in the GTA-MP STA by using FakePlayer.exe?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

By using this site, you agree to our Terms of Use.