Code After Sex
  • Introduction
  • Store
  • Discord
  • About PAID Scripts
    • πŸ†™PLEASE READ!
    • πŸ“„RedM Script Documentation
      • Metabolism System
      • Animation Menu
      • Pausemenu Remake
        • Installation
        • Editable Files
        • Dependencies
      • New Player & Anti troll
      • Store & Shops
      • Tebex & VIP Shop
      • Multicharacter (Vorp)
      • Inventory
      • Wholesaler
      • Spawn System
      • Pause Menu
      • Dailygift
      • Loading Screen
      • Multicharacter (RSG, MBL)
      • CAS-Adminmenu V2
      • CAS-Multicharacter
      • RSG Multicharacter V2
      • CAS-Notification
      • Progressbar
      • Radial Menu
      • VORP Multicharacter (Tebex Integrated)
      • Vote Script
    • πŸ“„FiveM Script Documentation
      • CAS-Dispatch
  • About FREE Scripts
    • FiveM Script Documentation
  • About CFX Auth System
    • CFX auth system
Powered by GitBook
On this page
  • About Spawn System
  • πŸ“„ VORP Core Integration Instructions
  • ✏️ Steps
  • πŸ› οΈ Example: Full Modified vorp:initCharacter
  • πŸ“Œ Important Notes
  • Installation
  • Configuration
  1. About PAID Scripts
  2. RedM Script Documentation

Spawn System

Here you can find the installation for cas-spawn script.

About Spawn System

Give your players the ultimate flexibility with our Spawn Selector Script for RedM. This script allows players to choose their spawn location from a list of custom or pre-defined spots, offering a seamless way to start their journey in the world. Whether they want to spawn in towns, camps, or remote locations, the script provides a smooth and user-friendly interface that enhances the player experience. With full customization options, you can easily set up different spawn points based on roles, factions, or player preferences. Optimized for performance, the Spawn Selector Script ensures fast loading times and an immersive experience for all players on your server.

πŸ“„ VORP Core Integration Instructions

To integrate with vorp_core, you need to modify the vorp_core/client/spawnplayer.lua file.

Specifically, you must extend the existing vorp:initCharacter event to include the custom character initialization.

Here’s how to do it properly:

✏️ Steps

  1. Locate the vorp:initCharacter event handler inside vorp_core/client/spawnplayer.lua.

  2. At the very end of the vorp:initCharacter function, add the following trigger:

TriggerEvent("vorp:initCharCustom", coords, heading, isdead)

This ensures your custom initialization runs after the player has fully loaded.


πŸ› οΈ Example: Full Modified vorp:initCharacter

RegisterNetEvent('vorp:initCharacter')
AddEventHandler('vorp:initCharacter', function(coords, heading, isdead)
    CoreAction.Player.TeleportToCoords(coords, heading)

    if isdead then
        if not Config.CombatLogDeath then
            if Config.Loadinscreen then
                Citizen.InvokeNative(0x1E5B70E53DB661E5, 0, 0, 0, T.forcedrespawn, T.forced, T.Almost)
            end
            SetEntityCanBeDamaged(PlayerPedId(), true)
            CoreAction.Player.RespawnPlayer()
            Wait(Config.LoadinScreenTimer)
            Wait(1000)
            ShutdownLoadingScreen()
            Wait(5000)
        else
            if Config.Loadinscreen then
                Citizen.InvokeNative(0x1E5B70E53DB661E5, 0, 0, 0, T.Holddead, T.Loaddead, T.Almost)
            end
            Wait(10000)
            TriggerEvent("vorp_inventory:CloseInv")
            Wait(4000)
            SetEntityCanBeDamaged(PlayerPedId(), true)
            SetEntityHealth(PlayerPedId(), 0, 0)
            Citizen.InvokeNative(0xC6258F41D86676E0, PlayerPedId(), 0, -1)
            ShutdownLoadingScreen()
        end
    else
        local PlayerId = PlayerId()

        if Config.Loadinscreen then
            if Config.LoadingScreenPlayerInfo then
                Citizen.InvokeNative(0x1E5B70E53DB661E5, 0, 0, 0, LocalPlayer.state.Character.FirstName .. " " .. LocalPlayer.state.Character.LastName, "Job: " .. LocalPlayer.state.Character.JobLabel)
            else
                Citizen.InvokeNative(0x1E5B70E53DB661E5, 0, 0, 0, T.Hold, T.Load, T.Almost)
            end
            Wait(Config.LoadinScreenTimer)
            Wait(1000)
            ShutdownLoadingScreen()
        end

        if not Config.HealthRecharge.enable then
            Citizen.InvokeNative(0x8899C244EBCF70DE, PlayerId, 0.0)
        else
            Citizen.InvokeNative(0x8899C244EBCF70DE, PlayerId, Config.HealthRecharge.multiplier)
            multiplierHealth = Citizen.InvokeNative(0x22CD23BB0C45E0CD, PlayerId)
        end

        if not Config.StaminaRecharge.enable then
            Citizen.InvokeNative(0xFECA17CF3343694B, PlayerId, 0.0)
        else
            Citizen.InvokeNative(0xFECA17CF3343694B, PlayerId, Config.StaminaRecharge.multiplier)
            multiplierStamina = Citizen.InvokeNative(0x617D3494AD58200F, PlayerId)
        end

        SetEntityCanBeDamaged(PlayerPedId(), true)

        if Config.SavePlayersStatus then
            TriggerServerEvent("vorp:GetValues")
            Wait(200)
            if HealthData then
                local player = PlayerPedId()
                Citizen.InvokeNative(0xC6258F41D86676E0, player, 0, HealthData.hInner or 600)
                SetEntityHealth(player, (HealthData.hOuter and HealthData.hOuter > 0 and HealthData.hOuter or 600) + (HealthData.hInner and HealthData.hInner > 0 and HealthData.hInner or 600), 0)
                Citizen.InvokeNative(0xC6258F41D86676E0, player, 1, HealthData.sInner or 600)
                Citizen.InvokeNative(0x675680D089BFA21F, player, (HealthData.sOuter or (1065353215 * 100)) / 1065353215 * 100)
            end
            HealthData = {}
        else
            CoreAction.Admin.HealPlayer()
        end
    end

    SetTimeout(2000, function()
        DoScreenFadeIn(4000)
        repeat Wait(500) until IsScreenFadedIn()
    end)

    -- 🧩 ADD THIS LINE AT THE END
    TriggerEvent("vorp:initCharCustom", coords, heading, isdead)
end)

πŸ“Œ Important Notes

  • Do not replace the existing vorp:initCharacter logic.

  • Only add TriggerEvent("vorp:initCharCustom", coords, heading, isdead) at the very end of the handler.

  • This ensures compatibility with VORP Core and adds your custom handling without breaking the default flow.

Installation

Just drag and drop cas-spawn folder and ensure it.

Configuration

You can set everything in configuration file easily.

PreviousWholesalerNextPause Menu

Last updated 26 days ago

πŸ“„
Page cover image