Biyei Scripts

Installation

  1. 1

    Dependencies

    Make sure you have these resources installed on your server:

    1. ESX or QB-Core
    2. Biyei Utils
  2. 2

    Start order

    Warning

    Don't rename the resource or you'll get an error (credits).

    server.cfgserver.cfg
    ensure biyei_utils
    ensure biyei_arenas
  3. 3

    For ox_inventory

    Note

    If you don't have ox_inventory, ignore this step.

    Add this line to server.cfg:

    Text
    setr inventory:weaponmismatch false
  4. 4

    Install SQL

    Note

    Important, install the SQL.

    SQL
    CREATE TABLE IF NOT EXISTS `biyei_arenas` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `player` varchar(150) DEFAULT NULL,
      `username` varchar(150) DEFAULT NULL,
      `deaths` int(11) DEFAULT 0,
      `kills` int(11) DEFAULT 0,
      `score` int(11) DEFAULT 0,
      `wins` int(11) DEFAULT 0,
      `losses` int(11) DEFAULT 0,
      PRIMARY KEY (`id`),
      UNIQUE KEY `Columna 2` (`player`)
    ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
    
    CREATE TABLE IF NOT EXISTS `biyei_arenas_players` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `player` varchar(150) NOT NULL DEFAULT '0',
      `status` int(11) NOT NULL DEFAULT 0,
      PRIMARY KEY (`id`),
      UNIQUE KEY `player` (`player`)
    ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
  5. 5

    For esx_ambulancejob revive function (ESX only)

    Overrides the default revive handler so respawning respects match state.

    Lua
    RegisterNetEvent('esx_ambulancejob:revive')
    AddEventHandler('esx_ambulancejob:revive', function()
      local playerPed = PlayerPedId()
      local coords = GetEntityCoords(playerPed)
    
      TriggerServerEvent('esx_ambulancejob:setDeathStatus', false)
    
      local inMatchGame = LocalPlayer.state.InMatch or LocalPlayer.state.InRankedMatch
    
      if not inMatchGame then
        DoScreenFadeOut(800)
        while not IsScreenFadedOut() do
          Wait(50)
        end
      end
    
      local formattedCoords = {x = ESX.Math.Round(coords.x, 1), y = ESX.Math.Round(coords.y, 1), z = ESX.Math.Round(coords.z, 1)}
    
      RespawnPed(playerPed, formattedCoords, 0.0)
      isDead = false
      ClearTimecycleModifier()
      SetPedMotionBlur(playerPed, false)
      ClearExtraTimecycleModifier()
      EndDeathCam() 
      DoScreenFadeIn(800)
    end)
    Lua
    function RespawnPed(ped, coords, heading)
      local inMatchGame = LocalPlayer.state.InMatch or LocalPlayer.state.InRankedMatch
    
      SetEntityCoordsNoOffset(ped, coords.x, coords.y, coords.z, false, false, false)
      if not inMatchGame then
        NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, heading, true, false)
      end
      SetPlayerInvincible(ped, false)
      ClearPedBloodDamage(ped)
    
      if Config.DeathAnim.enabled then
        FreezeEntityPosition(ped, false)
      end
    
      TriggerEvent('esx_basicneeds:resetStatus')
      TriggerServerEvent('esx:onPlayerSpawn')
      TriggerEvent('esx:onPlayerSpawn')
      TriggerEvent('playerSpawned') -- compatibility with old scripts, will be removed soon
    end
  6. 6

    Add InMatch check to your inventory

    For ox_inventory (or another inventory), disable opening the inventory while in a match.

    ox_inventory/client.luaLua
    -- Open Inventory
    local function canOpenInventory()
       if exports.biyei_arenas:InMatch() or exports.biyei_arenas:InRankedMatch() then
         return shared.info('cannot open inventory', '(in match)')
       end
       return true
    end
    
    --- Use Item
    local function canUseItem(isAmmo)
       local ped = cache.ped
       if exports.biyei_arenas:InMatch() or exports.biyei_arenas:InRankedMatch() then
          return shared.info('cannot open inventory', '(in match)')
       end
    end