[Release] New VRP Perfect Scoreboard

New VRP Perfect Scoreboard

(FiveM RealWorld)

  • Fantastic UI
  • Scrollable list
  • Unlimited number of users allowed
  • Job tab
  • Excellent server load protection
  • Tested by over 250 people

Download GitHub


logo

15 Likes

not working

vRP.getUserList not found and in __resource “@evp/main.lua”,

how fix?

You fix see this file.

__resource.lua
… share text del.

1. Please remove “@evp/main.lua”.

2. Please remove removeEmoji() function (client.lua:68)

3. Function vRP.getUserList()

(Please add to vrp/modules/identity.lua)

MySQL.createCommand("vRP/get_user_identities", "SELECT * FROM vrp_user_identities WHERE user_id in (@user_ids)")

function vRP.getUserIdentities(arr_user_ids, cbr)
  if cbr == nil then
    return
  end
  local task = Task(cbr)
  if arr_user_ids == nil or #arr_user_ids <= 0 then
    task({})
    return
  end
  MySQL.query(
    "vRP/get_user_identities",
    {user_ids = arr_user_ids},
    function(rows, affected)
      if rows == nil then
        task({})
      else
        task({rows})
      end
    end
  )
end

function GetJobType(user_id)
  local jobType = nil
  if vRP.hasPermission(user_id, "cop.whitelisted") then
    jobType = "cop"
  elseif vRP.hasPermission(user_id, "ems.whitelisted") then
    jobType = "ems"
  elseif vRP.hasPermission(user_id, "uber.whitelisted") then
    jobType = "uber"
  elseif vRP.hasPermission(user_id, "repair.whitelisted") then
    jobType = "repair"
  elseif vRP.hasPermission(user_id, "shh.whitelisted") then
    jobType = "shh"
  elseif vRP.hasPermission(user_id, "mafia.whitelisted") then
    jobType = "mafia"
  elseif vRP.hasPermission(user_id, "gm.whitelisted") then
    jobType = "gm"
  elseif vRP.hasPermission(user_id, "tow.whitelisted") then
    jobType = "tow"
  elseif vRP.hasPermission(user_id, "cbs.whitelisted") then
    jobType = "cbs"
  elseif vRP.hasPermission(user_id, "kys.whitelisted") then
    jobType = "kys"
  elseif vRP.hasPermission(user_id, "helper.whitelisted") then
    jobType = "helper"
  elseif vRP.hasPermission(user_id, "inspector.whitelisted") then
    jobType = "inspector"
  elseif vRP.hasPermission(user_id, "admin.whitelisted") then
    jobType = "admin"
  end
  return jobType
end

function GetArrUserGroups(user_id)
  local tmpGroups = vRP.getUserGroups(user_id)
  local arrGroups = {}
  for k2, v2 in pairs(tmpGroups) do
    if v2 == true then
      table.insert(arrGroups, k2)
    end
  end
  return arrGroups
end

local userList = {}
local user_ids = {}
local playerInfo = {}
function makeUserListTask()
  userList = {}
  user_ids = {}
  for _, v in ipairs(GetPlayers()) do
    playerInfo = {
      source = v,
      user_id = vRP.getUserId(v) or "",
      nickname = GetPlayerName(v) or "",
      name = "",
      job = "",
      jobType = ""
    }
    userList[playerInfo.user_id] = playerInfo
    table.insert(user_ids, playerInfo.user_id)
  end
  vRP.getUserIdentities(
    user_ids,
    function(identities)
      if identities == nil then
        SetTimeout(20000, makeUserListTask)
        return
      end
      for _, v in ipairs(identities) do
        if userList[v.user_id] then
          if v.firstname and v.name then
            userList[v.user_id].name = htmlEntities.encode(v.firstname) .. " " .. htmlEntities.encode(v.name)
          end
          userList[v.user_id].job = vRP.getUserGroupByType(userList[v.user_id].user_id, "job") or ""
          userList[v.user_id].jobType = GetJobType(userList[v.user_id].user_id) or ""
          userList[v.user_id].groups = GetArrUserGroups(v.user_id)
          userList[v.user_id].phone = v.phone
          if _ >= #identities then
            SetTimeout(20000, makeUserListTask)
          end
        end
      end
    end
  )
  user_ids = nil
end
makeUserListTask()

function vRP.getUserList(cbr)
  if cbr == nil then
    return
  end
  local task = Task(cbr)
  task({userList})
end

System.AggregateException: One or more errors occurred. (Parameter type List1 (DbType: AnsiString)` not currently supported.

How the hell do I fix that?

Fixed it btw

Fixed.

Download GitHub

1. Remove “@evp/main.lua”.

2. Remove removeEmoji() function (client.lua:68)

3. Add function vRP.getUserList() (See README.md)

Would love an ESX version! but looks amazing! Good job!

4 Likes

how did you fix it?


even doing the correct installation it gives this error when it enters the server

What is your server mysql module? (vrp_mysql, async-mysql, ghimatti…etc)

2 Likes

vrp_mysql

Our server is using ghmattimysql.
vrp_mysql needs syntax modification.

Try changing the vRP.getUserIdentities() function as shown below.

function joinStrings(list, sep)
  if sep == nil then
    sep = ""
  end

  local str = ""
  local count = 0
  local size = #list
  for k, v in pairs(list) do
    count = count + 1
    str = str .. v
    if count < size then
      str = str .. sep
    end
  end

  return str
end

function vRP.getUserIdentities(arr_user_ids, cbr)
  if cbr == nil then
    return
  end
  local task = Task(cbr)
  if arr_user_ids == nil or #arr_user_ids <= 0 then
    task({})
    return
  end
  local szUserId = joinStrings(arr_user_ids, ",")
  MySQL.query(
    "vRP/get_user_identities",
    {user_ids = szUserId},
    function(rows, affected)
      if rows == nil then
        task({})
      else
        task({rows})
      end
    end
  )
end


it worked, but now this error

Here --> vrp/lib/htmlEntities.lua
htmlEntities.lua (57.0 KB)

Add it to the top of identity.lua.

local htmlEntities = module("lib/htmlEntities")

Please delete it.

-- userList[v.user_id].userTitleInfo = GetUserTitleInfo(v.user_id)
userList[v.user_id].groups = GetArrUserGroups(v.user_id)
userList[v.user_id].phone = v.phone

thanks, now it works