🛡️Security Integration

Learn how to use our built-in TCVS security exports and events.

Obtaining The Security Code

You can obtain the necessary security code for an event by utilizing the following code snippet. This example demonstrates how to retrieve the security code for the :server:impoundCheck event, but it can be adapted for any TCVS server event by replacing the event suffix with the one relevant to your needs.

CLIENT-SIDED

local security = GetEventCode(GetCurrentResourceName(), GetEventPrefix(GetCurrentResourceName()) .. ":server:impoundCheck")
local eventPrefix = GetEventPrefix(GetCurrentResourceName())

Using the Security Code

Once you have obtained the security code, include it as the first parameter when triggering the server event. Here’s how you can do it for the :server:impoundCheck event.

CLIENT-SIDED

TriggerServerEvent(eventPrefix .. ":server:impoundCheck", security)

Server To Server Event Execution

When triggering events from server to server, it's important to note that the security exports designed for client-server communication do not apply. Since these security measures are specifically registered through the client, server-to-server event triggering bypasses the need for a security code.

For server-sided event execution, instead of generating a security code, you should directly use the number 1 as the first parameter. This approach simplifies the process while maintaining the structured call pattern for events.

SERVER-SIDED

TriggerEvent(Security.EventPrefix .. ":server:impoundCheck", 1)

Last updated

Was this helpful?