Skip to content

Instantly share code, notes, and snippets.

@SQKo
Last active May 8, 2022 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SQKo/9cdf92b6664dbb38562aa9af128705a7 to your computer and use it in GitHub Desktop.
Save SQKo/9cdf92b6664dbb38562aa9af128705a7 to your computer and use it in GitHub Desktop.
FiveM Visual Studio Code C# Snippets
{
// Place your FiveM workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
// "Print to console": {
// "scope": "javascript,typescript",
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"Base Script": {
"scope": "csharp",
"prefix": ["BaseScript", "construct"],
"body": [
"public class ${TM_FILENAME_BASE:Class1} : BaseScript",
"{",
"\tpublic ${TM_FILENAME_BASE:Class1}($2)",
"\t{",
"\t\t$1",
"\t}",
"}"
],
"description": "Blank script class extending the CitizenFX Base Script"
},
"Client Script": {
"scope": "csharp",
"prefix": ["ClientScript", "construct"],
"body": [
"public class ${TM_FILENAME_BASE:Class1} : ClientScript",
"{",
"\tpublic ${TM_FILENAME_BASE:Class1}($2)",
"\t{",
"\t\t$1",
"\t}",
"}"
],
"description": "Blank client script class extending the CitizenFX Base Script"
},
"Server Script": {
"scope": "csharp",
"prefix": ["ServerScript", "construct"],
"body": [
"public class ${TM_FILENAME_BASE:Class1} : ServerScript",
"{",
"\tpublic ${TM_FILENAME_BASE:Class1}($2)",
"\t{",
"\t\t$1",
"\t}",
"}"
],
"description": "Blank server client script class extending the CitizenFX Base Script"
},
"Tick": {
"scope": "csharp",
"prefix": "Tick",
"body": "Tick += $0;",
"description": "Add a task to Tick handler"
},
"Tick Task": {
"scope": "csharp",
"prefix": "Tick-Task",
"body": [
"[Tick]",
"private async Task $1(${2:})",
"{",
"\t$0",
"}"
],
"description": "Create a task to be handled on Tick"
},
"Event Handlers": {
"scope": "csharp",
"prefix": "EventHandlers",
"body": "EventHandlers[\"$1\"] += new Action<$2>($1);",
"description": "Add a delegate to Event handler"
},
"Exports": {
"scope": "csharp",
"prefix": "Exports",
"body": "Exports[\"$1\"] += $0;",
"description": "Export a delegate"
},
"Register Command": {
"scope": "csharp",
"prefix": ["RegisterCommand", "command", "cmd", "rcon"],
"body": [
"RegisterCommand(\"$1\", new Action<int, List<object>, string>((source, args, raw) =>",
"{",
"\t$2",
"}), ${3|false,true|});"
],
"description": "void REGISTER_COMMAND(char* commandName, func handler, BOOL restricted);"
},
"(CL) Command": {
"scope": "csharp",
"prefix": ["command", "cmd"],
"body": [
"[Command(\"$1\")]",
"private void $1(List<object> args, string raw)",
"{",
"\t$0",
"}"
],
"description": "Register a method as a client command"
},
"(SV) Command": {
"scope": "csharp",
"prefix": ["command", "cmd"],
"body": [
"[Command(\"$1\")]",
"private void $1([FromSource] Player source, List<object> args, string raw)",
"{",
"\t$0",
"}"
],
"description": "Register a method as a server command"
},
// Core Events
"OnResourceStarting": {
"scope": "csharp",
"prefix": "OnResourceStarting",
"body": [
"/// <summary>Called before a resource starts. This event can be canceled to prevent this resource from starting. <see href=\"https://docs.fivem.net/docs/scripting-reference/events/list/onResourceStarting/\"/></summary>",
"/// <param name=\"resource\">The name of the resource that is trying to start.</param>",
"[EventHandler(\"onResourceStarting\")]",
"private void OnResourceStarting(string resource)",
"{",
"\t$0",
"}"
],
"description": "An event that is triggered when a resource is trying to start. This can be canceled to prevent the resource from starting"
},
"OnResourceStart": {
"scope": "csharp",
"prefix": "OnResourceStart",
"body": [
"/// <summary>Called while a resource starts. <see href=\"https://docs.fivem.net/docs/scripting-reference/events/list/onResourceStart/\"/></summary>",
"/// <param name=\"resource\">The name of the resource that started.</param>",
"[EventHandler(\"onResourceStart\")]",
"private void OnResourceStart(string resource)",
"{",
"\t$0",
"}"
],
"description": "An event that is triggered immediately when a resource has started"
},
"OnResourceStop": {
"scope": "csharp",
"prefix": "OnResourceStop",
"body": [
"/// <summary>Called while a resource stops. <see href=\"https://docs.fivem.net/docs/scripting-reference/events/list/onResourceStop/\"/></summary>",
"/// <param name=\"resource\">The name of the resource that stopped.</param>",
"[EventHandler(\"onResourceStop\")]",
"private void OnResourceStop(string resource)",
"{",
"\t$0",
"}"
],
"description": "An event that is triggered immediately when a resource is stopping"
},
"RconCommand": {
"scope": "csharp",
"prefix": ["RconCommand", "OnRconCommand"],
"body": [
"/// <summary>This event is deprecated. Please use REGISTER_COMMAND instead, and use the <c>restricted</c> flag. <see href=\"https://docs.fivem.net/docs/scripting-reference/events/list/rconCommand/\"/></summary>",
"/// <param name=\"command\">A string containing the command name that was executed.</param>",
"/// <param name=\"args\">A list containing all arguments passed to the command.</param>",
"[EventHandler(\"rconCommand\")]",
"private void OnRconCommand(string command, List<object> args)",
"{",
"\t$0",
"}"
],
"description": "DEPRECATED Please use RegisterCommand instead and use the restricted flag"
},
// Client Events
"OnClientResourceStart": {
"scope": "csharp",
"prefix": "OnClientResourceStart",
"body": [
"/// <summary>Called after a resource starts. <see href=\"https://docs.fivem.net/docs/scripting-reference/events/client-events/#onclientresourcestart\"/></summary>",
"/// <param name=\"resource\">The name of the resource that started.</param>",
"[EventHandler(\"onClientResourceStart\")]",
"private void OnClientResourceStart(string resource)",
"{",
"\t$0",
"}"
],
"description": "A client event that is queued after a resource has started"
},
"OnClientResourceStop": {
"scope": "csharp",
"prefix": "OnClientResourceStop",
"body": [
"/// <summary>Called after a resource stops. <see href=\"https://docs.fivem.net/docs/scripting-reference/events/client-events/#onclientresourcestop\"/></summary>",
"/// <param name=\"resource\">The name of the resource that stopped.</param>",
"[EventHandler(\"onClientResourceStop\")]",
"private void OnClientResourceStop(string resource)",
"{",
"\t$0",
"}"
],
"description": "A client event that is triggered after a resource has stopped"
},
"CEventName": {
"scope": "csharp",
"prefix": ["CEventName", "EventName"],
"body": [
"/// <summary>An event that is triggered when the game triggers an internal network event. CEventName can be any event name that GTA 5 throws, e.g.: \"CEventShockingCarCrash\". see: <see href=\"https://docs.fivem.net/docs/game-references/game-events/\"/> for a list of known events. <see href=\"https://docs.fivem.net/docs/scripting-reference/events/client-events/#ceventname\"/></summary>",
"/// <param name=\"entities\">All entities receiving/emitting the event, can be empty.</param>",
"/// <param name=\"eventEntity\">Entity the event is related to.</param>",
"/// <param name=\"data\">Extra event data.</param>",
"[EventHandler(\"CEventName\")]",
"private void CEventName(List<object> entities, int eventEntity, dynamic data)",
"{",
"\t$0",
"}"
],
"description": "A client event that is triggered when the game triggers an internal network event"
},
"GameEventTriggered": {
"scope": "csharp",
"prefix": ["GameEventTriggered", "OnGameEventTriggered"],
"body": [
"/// <summary>This event is fired after low-level game events take place, such as <c>CEventNetworkEntityDamage</c>. <see href=\"https://docs.fivem.net/docs/scripting-reference/events/client-events/#gameeventtriggered\"/></summary>",
"/// <param name=\"name\">The game event name that was triggered.</param>",
"/// <param name=\"args\">An array of integers that were passed along with the event.</param>",
"[EventHandler(\"gameEventTriggered\")]",
"private void OnGameEventTriggered(string name, List<object> args)",
"{",
"\t$0",
"}"
],
"description": "A client event that is triggered when the game triggers an internal network event"
},
"MumbleConnected": {
"scope": "csharp",
"prefix": ["MumbleConnected", "OnMumbleConnected"],
"body": [
"/// <summary>An event that is triggered when the game completes (re)connecting to a Mumble server. <see href=\"https://docs.fivem.net/docs/scripting-reference/events/client-events/#mumbleconnected\"/></summary>",
"/// <param name=\"address\">The address of the Mumble server connected to.</param>",
"/// <param name=\"reconnecting\">Is this a reconnection to a Mumble server.</param>",
"[EventHandler(\"mumbleConnected\")]",
"private void OnMumbleConnected(string address, bool reconnecting)",
"{",
"\t$0",
"}"
],
"description": "A client event that is triggered when the game completes (re)connecting to a Mumble server"
},
"MumbleDisconnected": {
"scope": "csharp",
"prefix": ["MumbleDisconnected", "OnMumbleDisconnected"],
"body": [
"/// <summary>An event triggered when the game disconnects from a Mumble server without being reconnected. <see href=\"https://docs.fivem.net/docs/scripting-reference/events/client-events/#mumbledisconnected\"/></summary>",
"/// <param name=\"address\">The address of the Mumble server disconnected from.</param>",
"[EventHandler(\"mumbleDisconnected\")]",
"private void OnMumbleConnected(string address)",
"{",
"\t$0",
"}"
],
"description": "A client event that is triggered when the game disconnects from a Mumble server without being reconnected."
},
"PopulationPedCreating": {
"scope": "csharp",
"prefix": ["PopulationPedCreating", "OnPopulationPedCreating"],
"body": [
"/// <summary>This event is fired before creating a population ped and allows manipulating population from script. You can also cancel this event with CancelEvent(). <see href=\"https://docs.fivem.net/docs/scripting-reference/events/client-events/#populationpedcreating\"/></summary>",
"/// <param name=\"x\">The X position the ped is trying to spawn at.</param>",
"/// <param name=\"y\">The Y position the ped is trying to spawn at.</param>",
"/// <param name=\"z\">The Z position the ped is trying to spawn at.</param>",
"/// <param name=\"model\">The intended model.</param>",
"/// <param name=\"overrideCalls\">Functions to override position or model.",
"/// <list>",
"/// <item><term>setModel</term><description>Sets the model of the created ped.</description></item>",
"/// <item><term>setPosition</term><description>Sets the position of the created ped.</description></item>",
"/// </list>",
"/// </param>",
"[EventHandler(\"populationPedCreating\")]",
"private void OnPopulationPedCreating(float x, float y, float z, uint model, ExpandoObject overrideCalls)",
"{",
"\t$0",
"}"
],
"description": "A client event that is triggered when a ped is being created by the game population system. The event can be canceled to stop creating the ped"
},
"EntityDamaged": {
"scope": "csharp",
"prefix": ["EntityDamaged", "OnEntityDamaged"],
"body": [
"/// <summary>An event that is triggered when an entity is *locally* damaged. <see href=\"https://docs.fivem.net/docs/scripting-reference/events/client-events/#entitydamaged\"/></summary>",
"/// <param name=\"victim\">The entity which is damaged, or 0 if none.</param>",
"/// <param name=\"culprit\">The damaging entity, or 0 if none.</param>",
"/// <param name=\"weapon\">The hash of the weapon inflicting damage.</param>",
"/// <param name=\"baseDamage\">The base amount of damage inflicted, discounting any modifiers.</param>",
"[EventHandler(\"entityDamaged\")]",
"private void OnEntityDamaged(int victim, int culprit, int weapon, int baseDamage)",
"{",
"\t$0",
"}"
],
"description": "A client event that is triggered when an entity is *locally* damaged"
},
// Server Events
"OnResourceListRefresh": {
"scope": "csharp",
"prefix": "OnResourceListRefresh",
"body": [
"/// <summary>A server-side event triggered when the <c>refresh</c> command completes. <see href=\"https://docs.fivem.net/docs/scripting-reference/events/server-events/#onresourcelistrefresh\"/></summary>",
"[EventHandler(\"onResourceListRefresh\")]",
"private void OnResourceListRefresh()",
"{",
"\t$0",
"}"
],
"description": "A server-side event triggered when the refresh command completes"
},
"OnServerResourceStart": {
"scope": "csharp",
"prefix": "OnServerResourceStart",
"body": [
"/// <summary>An event that is queued after a resource has started. <see href=\"https://docs.fivem.net/docs/scripting-reference/events/server-events/#onserverresourcestart\"></summary>",
"/// <param name=\"resource\">The name of the resource that has started.</param>",
"[EventHandler(\"onServerResourceStart\")]",
"private void OnServerResourceStart(string resource)",
"{",
"\t$0",
"}"
],
"description": "A server-side event that is queued after a resource has started"
},
"OnServerResourceStop": {
"scope": "csharp",
"prefix": "OnServerResourceStop",
"body": [
"/// <summary>An event that is triggered after a resource has stopped. <see href=\"https://docs.fivem.net/docs/scripting-reference/events/server-events/#onserverresourcestop\"/></summary>",
"/// <param name=\"resource\">The name of the resource that has stopped.</param>",
"[EventHandler(\"onServerResourceStop\")]",
"private void OnServerResourceStop(string resource)",
"{",
"\t$0",
"}"
],
"description": "A server-side event that is triggered after a resource has stopped"
},
"PlayerConnecting": {
"scope": "csharp",
"prefix": ["PlayerConnecting", "OnPlayerConnecting"],
"body": [
"/// <summary>Called when a player is connecting to the server. <see href=\"https://docs.fivem.net/docs/scripting-reference/events/server-events/#playerconnecting\"/></summary>",
"/// <param name=\"source\">The source object is a temporary player ID, that can be used with a limited set of functions only.</param>",
"/// <param name=\"playerName\">The display name of the player connecting.</param>",
"/// <param name=\"setKickReason\">A function used to set a reason message for when the event is canceled.",
"/// <list>",
"/// <item><term>reason</term></item>",
"/// </list>",
"/// </param>",
"/// <param name=\"deferrals\">An object to control deferrals.",
"/// <list>",
"/// <item><term>defer</term><description>will initialize deferrals for the current resource. It is required to wait for at least a tick after calling defer before calling <c>update</c>, <c>presentCard</c> or <c>done</c>.</description></item>",
"/// <item><term>done</term><description>finalizes a deferral. It is required to wait for at least a tick before calling <c>done</c> after calling a prior deferral method.</description></item>",
"/// <item><term>handover</term><description>adds handover data for the client to be able to use at a later point.</description></item>",
"/// <item><term>presentCard</term><description>will send an <u>Adaptive Card</u> to the client.</description></item>",
"/// <item><term>update</term><description>will send a progress message to the connecting client.</description></item>",
"/// </list>",
"/// </param>",
"[EventHandler(\"playerConnecting\")]",
"private void OnPlayerConnecting([FromSource] Player source, string playerName, CallbackDelegate setKickReason, ExpandoObject deferrals)",
"{",
"\t$0",
"}"
],
"description": "Called when a player is connecting to the server"
},
"PlayerDropped": {
"scope": "csharp",
"prefix": ["PlayerDropped", "OnPlayerDropped"],
"body": [
"/// <summary>Called when a player drops from the server. <see href=\"https://docs.fivem.net/docs/scripting-reference/events/list/playerDropped/\"/></summary>",
"/// <param name=\"source\">The player that has disconnected.</param>",
"/// <param name=\"reason\">The reason why the player has disconnected.</param>",
"[EventHandler(\"playerDropped\")]",
"private void OnPlayerDropped([FromSource] Player source, string reason)",
"{",
"\t$0",
"}"
],
"description": "Called when a player drops from the server"
},
"PlayerJoining": {
"scope": "csharp",
"prefix": ["PlayerJoining", "OnPlayerJoining"],
"body": [
"/// <summary>A server-side event that is triggered when a player has a finally-assigned NetID. <see href=\"https://docs.fivem.net/docs/scripting-reference/events/server-events/#playerjoining\"/></summary>",
"/// <param name=\"source\">The player's NetID</param>",
"/// <param name=\"oldID\">The original TempID for the connecting player, as specified during playerConnecting.</param>",
"[EventHandler(\"playerJoining\")]",
"private void OnPlayerJoining([FromSource] Player source, string oldID)",
"{",
"\t$0",
"}"
],
"description": "A server-side event that is triggered when a player has a finally-assigned NetID"
},
// OneSync Events
"OneSync:playerLeftScope": {
"scope": "csharp",
"prefix": ["PlayerLeftScope", "OnPlayerLeftScope"],
"body": [
"/// <summary>A server-side event that is triggered when a player leaves another player's scope. <see href=\"https://docs.fivem.net/docs/scripting-reference/events/server-events/#playerleftscope\"/></summary>",
"/// <param name=\"data\">",
"/// Data containing the players leaving each other's scope.",
"/// <list>",
"/// <item><term>from</term><description>The player for which the scope is being left.</description></item>",
"/// <item><term>player</term><description>The player that is leaving the scope.</description></item>",
"/// </list>",
"/// </param>",
"[EventHandler(\"playerLeftScope\")]",
"private void OnPlayerLeftScope(ExpandoObject data)",
"{",
"\t$0",
"}"
],
"description": "A server-side event that is triggered when a player leaves another player's scope"
},
"OneSync:playerEnteredScope": {
"scope": "csharp",
"prefix": ["PlayerEnteredScope", "OnPlayerEnteredScope"],
"body": [
"/// <summary>A server-side event that is triggered when a player enters another player's scope. <see href=\"https://docs.fivem.net/docs/scripting-reference/events/server-events/#playerenteredscope\"/></summary>",
"/// <param name=\"data\">Data containing the players entering each other's scope.",
"/// <list>",
"/// <item><term>for</term><description>The player for which the scope is being entered.</description></item>",
"/// <item><term>player</term><description>The player that is entering the scope.</description></item>",
"/// </list>",
"/// </param>",
"[EventHandler(\"playerEnteredScope\")]",
"private void OnPlayerEnteredScope(ExpandoObject data)",
"{",
"\t$0",
"}"
],
"description": "A server-side event that is triggered when a player enters another player's scope"
},
"OneSync:entityRemoved": {
"scope": "csharp",
"prefix": ["EntityRemoved", "OnEntityRemoved"],
"body": [
"/// <summary>Triggered when an entity is removed on the server. <see href=\"https://docs.fivem.net/docs/scripting-reference/events/server-events/#entityremoved\"/></summary>",
"/// <param name=\"entity\">The handle of the entity that got removed.</param>",
"[EventHandler(\"entityRemoved\")]",
"private void OnEntityRemoved(int entity)",
"{",
"\t$0",
"}"
],
"description": "A server-side event that is triggered when an entity is removed on the server"
},
"OneSync:entityCreating": {
"scope": "csharp",
"prefix": ["EntityCreating", "OnEntityCreating"],
"body": [
"/// <summary>A server-side event that is triggered when an entity is being created. This event can be canceled to instantly delete the entity. <see href=\"https://docs.fivem.net/docs/scripting-reference/events/server-events/#entitycreating\"/></summary>",
"/// <param name=\"handle\">The handle of the entity that got removed.</param>",
"[EventHandler(\"entityCreating\")]",
"private void OnEntityCreating(int handle)",
"{",
"\t$0",
"}"
],
"description": "A server-side event that is triggered when an entity is being created. This event can be canceled to instantly delete the entity"
},
"OneSync:entityCreated": {
"scope": "csharp",
"prefix": ["EntityCreated", "OnEntityCreated"],
"body": [
"/// <summary>A server-side event that is triggered when an entity has been created. <see href=\"https://docs.fivem.net/docs/scripting-reference/events/server-events/#entitycreated\"/></summary>",
"/// <param name=\"handle\">The handle of the entity that got removed.</param>",
"[EventHandler(\"entityCreated\")]",
"private void OnEntityCreated(int handle)",
"{",
"\t$0",
"}"
],
"description": "A server-side event that is triggered when an entity has been created"
},
"OneSync:weaponDamageEvent": {
"scope": "csharp",
"prefix": "WeaponDamageEvent",
"body": [
"/// <summary>A server-side event that is triggered when a client wants to apply damage to a remotely-owned entity. This event can be canceled. <see href=\"https://docs.fivem.net/docs/scripting-reference/events/server-events/#weapondamageevent\"/></summary>",
"/// <param name=\"sender\">The server-side player ID of the player that triggered the event.</param>",
"/// <param name=\"data\">",
"/// <list>",
"/// <item><term>damageType</term><description>A value (between 0 and 3) containing an internal damage type. Specific values are currently unknown.</description></item>",
"/// <item><term>weaponType</term><description>The weapon hash for the inflicted damage.</description></item>",
"/// <item><term>overrideDefaultDamage</term><description>If set, 'weaponDamage' is valid. If unset, the game infers the damage from weapon metadata.</description></item>",
"/// <item><term>hitEntityWeapon</term><description>Whether the damage should be inflicted as if it hit the weapon the entity is carrying. This likely applies to grenades being hit, which should explode, but also normal weapons, which should not harm the player much.</description></item>",
"/// <item><term>hitWeaponAmmoAttachment</term><description>Whether the damage should be inflicted as if it hit an ammo attachment component on the weapon. This applies to players/peds carrying weapons where another player shooting the ammo component makes the weapon explode.</description></item>",
"/// <item><term>silenced</term><description>Set when the damage is applied using a silenced weapon.</description></item>",
"/// <item><term>damageFlags</term></item>",
"/// <item><term>hasActionResult</term></item>",
"/// <item><term>actionResultName</term></item>",
"/// <item><term>actionResultId</term></item>",
"/// <item><term>f104</term></item>",
"/// <item><term>weaponDamage</term><description>The amount of damage inflicted, if <c>overrideDefaultDamage</c> is set. If not, this value is set to <c>0</c>.</description></item>",
"/// <item><term>isNetTargetPos</term></item>",
"/// <item><term>localPosX</term></item>",
"/// <item><term>localPosY</term></item>",
"/// <item><term>localPosZ</term></item>",
"/// <item><term>f112</term></item>",
"/// <item><term>damageTime</term><description>The timestamp the damage was originally inflicted at. This should match the global network timer.</description></item>",
"/// <item><term>willKill</term><description>Whether the originating client thinks this should be instantly-lethal damage, such as a critical headshot.</description></item>",
"/// <item><term>f120</term></item>",
"/// <item><term>hasVehicleData</term></item>",
"/// <item><term>f112_1</term></item>",
"/// <item><term>parentGlobalId</term></item>",
"/// <item><term>hitGlobalId</term><description>The network ID of the victim entity.</description></item>",
"/// <item><term>tyreIndex</term></item>",
"/// <item><term>suspensionIndex</term></item>",
"/// <item><term>hitComponent</term></item>",
"/// <item><term>f133</term></item>",
"/// <item><term>hasImpactDir</term></item>",
"/// <item><term>impactDirX</term></item>",
"/// <item><term>impactDirY</term></item>",
"/// <item><term>impactDirZ</term></item>",
"/// <item><term>hitGlobalIds</term><description>An array containing network IDs of victim entities. If there is more than one, the first one will be set in <c>hitGlobalId</c>.</description></item>",
"/// </list>",
"/// </param>",
"[EventHandler(\"weaponDamageEvent\")]",
"private void WeaponDamageEvent(int sender, ExpandoObject data)",
"{",
"\t$0",
"}"
],
"description": "A server-side event that is triggered when damage occurs between two entity using a weapon"
},
"OneSync:respawnPlayerPedEvent": {
"scope": "csharp",
"prefix": "RespawnPlayerPedEvent",
"body": [
"/// <summary>This native is a server side native which requires OneSync enabled to run it. It gets triggered when a player respawns. <see href=\"https://docs.fivem.net/docs/scripting-reference/events/list/respawnPlayerPedEvent/\"/></summary>",
"/// <param name=\"player\">The player that has respawned.</param>",
"/// <param name=\"content\">A table which contains information regarding the player's respawn.",
"/// <list>",
"/// <item><term>posX</term></item>",
"/// <item><term>posY</term></item>",
"/// <item><term>posZ</term></item>",
"/// <item><term>f64</term></item>",
"/// <item><term>f70</term></item>",
"/// <item><term>f72</term></item>",
"/// <item><term>f92</term></item>",
"/// <item><term>f96</term></item>",
"/// <item><term>f97</term></item>",
"/// <item><term>f99</term></item>",
"/// <item><term>f100</term></item>",
"/// <item><term>f80</term></item>",
"/// <item><term>f84</term></item>",
"/// <item><term>f88</term></item>",
"/// </list>",
"/// </param>",
"[EventHandler(\"respawnPlayerPedEvent\")]",
"private void RespawnPlayerPedEvent(int player, ExpandoObject content)",
"{",
"\t$0",
"}"
],
"description": "A server-side event that is triggered when a player respawns"
},
"OneSync:giveWeaponEvent": {
"scope": "csharp",
"prefix": "GiveWeaponEvent",
"body": [
"/// <param name=\"sender\"></param>",
"/// <param name=\"data\">",
"/// <list>",
"/// <item><term>pedId</term></item>",
"/// <item><term>weaponType</term></item>",
"/// <item><term>unk1</term></item>",
"/// <item><term>ammo</term></item>",
"/// <item><term>givenAsPickup</term></item>",
"/// </list>",
"/// </param>",
"[EventHandler(\"giveWeaponEvent\")]",
"private void GiveWeaponEvent(int sender, ExpandoObject data)",
"{",
"\t$0",
"}"
],
},
"OneSync:removeWeaponEvent": {
"scope": "csharp",
"prefix": "RemoveWeaponEvent",
"body": [
"/// <param name=\"sender\"></param>",
"/// <param name=\"data\">",
"/// <list>",
"/// <item><term>pedId</term></item>",
"/// <item><term>weaponType</term></item>",
"/// </list>",
"/// </param>",
"[EventHandler(\"removeWeaponEvent\")]",
"private void RemoveWeaponEvent(int sender, ExpandoObject data)",
"{",
"\t$0",
"}"
],
},
"OneSync:removeAllWeaponsEvent": {
"scope": "csharp",
"prefix": "RemoveAllWeaponsEvent",
"body": [
"/// <summary>A server-side event that is triggered when a player removes all weapons from a ped owned by another player. <see href=\"https://docs.fivem.net/docs/scripting-reference/events/server-events/#removeallweaponsevent\"/></summary>",
"/// <param name=\"sender\">The ID of the player that triggered the event.</param>",
"/// <param name=\"data\">The event data.",
"/// <list>",
"/// <item><term>pedId</term></item>",
"/// </list>",
"/// </param>",
"[EventHandler(\"removeAllWeaponsEvent\")]",
"private void RemoveAllWeaponsEvent(int sender, ExpandoObject data)",
"{",
"\t$0",
"}"
],
"description": "Triggered when a player removes all weapons from a ped owned by another player"
},
"OneSync:vehicleComponentControlEvent": {
"scope": "csharp",
"prefix": "VehicleComponentControlEvent",
"body": [
"/// <summary>This native is a server side native which requires OneSync enabled to run it. It gets triggered when a ped takes control of a vehicle's component. <see href=\"https://docs.fivem.net/docs/scripting-reference/events/list/vehicleComponentControlEvent/\"/></summary>",
"/// <param name=\"sender\"></param>",
"/// <param name=\"data\">",
"/// <list>",
"/// <item><term>vehicleGlobalId</term><description>Vehicle's ID</description></item>",
"/// <item><term>pedGlobalId</term><description>Ped's ID</description></item>",
"/// <item><term>componentIndex</term><description>Component's ID.</description></item>",
"/// <item><term>request</term><description>Whether the request was accepted or not (not sure...)</description></item>",
"/// <item><term>componentIsSeat</term><description>Is the vehicle's component a seat.</description></item>",
"/// <item><term>pedInSeat</term><description>Ped's seat ID.</description></item>",
"/// </list>",
"/// </param>",
"[EventHandler(\"vehicleComponentControlEvent\")]",
"private void VehicleComponentControlEvent(int sender, ExpandoObject data)",
"{",
"\t$0",
"}"
],
"description": "A server-side event that is triggered when a ped takes control of a vehicle's component"
},
"OneSync:fireEvent": {
"scope": "csharp",
"prefix": "FireEvent",
"body": [
"/// <param name=\"sender\"></param>",
"/// <param name=\"fires\">",
"/// <list>",
"/// <item><term>v1</term></item>",
"/// <item><term>isEntity</term></item>",
"/// <item><term>v2</term></item>",
"/// <item><term>entityGlobalId</term></item>",
"/// <item><term>v3</term></item>",
"/// <item><term>v4</term></item>",
"/// <item><term>v5X</term></item>",
"/// <item><term>v5Y</term></item>",
"/// <item><term>v5Z</term></item>",
"/// <item><term>posX</term></item>",
"/// <item><term>posY</term></item>",
"/// <item><term>posZ</term></item>",
"/// <item><term>v7</term></item>",
"/// <item><term>v8</term></item>",
"/// <item><term>maxChildren</term></item>",
"/// <item><term>v10</term></item>",
"/// <item><term>v11</term></item>",
"/// <item><term>v12</term></item>",
"/// <item><term>weaponHash</term></item>",
"/// <item><term>v13</term></item>",
"/// <item><term>fireId</term></item>",
"/// </list>",
"/// </param>",
"[EventHandler(\"fireEvent\")]",
"private void FireEvent(int sender, List<object> fires)",
"{",
"\t$0",
"}"
],
},
"OneSync:explosionEvent": {
"scope": "csharp",
"prefix": "ExplosionEvent",
"body": [
"/// <param name=\"sender\"></param>",
"/// <param name=\"fires\">",
"/// <list>",
"/// <item><term>f186</term></item>",
"/// <item><term>f208</term></item>",
"/// <item><term>ownerNetId</term></item>",
"/// <item><term>f214</term></item>",
"/// <item><term>explosionType</term></item>",
"/// <item><term>damageScale</term></item>",
"/// <item><term>posX</term></item>",
"/// <item><term>posY</term></item>",
"/// <item><term>posZ</term></item>",
"/// <item><term>f242</term></item>",
"/// <item><term>f104</term></item>",
"/// <item><term>cameraShake</term></item>",
"/// <item><term>isAudible</term></item>",
"/// <item><term>f189</term></item>",
"/// <item><term>isInvisible</term></item>",
"/// <item><term>f126</term></item>",
"/// <item><term>f241</term></item>",
"/// <item><term>f243</term></item>",
"/// <item><term>f210</term></item>",
"/// <item><term>unkX</term></item>",
"/// <item><term>unkY</term></item>",
"/// <item><term>unkZ</term></item>",
"/// <item><term>f190</term></item>",
"/// <item><term>f191</term></item>",
"/// <item><term>f164</term></item>",
"/// <item><term>posX224</term></item>",
"/// <item><term>posY224</term></item>",
"/// <item><term>posZ224</term></item>",
"/// <item><term>f240</term></item>",
"/// <item><term>f218</term></item>",
"/// <item><term>f216</term></item>",
"/// </list>",
"/// </param>",
"[EventHandler(\"explosionEvent\")]",
"private void ExplosionEvent(int sender, ExpandoObject data)",
"{",
"\t$0",
"}"
],
},
"OneSync:startProjectileEvent": {
"scope": "csharp",
"prefix": "StartProjectileEvent",
"body": [
"/// <summary>Triggered when a projectile is created. <see href=\"https://docs.fivem.net/docs/scripting-reference/events/server-events/#startprojectileevent\"/></summary>",
"/// <param name=\"sender\">The ID of the player that triggered the event.</param>",
"/// <param name=\"data\">The event data.",
"/// <list>",
"/// <item><term>ownerId</term></item>",
"/// <item><term>projectileHash</term></item>",
"/// <item><term>weaponHash</term></item>",
"/// <item><term>initialPositionX</term></item>",
"/// <item><term>initialPositionY</term></item>",
"/// <item><term>initialPositionZ</term></item>",
"/// <item><term>targetEntity</term></item>",
"/// <item><term>firePositionX</term></item>",
"/// <item><term>firePositionY</term></item>",
"/// <item><term>firePositionZ</term></item>",
"/// <item><term>effectGroup</term></item>",
"/// <item><term>unk3</term></item>",
"/// <item><term>commandFireSingleBullet</term></item>",
"/// <item><term>unk4</term></item>",
"/// <item><term>unk5</term></item>",
"/// <item><term>unk6</term></item>",
"/// <item><term>unk7</term></item>",
"/// <item><term>unkX8</term></item>",
"/// <item><term>unkY8</term></item>",
"/// <item><term>unkZ8</term></item>",
"/// <item><term>unk9</term></item>",
"/// <item><term>unk10</term></item>",
"/// <item><term>unk11</term></item>",
"/// <item><term>throwTaskSequence</term></item>",
"/// <item><term>unk12</term></item>",
"/// <item><term>unk13</term></item>",
"/// <item><term>unk14</term></item>",
"/// <item><term>unk15</term></item>",
"/// <item><term>unk16</term></item>",
"/// </list>",
"/// </param>",
"[EventHandler(\"startProjectileEvent\")]",
"private void StartProjectileEvent(int sender, ExpandoObject data)",
"{",
"\t$0",
"}"
],
"description": "Triggered when a projectile is created"
},
"OneSync:clearPedTasksEvent": {
"scope": "csharp",
"prefix": "ClearPedTasksEvent",
"body": [
"/// <param name=\"sender\"></param>",
"/// <param name=\"data\">",
"/// <list>",
"/// <item><term>pedId</term></item>",
"/// <item><term>immediately</term></item>",
"/// </list>",
"/// </param>",
"[EventHandler(\"clearPedTasksEvent\")]",
"private void ClearPedTasksEvent(int sender, ExpandoObject data)",
"{",
"\t$0",
"}"
],
},
"OneSync:ptFxEvent": {
"scope": "csharp",
"prefix": "PtFxEvent",
"body": [
"/// <summary>Triggered when a particle fx (ptFx) is created. <see href=\"https://docs.fivem.net/docs/scripting-reference/events/server-events/#ptfxevent\"/></summary>",
"/// <param name=\"sender\">The ID of the player that triggered the event.</param>",
"/// <param name=\"data\">The event data.",
"/// <list>",
"/// <item><term>effectHash</term></item>",
"/// <item><term>assetHash</term></item>",
"/// <item><term>posX</term></item>",
"/// <item><term>posY</term></item>",
"/// <item><term>posZ</term></item>",
"/// <item><term>offsetX</term></item>",
"/// <item><term>offsetY</term></item>",
"/// <item><term>offsetZ</term></item>",
"/// <item><term>rotX</term></item>",
"/// <item><term>rotY</term></item>",
"/// <item><term>rotZ</term></item>",
"/// <item><term>scale</term></item>",
"/// <item><term>axisBitset</term></item>",
"/// <item><term>isOnEntity</term></item>",
"/// <item><term>entityNetId</term></item>",
"/// <item><term>f109</term></item>",
"/// <item><term>f92</term></item>",
"/// <item><term>f110</term></item>",
"/// <item><term>f105</term></item>",
"/// <item><term>f106</term></item>",
"/// <item><term>f107</term></item>",
"/// <item><term>f111</term></item>",
"/// <item><term>f100</term></item>",
"/// </list>",
"/// </param>",
"[EventHandler(\"ptFxEvent\")]",
"private void PtFxEvent(int sender, ExpandoObject data)",
"{",
"\t$0",
"}"
],
"description": "Triggered when a particle fx (ptFx) is created"
},
// Spawn Manager Events
"spawnmanager:playerSpawned": {
"scope": "csharp",
"prefix": "PlayerSpawned",
"body": [
"[EventHandler(\"playerSpawned\")]",
"private void OnPlayerSpawned(ExpandoObject spawn)",
"{",
"\t$0",
"}"
],
},
// Map Manager Events
"mapmanager:onClientMapStart": {
"scope": "csharp",
"prefix": "OnClientMapStart",
"body": [
"[EventHandler(\"onClientMapStart\")]",
"private void OnClientMapStart(string resourceName)",
"{",
"\t$0",
"}"
],
},
"mapmanager:onClientGameTypeStart": {
"scope": "csharp",
"prefix": "OnClientGameTypeStart",
"body": [
"[EventHandler(\"onClientGameTypeStart\")]",
"private void OnClientGameTypeStart(string resourceName)",
"{",
"\t$0",
"}"
],
},
"mapmanager:onClientMapStop": {
"scope": "csharp",
"prefix": "OnClientMapStop",
"body": [
"[EventHandler(\"onClientMapStop\")]",
"private void OnClientMapStop(string resourceName)",
"{",
"\t$0",
"}"
],
},
"mapmanager:onClientGameTypeStop": {
"scope": "csharp",
"prefix": "OnClientGameTypeStop",
"body": [
"[EventHandler(\"onClientGameTypeStop\")]",
"private void OnClientGameTypeStop(string resourceName)",
"{",
"\t$0",
"}"
],
},
"mapmanager:getMapDirectives": {
"scope": "csharp",
"prefix": "GetMapDirectives",
"body": [
"[EventHandler(\"getMapDirectives\")]",
"private void GetMapDirectives(CallbackDelegate add)",
"{",
"\t$0",
"}"
],
},
// Base Events
"(CL) baseevents:onPlayerDied": {
"scope": "csharp",
"prefix": "OnPlayerDied",
"body": [
"[EventHandler(\"baseevents:onPlayerDied\")]",
"private void OnPlayerDied(int killerType, List<object> deathCoords)",
"{",
"\t$0",
"}"
],
},
"(SV) baseevents:onPlayerDied": {
"scope": "csharp",
"prefix": "OnPlayerDied",
"body": [
"[EventHandler(\"baseevents:onPlayerDied\")]",
"private void OnPlayerDied([FromSource] Player source, int killerType, List<object> deathCoords)",
"{",
"\t$0",
"}"
],
},
"(CL) baseevents:onPlayerKilled": {
"scope": "csharp",
"prefix": "OnPlayerKilled",
"body": [
"[EventHandler(\"baseevents:onPlayerKilled\")]",
"private void OnPlayerKilled(int killerID, ExpandoObject deathData)",
"{",
"\t$0",
"}"
],
},
"(SV) baseevents:onPlayerKilled": {
"scope": "csharp",
"prefix": "OnPlayerKilled",
"body": [
"[EventHandler(\"baseevents:onPlayerKilled\")]",
"private void OnPlayerKilled([FromSource] Player source, int killerID, ExpandoObject deathData)",
"{",
"\t$0",
"}"
],
},
"(CL) baseevents:onPlayerWasted": {
"scope": "csharp",
"prefix": "OnPlayerWasted",
"body": [
"[EventHandler(\"baseevents:onPlayerWasted\")]",
"private void OnPlayerWasted(List<object> deathCoords)",
"{",
"\t$0",
"}"
],
},
"(SV) baseevents:onPlayerWasted": {
"scope": "csharp",
"prefix": "OnPlayerWasted",
"body": [
"[EventHandler(\"baseevents:onPlayerWasted\")]",
"private void OnPlayerWasted([FromSource] Player source, List<object> deathCoords)",
"{",
"\t$0",
"}"
],
},
"baseevents:enteringVehicle": {
"scope": "csharp",
"prefix": "EnteringVehicle",
"body": [
"[EventHandler(\"baseevents:enteringVehicle\")]",
"private void OnEnteringVehicle(int vehicle, int seat, string displayName, int source)",
"{",
"\t$0",
"}"
],
},
"baseevents:enteringAborted": {
"scope": "csharp",
"prefix": "EnteringAborted",
"body": [
"[EventHandler(\"baseevents:enteringAborted\")]",
"private void OnEnteringAborted()",
"{",
"\t$0",
"}"
],
},
"baseevents:enteredVehicle": {
"scope": "csharp",
"prefix": "EnteredVehicle",
"body": [
"[EventHandler(\"baseevents:enteredVehicle\")]",
"private void OnEnteredVehicle(int currentVehicle, int currentSeat, string displayName, int source)",
"{",
"\t$0",
"}"
],
},
"baseevents:leftVehicle": {
"scope": "csharp",
"prefix": "LeftVehicle",
"body": [
"[EventHandler(\"baseevents:leftVehicle\")]",
"private void OnLeftVehicle(int currentVehicle, int currentSeat, string displayName, int source)",
"{",
"\t$0",
"}"
],
},
// Hardcap Events
"sessionmanager:playerActivated": {
"scope": "csharp",
"prefix": "PlayerActivated",
"body": [
"[EventHandler(\"hardcap:playerActivated\")]",
"private void OnPlayerActivated()",
"{",
"\t$0",
"}"
],
},
// Session Manager Events
"sessionmanager:sessionInitialized": {
"scope": "csharp",
"prefix": "SessionInitialized",
"body": [
"[EventHandler(\"sessionInitialized\")]",
"private void OnSessionInitialized()",
"{",
"\t$0",
"}"
],
},
// Chat Events
"chat:chatMessage": {
"scope": "csharp",
"prefix": "ChatMessage",
"body": [
"/// <summary>",
"/// This event is available both in the client and in the server.",
"/// In the client this event is deprecated! Use <c>chat:addMessage</c> instead.",
"/// Triggering this event in the client allows you to send a chat message to this client.",
"/// Listening for this event in the server allows you to read/log/reply the message.",
"/// </summary>",
"/// <param name=\"source\">The source of the chat message</param>",
"/// <param name=\"author\">The name of the player that sent the message.</param>",
"/// <param name=\"text\">The message</param>",
"[EventHandler(\"chatMessage\")]",
"private void OnChatMessage(int source, string author, string text)",
"{",
"\t$0",
"}"
],
"description": "Listening for this event in the server allows you to read/log/reply the message"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment