[Release]Panel for set player group (vRP0.5 and vRPEX)

Hi,

I created this script to simplify setting up groups on my server.

I’m making it available to anyone who is interested.

vrp_escadmin

Set vRP0.5 and vRPEX players groups with a simple interface

Getting Started

Add vrp_escadmin in your resource folder and add in your server.cfg. In game write in chat /setgroup [id], where id is a player id.

Example: /setgroup 3

On line 13 in server.lua you will find a permission group, change if you want

Prerequisites

vRP0.5 or vRPEX (1.0)
[Screenshot]


[Github]

[Video] in pt-br

6 Likes

Very cool release. I moved this topic to releases for you.

2 Likes

great !!

but there is a bug ,after giving a role to someone you can’t move your mouse again !!

can you please fix that
thank!

Excelente Amigo por mais Br’s Assim!

1 Like

hello its nice script but im getting ERROS in cmd … im using VRP server

thats the errors can you help me with it ?


I will check this.
Ty

This error was generated by some problem in your vrp / cfg / groups.lua.
Send this file to me, which I will check for you.

Aqui nao funciona, pode me ajudar? não me é gerado nenhum erro, mas também não acontece nada

Acredito que esteja testando errado, tente /setar [ID], ele funciona somente colocando id caso coloque apenas /setgroup sem o id não ira mesmo. tera que ser /setgroup 1.

sorrry for late thats it my groups

groups.lua (123.2 KB)

No problem brow.

What version vRP you use?
This error ocorred because script don’t send a correct group name for you framework.
On vRP 0.5 the script use vRP.removeUserGroup({player, x})
On vRP 1.0 use vRP.removeUserGroup(player, x). Look without { .
Or your char has a group with not exist’s more on you groups.lua.
Pls, see this items on your framework and test again.
Tell me after.

Don’t forget, you need use this command

/setgroup [player id]

Ty for use this script.

will what im using its vrpex b2k i dont know which version
i tried vRP.removeUserGroup({player, x})
and
vRP.removeUserGroup(player, x)
its not working still giving me ERRORS
i got my own funcation thats can admin remove the group from the phone
it is like that

local function ch_removegroup(player,choice)

local user_id = vRP.getUserId(player)

if user_id ~= nil and vRP.hasPermission(user_id,“player.group.remove”) then

vRP.prompt(player,"الايدي: ","",function(player,id)

  id = parseInt(id)

  vRP.prompt(player,"الرتبة للازالة: ","",function(player,group)

if group then

  vRP.removeUserGroup(id,group)

  vRPclient.notify(player,{group.." removed from user "..id})

  SendWebhookMessage(ac_webhook_gameplay, "**ADMIN Rem Group** \n```\nAdmin: "..user_id.." User: "..id.." Group: "..group.."```")

end

  end)

end)

end

end

and for add group in the phone its
local function ch_addgroup(player,choice)

local user_id = vRP.getUserId(player)

if user_id ~= nil and vRP.hasPermission(user_id,“player.group.add”) then

vRP.prompt(player,"الايدي : ","",function(player,id)

  id = parseInt(id)

  vRP.prompt(player,"الرتبة : ","",function(player,group)

if group then

  vRP.addUserGroup(id,group)

  vRPclient.notify(player,{group.." added to user "..id})

  SendWebhookMessage(ac_webhook_gameplay, "**ADMIN Add Group** \n```\nAdmin: "..user_id.." User: "..id.." Group: "..group.."```")

end

  end)

end)

end

end

so can u help me with it ? like u fix the script with my functions to work ?

I created this script for the B2K base, this base is a vRP0.5.
Then you need to use vRP.removeUserGroup ({player, x}).

You need to download a vrp / vrp_escadmin from my github.

This version is not meant to contain errors for you.

Your phone script is owned by vRP so it doesn’t use {}.

Try to download the version I told you and on server.lua before line 11 add
print(source)
and before line 38 add
print (x)
Then see on the server console if your id (line11) and the name of the line group (38).

Then give me the print

CQ3_4k.

On client.lua, in line 35. Change
SetNuiFocus(false)

For
SetNuiFocus(false, false)

and bro please can u add the line for webhook Message
SendWebhookMessage(ac_webhook_gameplay, “ADMIN Add Group \n\nAdmin: "..user_id.." User: "..id.." Group: "..group.."”)

to let the menu when any admin add group its shows to me in the log discord…

i did what u said bro

print(x) at line 37.
copy to between 39 and 40

for.....
   print(x)
   vRP.....

After send console print. I need see 2 prints (print(source) and print(x))

okay cool i typed it
bro the case its everything works cool but when i change any group inside the game its work but im getting this errors in cmd so it will let the cmd lagged more and not cool…

thats print cmd

2
nil
nil
admin
ALsKRaN
user
Founder
Hamad
SCRIPT ERROR: @vrp/modules/group.lua:117: attempt to index a nil value (local ‘groupdef’)

handler (- Proxy interface system, used to add/call functions between resources

local Debug = module(“lib/Debug”)

local Proxy = {}

local proxy_rdata = {}
local function proxy_callback(rvalues) – save returned values, TriggerEvent is synchronous
proxy_rdata = rvalues
end

local function proxy_resolve(itable,key)
local iname = getmetatable(itable).name

– generate access function
local fcall = function(args,callback)
if args == nil then
args = {}
end

TriggerEvent(iname..":proxy",key,args,proxy_callback)
return table.unpack(proxy_rdata) -- returns

end

itable[key] = fcall – add generated call to table (optimization)
return fcall
end

— Add event handler to call interface functions (can be called multiple times for the same interface name with different tables)
function Proxy.addInterface(name, itable)
AddEventHandler(name…“:proxy”,function(member,args,callback)
if Debug.active then
Debug.pbegin(“proxy_”…name…“:”…member…" "…json.encode(Debug.safeTableCopy(args)))
end

local f = itable[member]

if type(f) == "function" then
  callback({f(table.unpack(args))}) -- call function with and return values through callback
  -- CancelEvent() -- cancel event doesn't seem to cancel the event for the other handlers, but if it does, uncomment this
else
  --print("error: proxy call "..name..":"..member.." not found")
end

if Debug.active then
  Debug.pend()
end

end)
end

function Proxy.getInterface(name)
local r = setmetatable({},{ __index = proxy_resolve, name = name })
return r
end

return Proxy
:39)

removeUserGroup (- Proxy interface system, used to add/call functions between resources

local Debug = module(“lib/Debug”)

local Proxy = {}

local proxy_rdata = {}
local function proxy_callback(rvalues) – save returned values, TriggerEvent is synchronous
proxy_rdata = rvalues
end

local function proxy_resolve(itable,key)
local iname = getmetatable(itable).name

– generate access function
local fcall = function(args,callback)
if args == nil then
args = {}
end

TriggerEvent(iname..":proxy",key,args,proxy_callback)
return table.unpack(proxy_rdata) -- returns

end

itable[key] = fcall – add generated call to table (optimization)
return fcall
end

— Add event handler to call interface functions (can be called multiple times for the same interface name with different tables)
function Proxy.addInterface(name, itable)
AddEventHandler(name…“:proxy”,function(member,args,callback)
if Debug.active then
Debug.pbegin(“proxy_”…name…“:”…member…" "…json.encode(Debug.safeTableCopy(args)))
end

local f = itable[member]

if type(f) == "function" then
  callback({f(table.unpack(args))}) -- call function with and return values through callback
  -- CancelEvent() -- cancel event doesn't seem to cancel the event for the other handlers, but if it does, uncomment this
else
  --print("error: proxy call "..name..":"..member.." not found")
end

if Debug.active then
  Debug.pend()
end

end)
end

function Proxy.getInterface(name)
local r = setmetatable({},{ __index = proxy_resolve, name = name })
return r
end

return Proxy
:21)

handler (@vrp_escadmin/server/server.lua:42)
2
nil
nil
admin
ACE
Founder
Hamad
SCRIPT ERROR: @vrp/modules/group.lua:117: attempt to index a nil value (local ‘groupdef’)
handler (- Proxy interface system, used to add/call functions between resources

local Debug = module(“lib/Debug”)

local Proxy = {}

local proxy_rdata = {}
local function proxy_callback(rvalues) – save returned values, TriggerEvent is synchronous
proxy_rdata = rvalues
end

local function proxy_resolve(itable,key)
local iname = getmetatable(itable).name

– generate access function
local fcall = function(args,callback)
if args == nil then
args = {}
end

TriggerEvent(iname..":proxy",key,args,proxy_callback)
return table.unpack(proxy_rdata) -- returns

end

itable[key] = fcall – add generated call to table (optimization)
return fcall
end

— Add event handler to call interface functions (can be called multiple times for the same interface name with different tables)
function Proxy.addInterface(name, itable)
AddEventHandler(name…“:proxy”,function(member,args,callback)
if Debug.active then
Debug.pbegin(“proxy_”…name…“:”…member…" "…json.encode(Debug.safeTableCopy(args)))
end

local f = itable[member]

if type(f) == "function" then
  callback({f(table.unpack(args))}) -- call function with and return values through callback
  -- CancelEvent() -- cancel event doesn't seem to cancel the event for the other handlers, but if it does, uncomment this
else
  --print("error: proxy call "..name..":"..member.." not found")
end

if Debug.active then
  Debug.pend()
end

end)
end

function Proxy.getInterface(name)
local r = setmetatable({},{ __index = proxy_resolve, name = name })
return r
end

return Proxy
:39)

removeUserGroup (- Proxy interface system, used to add/call functions between resources

local Debug = module(“lib/Debug”)

local Proxy = {}

local proxy_rdata = {}
local function proxy_callback(rvalues) – save returned values, TriggerEvent is synchronous
proxy_rdata = rvalues
end

local function proxy_resolve(itable,key)
local iname = getmetatable(itable).name

– generate access function
local fcall = function(args,callback)
if args == nil then
args = {}
end

TriggerEvent(iname..":proxy",key,args,proxy_callback)
return table.unpack(proxy_rdata) -- returns

end

itable[key] = fcall – add generated call to table (optimization)
return fcall
end

— Add event handler to call interface functions (can be called multiple times for the same interface name with different tables)
function Proxy.addInterface(name, itable)
AddEventHandler(name…“:proxy”,function(member,args,callback)
if Debug.active then
Debug.pbegin(“proxy_”…name…“:”…member…" "…json.encode(Debug.safeTableCopy(args)))
end

local f = itable[member]

if type(f) == "function" then
  callback({f(table.unpack(args))}) -- call function with and return values through callback
  -- CancelEvent() -- cancel event doesn't seem to cancel the event for the other handlers, but if it does, uncomment this
else
  --print("error: proxy call "..name..":"..member.." not found")
end

if Debug.active then
  Debug.pend()
end

end)
end

function Proxy.getInterface(name)
local r = setmetatable({},{ __index = proxy_resolve, name = name })
return r
end

return Proxy
:21)

handler (@vrp_escadmin/server/server.lua:42)

If you have that error it means that you are editing someone with some role that doesn’t exist anymore.

Btw, great release thank you man!