Class CoopMap
+ Class Map
Inherited Members
@@ -116,16 +116,16 @@
Namespace: RageCoop.Client
Assembly: RageCoop.Client.dll
- Syntax
+ Syntax
- public class CoopMap
+ public class Map
Properties
-
- Props
+
+ Props
Declaration
diff --git a/docs/api/RageCoop.Client.Scripting.API.html b/docs/api/RageCoop.Client.Scripting.API.html
index cb8b2b5..e516b33 100644
--- a/docs/api/RageCoop.Client.Scripting.API.html
+++ b/docs/api/RageCoop.Client.Scripting.API.html
@@ -280,31 +280,18 @@
- Methods
-
-
- Disconnect()
- Disconnect from the server
-
-
- Declaration
-
- public static void Disconnect()
-
-
-
-
- GetLogger()
+
+ Logger
Get a Logger that RAGECOOP is currently using.
Declaration
- public static Logger GetLogger()
+ public static Logger Logger { get; }
- Returns
+ Property Value
Inherited Members
@@ -116,16 +116,16 @@public class CoopMap
+ public class Map
Disconnect from the server
-public static void Disconnect()
- Get a Logger that RAGECOOP is currently using.
public static Logger GetLogger()
+ public static Logger Logger { get; }
Methods +
+ + + +Disconnect()
+Disconnect from the server
+Declaration
+public static void Disconnect()
+ SendCustomEvent(Int32, List<Object>)
-Send an event and data to the specified clients.
+Send an event and data to the server.
Declaration
@@ -453,6 +453,39 @@ byte, short, ushort, int, uint, long, ulong, float, bool, string. + + + +SendCustomEvent(Int32, Object[])
+Send an event and data to the server.
+Declaration
+public static void SendCustomEvent(int eventHash, params object[] args)
+ Parameters
+Type | +Name | +Description | +
---|---|---|
Int32 | +eventHash | ++ |
Object[] | +args | ++ |
CurrentResource
+Get the ClientResource that this script belongs to.
+Declaration
+public ClientResource CurrentResource { get; }
+ Property Value
+Type | +Description | +
---|---|
ClientResource | ++ |
Methods
diff --git a/docs/api/RageCoop.Client.Settings.html b/docs/api/RageCoop.Client.Settings.html index 4962d01..c828ece 100644 --- a/docs/api/RageCoop.Client.Settings.html +++ b/docs/api/RageCoop.Client.Settings.html @@ -361,6 +361,32 @@ + +ResourceDirectory
+The directory where resources downloaded from server will be placed.
+Declaration
+public string ResourceDirectory { get; set; }
+ Property Value
+Type | +Description | +
---|---|
String | ++ |
Username
Don't use it!
diff --git a/docs/api/RageCoop.Client.html b/docs/api/RageCoop.Client.html index e351a2a..a038bd1 100644 --- a/docs/api/RageCoop.Client.html +++ b/docs/api/RageCoop.Client.html @@ -87,7 +87,7 @@Classes
-CoopMap
+Map
Settings
Don't use it!
diff --git a/docs/api/RageCoop.Server.Client.html b/docs/api/RageCoop.Server.Client.html index c1aa17e..44ecd8a 100644 --- a/docs/api/RageCoop.Server.Client.html +++ b/docs/api/RageCoop.Server.Client.html @@ -205,7 +205,7 @@Latency
-The client's latncy in seconds.
+The client's latency in seconds.
Declaration
@@ -406,6 +406,38 @@ + +SendCustomEvent(Int32, Object[])
+ + +Declaration
+public void SendCustomEvent(int hash, params object[] args)
+ Parameters
+Type | +Name | +Description | +
---|---|---|
Int32 | +hash | ++ |
Object[] | +args | ++ |
SendNativeCall(Hash, Object[])
Send a native call to client and ignore it's response.
diff --git a/docs/api/RageCoop.Server.Scripting.API.html b/docs/api/RageCoop.Server.Scripting.API.html index 21cbfe3..8b79ad0 100644 --- a/docs/api/RageCoop.Server.Scripting.API.html +++ b/docs/api/RageCoop.Server.Scripting.API.html @@ -131,7 +131,7 @@Declaration
public readonly APIEvents Events
+ public readonly ServerEvents Events
Field Value
APIEvents | +ServerEvents |
Type | +Description | +
---|---|
ServerEntities | ++ |
Logger
-Get a Logger that the server is currently using, you should use Logger to display resource-specific information.
+Get a Logger that the server is currently using, you should use Logger to display resource-specific information.
Declaration
diff --git a/docs/api/RageCoop.Server.Scripting.ServerEvents.html b/docs/api/RageCoop.Server.Scripting.ServerEvents.html new file mode 100644 index 0000000..db8e356 --- /dev/null +++ b/docs/api/RageCoop.Server.Scripting.ServerEvents.html @@ -0,0 +1,336 @@ + + + + + + + ++
API
-Get the API instance that can be used to control the server.
+Get the API instance that can be used to control the server.
Declaration
@@ -179,7 +179,7 @@CurrentResource
-Get the ServerResource object this script belongs to, this property will be initiated before OnStart() (will be null if you access it in the constructor).
+Get the ServerResource this script belongs to, this property won't be initiated before OnStart().
Declaration
diff --git a/docs/api/RageCoop.Server.Scripting.html b/docs/api/RageCoop.Server.Scripting.html index a5865ac..a99e584 100644 --- a/docs/api/RageCoop.Server.Scripting.html +++ b/docs/api/RageCoop.Server.Scripting.html @@ -90,8 +90,6 @@API
An class that can be used to interact with RageCoop server.
APIEvents
-ChatEventArgs
Command
@@ -106,6 +104,8 @@OnCommandEventArgs
+ServerEvents
+ServerResource
A class representing a server side resource, each resource is isolated from another and will be started alongside the server.
+
+
ID
-The ped's ID (not handle!).
+The ped's network ID (not handle!).
Declaration
@@ -177,6 +177,58 @@IsPlayer
+Whether this ped is a player.
+Declaration
+public bool IsPlayer { get; }
+ Property Value
+Type | +Description | +
---|---|
Boolean | ++ |
LastVehicle
+The ped's last vehicle.
+Declaration
+public ServerVehicle LastVehicle { get; }
+ Property Value
+Type | +Description | +
---|---|
ServerVehicle | ++ |
Owner
The Client that is responsible synchronizing for this ped.
@@ -229,14 +281,14 @@ - -VehicleID
-The ID of the ped's last vehicle.
+ +Rotation
+Gets or sets this ped's rotation
Declaration
public int VehicleID { get; }
+ public Vector3 Rotation { get; }
Property Value
Int32 | +GTA.Math.Vector3 |
Type | -Description | -
---|---|
Int32 | -- |
Properties
AnnounceSelf
-Whether or not to announce this server so that it'll appear on server list.
+Whether or not to announce this server so it'll appear on server list.
Declaration
@@ -178,9 +151,35 @@LogLevel
+See LogLevel.
+Declaration
+public int LogLevel { get; set; }
+ Property Value
+Type | +Description | +
---|---|
Int32 | ++ |
MasterServer
-Master server address, mostly doesn't to be changed.
+Master server address, mostly doesn't need to be changed.
Declaration
diff --git a/docs/api/RageCoop.Server.ServerVehicle.html b/docs/api/RageCoop.Server.ServerVehicle.html new file mode 100644 index 0000000..3bae4cf --- /dev/null +++ b/docs/api/RageCoop.Server.ServerVehicle.html @@ -0,0 +1,266 @@ + + + + + + + ++
Server
The instantiable RageCoop server class
+ServerEntities
+Manipulate entities from the server
+ServerObject
+Represents an object owned by server.
ServerPed
Represents a ped from a client
ServerSettings
Settings for RageCoop Server
+ServerVehicle
+Represents a vehicle from a client
Getting started
-Here you can learn how to create your first resource
+Resources and Scripts
+A Script stands for class that inherits from RageCoop's script class ( ServerScript and ClientScript ) and will be loaded at runtime, one assembly can have multiple scripts in it.
+A Resource consists of one or more assemblies and other files. Server-side resource will be loaded at startup and is isolated from other resources, while client-side resource will be sent to each client and loaded after they connected to the server. A Resource can either be in a folder or packed inside a zip archive.
Directory structure
Below is the server's directory structure
ServerRoot
│ Settings.xml
+| RageCoop.Server.exe
│
└───Resources
└───Server
@@ -91,16 +94,13 @@
└───Temp
Settings.xml
-This file will be generated first time you started the, you can change the server's configuration option by editing it, refer to this for detailed description.
-Resources
-Each directory or zip in represents one resource, which consists of several dlls, and is isolated from another resource.
+This file will be generated first time you started the server, you can then change the server's configuration option by editing it, refer to ServerSettings for detailed description.
Server Reource
-The resource will be running at server side, here's how to create one:
+To create a server resource:
- Create a C# class library project targeting .NET 6.0.
- Add reference to RageCoop.Server.dll and RageCoop.Core.dll. -
- Add following namespace(s): -
using RageCoop.Server.Scripting;
// Optional
@@ -109,24 +109,33 @@ using RageCoop.Core.Scripting;
using RageCoop.Core;
--
+
OnStart()
and OnStop()
:public class MyFirstResource :ServerScript
+Implement OnStart()
and OnStop()
, your cs file should look like this:
+using RageCoop.Server.Scripting;
+
+namespace NiceGuy.MyFirstResource
{
- public override void OnStart()
- {
- // Initiate your script here
- }
- public override void OnStop()
- {
- // Free all resources and perform cleanup
- }
+ public class Main : ServerScript
+ {
+ public override void OnStart()
+ {
+ // Initiate your script here
+ }
+ public override void OnStop()
+ {
+ // Free all resources and perform cleanup
+ }
+ }
}
-
+Now you can have some fun by using the API instance, please refer to the GitHub repo for more examples.
+For convenience, you can create a symlink in ServerRoot/Resources/Server/NiceGuy.MyFirstResource
targeting your output folder:
+mklink /d ServerRoot/Resources/Server/NiceGuy.MyFirstResource C:/MyRepos/NiceGuy.MyFirstResource/bin/Debug
+
+
+That's it! Start your server and you should see your resource loading.