Jump to content

group panel


orcun99

Recommended Posts

 
function addGroup(client, group)
    local playerToAdd = getPlayerAccount(client)
    if not exports.Qacl:isPlayerInGroup(playerToAdd, group)then
        exports.Qacl:addAccountToGroup(playerToAdd,group)
        exports.Qcommands:sendMessage("You've been added to: " ..group.. "!", 0, 150, 0, client)
    end
end
addEvent("addPlayerToGroup", true)
addEventHandler("addPlayerToGroup", resourceRoot, addGroup)

 

 

function addThePlayer(thePlayer)
    if (source==addButton) then
    triggerServerEvent("addPlayerToGroup", getRootElement(), guiGetText(name), guiGridListGetSelectedItem(groupGrid))
    end
end
addEventHandler("onClientGUIClick", root, addThePlayer)

 

what's wrong ?

debugscript 3 :  bad argument @ 'getplayeraccount' 

Edited by orcun99
Link to comment

In function addGroup(client, group), client and group correspond to guiGetText(name) and guiGridListGetSelectedItem(groupGrid), respectively, from the client-side. So you're inputting a string where a player element should be. Just don't name the first parament client and it should work.

Edited by MrTasty
Link to comment
24 minutes ago, MrTasty said:

In function addGroup(client, group), client and group correspond to guiGetText(name) and guiGridListGetSelectedItem(groupGrid), respectively, from the client-side. So you're inputting a string where a player element should be. Just don't name the first parament client and it should work.

Sorry But I don't understand

 

for example my account name : admin

what should I write here? https://prntscr.com/g14y9q

Link to comment
17 hours ago, orcun99 said:

 
function addGroup(client, group)
    local playerToAdd = getPlayerAccount(client)
    if not exports.Qacl:isPlayerInGroup(playerToAdd, group)then
        exports.Qacl:addAccountToGroup(playerToAdd,group)
        exports.Qcommands:sendMessage("You've been added to: " ..group.. "!", 0, 150, 0, client)
    end
end
addEvent("addPlayerToGroup", true)
addEventHandler("addPlayerToGroup", resourceRoot, addGroup)

 

 


function addThePlayer(thePlayer)
    if (source==addButton) then
    triggerServerEvent("addPlayerToGroup", getRootElement(), guiGetText(name), guiGridListGetSelectedItem(groupGrid))
    end
end
addEventHandler("onClientGUIClick", root, addThePlayer)

 

what's wrong ?

debugscript 3 :  bad argument @ 'getplayeraccount' 

try this


function addGroup(clientname, group)
  local client=getPlayerFromName(clientname)
    local playerToAdd = getPlayerAccount(client)
    if not exports.Qacl:isPlayerInGroup(playerToAdd, group)then
        exports.Qacl:addAccountToGroup(playerToAdd,group)
        exports.Qcommands:sendMessage("You've been added to: " ..group.. "!", 0, 150, 0, client)
    end
end
addEvent("addPlayerToGroup", true)
addEventHandler("addPlayerToGroup", resourceRoot, addGroup)

 

  • Like 1
Link to comment
13 minutes ago, Master_MTA said:

try this


function addGroup(clientname, group)
  local client=getPlayerFromName(clientname)
    local playerToAdd = getPlayerAccount(client)
    if not exports.Qacl:isPlayerInGroup(playerToAdd, group)then
        exports.Qacl:addAccountToGroup(playerToAdd,group)
        exports.Qcommands:sendMessage("You've been added to: " ..group.. "!", 0, 150, 0, client)
    end
end
addEvent("addPlayerToGroup", true)
addEventHandler("addPlayerToGroup", resourceRoot, addGroup)

 

still same problem

Link to comment
Just now, orcun99 said:

still same problem

sorry i didn't see the photo till now

u should edit it like that


function addGroup(clientname, group)
local client=getAccountPlayer(clientname)
  	if client then
  local playerToAdd = getPlayerAccount(client)
    if not exports.Qacl:isPlayerInGroup(playerToAdd, group)then
        exports.Qacl:addAccountToGroup(playerToAdd,group)
        exports.Qcommands:sendMessage("You've been added to: " ..group.. "!", 0, 150, 0, client)
    	end
    end
end
addEvent("addPlayerToGroup", true)
addEventHandler("addPlayerToGroup", resourceRoot, addGroup)

 

Link to comment
17 minutes ago, Master_MTA said:

sorry i didn't see the photo till now

u should edit it like that


function addGroup(clientname, group)
local client=getAccountPlayer(clientname)
  	if client then
  local playerToAdd = getPlayerAccount(client)
    if not exports.Qacl:isPlayerInGroup(playerToAdd, group)then
        exports.Qacl:addAccountToGroup(playerToAdd,group)
        exports.Qcommands:sendMessage("You've been added to: " ..group.. "!", 0, 150, 0, client)
    	end
    end
end
addEvent("addPlayerToGroup", true)
addEventHandler("addPlayerToGroup", resourceRoot, addGroup)

 

still don't work erorr: https://prntscr.com/g1cnc3

  • Like 1
Link to comment

There is full script code:

server.lua

 

addCommandHandler("group", 
function(source)
    if exports.Qacl:isPlayerInGroup(source, "admin") or exports.Qacl:isPlayerInGroup(source, "subadmin") then
        triggerClientEvent(source, "createWindow", getRootElement())
        triggerClientEvent(source, "fillagrid", getRootElement())
        triggerClientEvent(source, "fillcgrid", getRootElement())
        triggerClientEvent(source, "fillugrid", getRootElement())
    end
end
)
function addGroup(clientname, group)
local client=getAccountPlayer(getAccount(clientname))
      if client then
  local playerToAdd = getPlayerAccount(client)
    if not exports.Qacl:isPlayerInGroup(playerToAdd, group)then
        exports.Qacl:addAccountToGroup(playerToAdd,group)
        exports.Qcommands:sendMessage("You've been added to: " ..group.. "!", 0, 150, 0, client)
        end
    end
end
addEvent("addPlayerToGroup", true)
addEventHandler("addPlayerToGroup", resourceRoot, addGroup)

function removeGroup(client, group)
    local playerToRemove = getPlayerAccount(client)
    if exports.Qacl:isPlayerInGroup(playerToAdd, group) then
        exports.Qacl:removeAccountFromGroup(playerToRemove,group)
        exports.Qcommands:sendMessage("You've been removed from: " ..group.. "!", 0, 150, 0, client)
    end
end
addEvent("removePlayerFromGroup", true)
addEventHandler("removePlayerFromGroup", resourceRoot, removeGroup)

 

 

client.lua

 

uniongroups = {"unionrecruit", "unionsoldier" }
confedgroups = {"confedrecruit", "confedsoldier"}
rpgroups = {"ssmember", "nsamember", "aramember", "lsfdmember", "usocmember"} 

function openWindow() 
    showCursor(true)
    window = guiCreateWindow(555, 381, 220, 288, "Q:RPG - Group management", false)
    guiWindowSetSizable(window, false)
    groupGrid = guiCreateGridList(10, 70, 201, 176, false, window)
    guiGridListAddColumn(groupGrid, "Groups:", 0.9)
    addButton = guiCreateButton(10, 254, 95, 25, "Add", false, window)
    remButton = guiCreateButton(110, 254, 95, 25, "Remove", false, window)
    closeButton = guiCreateButton(184, 31, 27, 23, "X", false, window)
    name = guiCreateMemo(0.05, 0.09, 0.75, 0.11, "Enter account name", true, window)
end
addEvent("createWindow", true)
addEventHandler("createWindow", root, openWindow)

function fillUnionGrids()
    for i,v in ipairs(uniongroups) do guiGridListSetItemText(groupGrid, guiGridListAddRow(groupGrid), 1, v, false, false) end
end
addEvent("fillugrid", true)
addEventHandler("fillugrid", root, fillUnionGrids)

function fillConfGrids()
    for i,v in ipairs(confedgroups) do guiGridListSetItemText(groupGrid, guiGridListAddRow(groupGrid), 1, v, false, false) end
end
addEvent("fillcgrid", true)
addEventHandler("fillcgrid", root, fillConfGrids)

function fillAdminGrids()
    for i,v in ipairs(rpgroups) do guiGridListSetItemText(groupGrid, guiGridListAddRow(groupGrid), 1, v, false, false) end
end
addEvent("fillagrid", true)
addEventHandler("fillagrid", root, fillAdminGrids)

function close()
    if (source == closeButton) then
        guiSetVisible(window, false)
        showCursor(false)
    end
end
addEventHandler("onClientGUIClick", root, close)

function addThePlayer(thePlayer)
    if (source==addButton) then
    triggerServerEvent("addPlayerToGroup", getRootElement(), guiGetText(name), guiGridListGetSelectedItem(groupGrid))
    end
end
addEventHandler("onClientGUIClick", root, addThePlayer)

function removeThePlayer(thePlayer)
    if (source==remButton) then
    triggerServerEvent("addPlayerFromGroup", getRootElement(), guiGetText(name), guiGridListGetSelectedItem(groupGrid))
    end
end
addEventHandler("onClientGUIClick", root, removeThePlayer)

 

I'm sure %100 true account name

you can check my accname : https://prntscr.com/g1cx96

Edited by orcun99
Link to comment
8 minutes ago, orcun99 said:

There is full script code:

server.lua

 

 



 

addCommandHandler("group", 
function(source)
    if exports.Qacl:isPlayerInGroup(source, "admin") or exports.Qacl:isPlayerInGroup(source, "subadmin") then
        triggerClientEvent(source, "createWindow", getRootElement())
        triggerClientEvent(source, "fillagrid", getRootElement())
        triggerClientEvent(source, "fillcgrid", getRootElement())
        triggerClientEvent(source, "fillugrid", getRootElement())
    end
end
)
function addGroup(clientname, group)
local client=getAccountPlayer(getAccount(clientname))
      if client then
  local playerToAdd = getPlayerAccount(client)
    if not exports.Qacl:isPlayerInGroup(playerToAdd, group)then
        exports.Qacl:addAccountToGroup(playerToAdd,group)
        exports.Qcommands:sendMessage("You've been added to: " ..group.. "!", 0, 150, 0, client)
        end
    end
end
addEvent("addPlayerToGroup", true)
addEventHandler("addPlayerToGroup", resourceRoot, addGroup)

function removeGroup(client, group)
    local playerToRemove = getPlayerAccount(client)
    if exports.Qacl:isPlayerInGroup(playerToAdd, group) then
        exports.Qacl:removeAccountFromGroup(playerToRemove,group)
        exports.Qcommands:sendMessage("You've been removed from: " ..group.. "!", 0, 150, 0, client)
    end
end
addEvent("removePlayerFromGroup", true)
addEventHandler("removePlayerFromGroup", resourceRoot, removeGroup)

 

 

client.lua

 

		

		

 

uniongroups = {"unionrecruit", "unionsoldier" }
confedgroups = {"confedrecruit", "confedsoldier"}
rpgroups = {"ssmember", "nsamember", "aramember", "lsfdmember", "usocmember"} 

function openWindow() 
    showCursor(true)
    window = guiCreateWindow(555, 381, 220, 288, "Q:RPG - Group management", false)
    guiWindowSetSizable(window, false)
    groupGrid = guiCreateGridList(10, 70, 201, 176, false, window)
    guiGridListAddColumn(groupGrid, "Groups:", 0.9)
    addButton = guiCreateButton(10, 254, 95, 25, "Add", false, window)
    remButton = guiCreateButton(110, 254, 95, 25, "Remove", false, window)
    closeButton = guiCreateButton(184, 31, 27, 23, "X", false, window)
    name = guiCreateMemo(0.05, 0.09, 0.75, 0.11, "Enter account name", true, window)
end
addEvent("createWindow", true)
addEventHandler("createWindow", root, openWindow)

function fillUnionGrids()
    for i,v in ipairs(uniongroups) do guiGridListSetItemText(groupGrid, guiGridListAddRow(groupGrid), 1, v, false, false) end
end
addEvent("fillugrid", true)
addEventHandler("fillugrid", root, fillUnionGrids)

function fillConfGrids()
    for i,v in ipairs(confedgroups) do guiGridListSetItemText(groupGrid, guiGridListAddRow(groupGrid), 1, v, false, false) end
end
addEvent("fillcgrid", true)
addEventHandler("fillcgrid", root, fillConfGrids)

function fillAdminGrids()
    for i,v in ipairs(rpgroups) do guiGridListSetItemText(groupGrid, guiGridListAddRow(groupGrid), 1, v, false, false) end
end
addEvent("fillagrid", true)
addEventHandler("fillagrid", root, fillAdminGrids)

function close()
    if (source == closeButton) then
        guiSetVisible(window, false)
        showCursor(false)
    end
end
addEventHandler("onClientGUIClick", root, close)

function addThePlayer(thePlayer)
    if (source==addButton) then
    triggerServerEvent("addPlayerToGroup", getRootElement(), guiGetText(name), guiGridListGetSelectedItem(groupGrid))
    end
end
addEventHandler("onClientGUIClick", root, addThePlayer)

function removeThePlayer(thePlayer)
    if (source==remButton) then
    triggerServerEvent("addPlayerFromGroup", getRootElement(), guiGetText(name), guiGridListGetSelectedItem(groupGrid))
    end
end
addEventHandler("onClientGUIClick", root, removeThePlayer)

next time use lua tag

and try this



addCommandHandler("group", 
function(source)
    if exports.Qacl:isPlayerInGroup(source, "admin") or exports.Qacl:isPlayerInGroup(source, "subadmin") then
        triggerClientEvent(source, "createWindow", getRootElement())
        triggerClientEvent(source, "fillagrid", getRootElement())
        triggerClientEvent(source, "fillcgrid", getRootElement())
        triggerClientEvent(source, "fillugrid", getRootElement())
    end
end
)
function addGroup(clientname, group)
local client=getAccountPlayer(getAccount(clientname))
      if isElement(client) then
  local playerToAdd = getPlayerAccount(client)
    if not exports.Qacl:isPlayerInGroup(playerToAdd, group)then
        exports.Qacl:addAccountToGroup(playerToAdd,group)
        exports.Qcommands:sendMessage("You've been added to: " ..group.. "!", 0, 150, 0, client)
        end
    end
end
addEvent("addPlayerToGroup", true)
addEventHandler("addPlayerToGroup", resourceRoot, addGroup)

function removeGroup(client, group)
    local playerToRemove = getPlayerAccount(client)
    if exports.Qacl:isPlayerInGroup(playerToAdd, group) then
        exports.Qacl:removeAccountFromGroup(playerToRemove,group)
        exports.Qcommands:sendMessage("You've been removed from: " ..group.. "!", 0, 150, 0, client)
    end
end
addEvent("removePlayerFromGroup", true)
addEventHandler("removePlayerFromGroup", resourceRoot, removeGroup)

 

 

client.lua

 


 

uniongroups = {"unionrecruit", "unionsoldier" }
confedgroups = {"confedrecruit", "confedsoldier"}
rpgroups = {"ssmember", "nsamember", "aramember", "lsfdmember", "usocmember"} 
window = guiCreateWindow(555, 381, 220, 288, "Q:RPG - Group management", false)
    guiWindowSetSizable(window, false)
    groupGrid = guiCreateGridList(10, 70, 201, 176, false, window)
    guiGridListAddColumn(groupGrid, "Groups:", 0.9)
    addButton = guiCreateButton(10, 254, 95, 25, "Add", false, window)
    remButton = guiCreateButton(110, 254, 95, 25, "Remove", false, window)
    closeButton = guiCreateButton(184, 31, 27, 23, "X", false, window)
    name = guiCreateMemo(0.05, 0.09, 0.75, 0.11, "Enter account name", false, window)
function openWindow() 
    showCursor(true)
	guiSetVisible(window,true)
    
end
addEvent("createWindow", true)
addEventHandler("createWindow", root, openWindow)

function fillUnionGrids()
    for i,v in ipairs(uniongroups) do guiGridListSetItemText(groupGrid, guiGridListAddRow(groupGrid), 1, v, false, false) end
end
addEvent("fillugrid", true)
addEventHandler("fillugrid", root, fillUnionGrids)

function fillConfGrids()
    for i,v in ipairs(confedgroups) do guiGridListSetItemText(groupGrid, guiGridListAddRow(groupGrid), 1, v, false, false) end
end
addEvent("fillcgrid", true)
addEventHandler("fillcgrid", root, fillConfGrids)

function fillAdminGrids()
    for i,v in ipairs(rpgroups) do guiGridListSetItemText(groupGrid, guiGridListAddRow(groupGrid), 1, v, false, false) end
end
addEvent("fillagrid", true)
addEventHandler("fillagrid", root, fillAdminGrids)

function close()
    if (source == closeButton) then
        guiSetVisible(window, false)
        showCursor(false)
		elseif source==name then
		guiSetText(source,'')
    end
end
addEventHandler("onClientGUIClick", root, close)

function addThePlayer(thePlayer)
    if (source==addButton) then
    triggerServerEvent("addPlayerToGroup", getRootElement(), guiGetText(name), guiGridListGetSelectedItem(groupGrid))
    end
end
addEventHandler("onClientGUIClick", root, addThePlayer)

function removeThePlayer(thePlayer)
    if (source==remButton) then
    triggerServerEvent("addPlayerFromGroup", getRootElement(), guiGetText(name), guiGridListGetSelectedItem(groupGrid))
    end
end
addEventHandler("onClientGUIClick", root, removeThePlayer)

 

Link to comment


addCommandHandler("group", 
function(source)
    if exports.Qacl:isPlayerInGroup(source, "admin") or exports.Qacl:isPlayerInGroup(source, "subadmin") then
        triggerClientEvent(source, "createWindow", getRootElement())
        triggerClientEvent(source, "fillagrid", getRootElement())
        triggerClientEvent(source, "fillcgrid", getRootElement())
        triggerClientEvent(source, "fillugrid", getRootElement())
    end
end
)
function addGroup(clientname, group)
local client=getAccountPlayer(getAccountName(clientname))
      if isElement(client) then
  local playerToAdd = getPlayerAccount(client)
    if not exports.Qacl:isPlayerInGroup(playerToAdd, group)then
        exports.Qacl:addAccountToGroup(playerToAdd,group)
        exports.Qcommands:sendMessage("You've been added to: " ..group.. "!", 0, 150, 0, client)
        end
    end
end
addEvent("addPlayerToGroup", true)
addEventHandler("addPlayerToGroup", resourceRoot, addGroup)

function removeGroup(client, group)
    local playerToRemove = getPlayerAccount(client)
    if exports.Qacl:isPlayerInGroup(playerToAdd, group) then
        exports.Qacl:removeAccountFromGroup(playerToRemove,group)
        exports.Qcommands:sendMessage("You've been removed from: " ..group.. "!", 0, 150, 0, client)
    end
end
addEvent("removePlayerFromGroup", true)
addEventHandler("removePlayerFromGroup", resourceRoot, removeGroup)

 

 

client.lua

 


 

uniongroups = {"unionrecruit", "unionsoldier" }
confedgroups = {"confedrecruit", "confedsoldier"}
rpgroups = {"ssmember", "nsamember", "aramember", "lsfdmember", "usocmember"} 
window = guiCreateWindow(555, 381, 220, 288, "Q:RPG - Group management", false)
    guiWindowSetSizable(window, false)
    groupGrid = guiCreateGridList(10, 70, 201, 176, false, window)
    guiGridListAddColumn(groupGrid, "Groups:", 0.9)
    addButton = guiCreateButton(10, 254, 95, 25, "Add", false, window)
    remButton = guiCreateButton(110, 254, 95, 25, "Remove", false, window)
    closeButton = guiCreateButton(184, 31, 27, 23, "X", false, window)
    name = guiCreateMemo(0.05, 0.09, 0.75, 0.11, "Enter account name", false, window)
function openWindow() 
    showCursor(true)
	guiSetVisible(window,true)
    
end
addEvent("createWindow", true)
addEventHandler("createWindow", root, openWindow)

function fillUnionGrids()
    for i,v in ipairs(uniongroups) do guiGridListSetItemText(groupGrid, guiGridListAddRow(groupGrid), 1, v, false, false) end
end
addEvent("fillugrid", true)
addEventHandler("fillugrid", root, fillUnionGrids)

function fillConfGrids()
    for i,v in ipairs(confedgroups) do guiGridListSetItemText(groupGrid, guiGridListAddRow(groupGrid), 1, v, false, false) end
end
addEvent("fillcgrid", true)
addEventHandler("fillcgrid", root, fillConfGrids)

function fillAdminGrids()
    for i,v in ipairs(rpgroups) do guiGridListSetItemText(groupGrid, guiGridListAddRow(groupGrid), 1, v, false, false) end
end
addEvent("fillagrid", true)
addEventHandler("fillagrid", root, fillAdminGrids)

function close()
    if (source == closeButton) then
        guiSetVisible(window, false)
        showCursor(false)
		elseif source==name then
		guiSetText(source,'')
    end
end
addEventHandler("onClientGUIClick", root, close)

function addThePlayer(thePlayer)
    if (source==addButton) then
    triggerServerEvent("addPlayerToGroup", getRootElement(), guiGetText(name), guiGridListGetSelectedItem(groupGrid))
    end
end
addEventHandler("onClientGUIClick", root, addThePlayer)

function removeThePlayer(thePlayer)
    if (source==remButton) then
    triggerServerEvent("addPlayerFromGroup", getRootElement(), guiGetText(name), guiGridListGetSelectedItem(groupGrid))
    end
end
addEventHandler("onClientGUIClick", root, removeThePlayer)

try like that idk if it will work

Link to comment
2 minutes ago, Dimos7 said:


addCommandHandler("group", 
function(source)
    if exports.Qacl:isPlayerInGroup(source, "admin") or exports.Qacl:isPlayerInGroup(source, "subadmin") then
        triggerClientEvent(source, "createWindow", getRootElement())
        triggerClientEvent(source, "fillagrid", getRootElement())
        triggerClientEvent(source, "fillcgrid", getRootElement())
        triggerClientEvent(source, "fillugrid", getRootElement())
    end
end
)
function addGroup(clientname, group)
local client=getAccountPlayer(getAccountName(clientname))
      if isElement(client) then
  local playerToAdd = getPlayerAccount(client)
    if not exports.Qacl:isPlayerInGroup(playerToAdd, group)then
        exports.Qacl:addAccountToGroup(playerToAdd,group)
        exports.Qcommands:sendMessage("You've been added to: " ..group.. "!", 0, 150, 0, client)
        end
    end
end
addEvent("addPlayerToGroup", true)
addEventHandler("addPlayerToGroup", resourceRoot, addGroup)

function removeGroup(client, group)
    local playerToRemove = getPlayerAccount(client)
    if exports.Qacl:isPlayerInGroup(playerToAdd, group) then
        exports.Qacl:removeAccountFromGroup(playerToRemove,group)
        exports.Qcommands:sendMessage("You've been removed from: " ..group.. "!", 0, 150, 0, client)
    end
end
addEvent("removePlayerFromGroup", true)
addEventHandler("removePlayerFromGroup", resourceRoot, removeGroup)

 

 

client.lua

 


 

uniongroups = {"unionrecruit", "unionsoldier" }
confedgroups = {"confedrecruit", "confedsoldier"}
rpgroups = {"ssmember", "nsamember", "aramember", "lsfdmember", "usocmember"} 
window = guiCreateWindow(555, 381, 220, 288, "Q:RPG - Group management", false)
    guiWindowSetSizable(window, false)
    groupGrid = guiCreateGridList(10, 70, 201, 176, false, window)
    guiGridListAddColumn(groupGrid, "Groups:", 0.9)
    addButton = guiCreateButton(10, 254, 95, 25, "Add", false, window)
    remButton = guiCreateButton(110, 254, 95, 25, "Remove", false, window)
    closeButton = guiCreateButton(184, 31, 27, 23, "X", false, window)
    name = guiCreateMemo(0.05, 0.09, 0.75, 0.11, "Enter account name", false, window)
function openWindow() 
    showCursor(true)
	guiSetVisible(window,true)
    
end
addEvent("createWindow", true)
addEventHandler("createWindow", root, openWindow)

function fillUnionGrids()
    for i,v in ipairs(uniongroups) do guiGridListSetItemText(groupGrid, guiGridListAddRow(groupGrid), 1, v, false, false) end
end
addEvent("fillugrid", true)
addEventHandler("fillugrid", root, fillUnionGrids)

function fillConfGrids()
    for i,v in ipairs(confedgroups) do guiGridListSetItemText(groupGrid, guiGridListAddRow(groupGrid), 1, v, false, false) end
end
addEvent("fillcgrid", true)
addEventHandler("fillcgrid", root, fillConfGrids)

function fillAdminGrids()
    for i,v in ipairs(rpgroups) do guiGridListSetItemText(groupGrid, guiGridListAddRow(groupGrid), 1, v, false, false) end
end
addEvent("fillagrid", true)
addEventHandler("fillagrid", root, fillAdminGrids)

function close()
    if (source == closeButton) then
        guiSetVisible(window, false)
        showCursor(false)
		elseif source==name then
		guiSetText(source,'')
    end
end
addEventHandler("onClientGUIClick", root, close)

function addThePlayer(thePlayer)
    if (source==addButton) then
    triggerServerEvent("addPlayerToGroup", getRootElement(), guiGetText(name), guiGridListGetSelectedItem(groupGrid))
    end
end
addEventHandler("onClientGUIClick", root, addThePlayer)

function removeThePlayer(thePlayer)
    if (source==remButton) then
    triggerServerEvent("addPlayerFromGroup", getRootElement(), guiGetText(name), guiGridListGetSelectedItem(groupGrid))
    end
end
addEventHandler("onClientGUIClick", root, removeThePlayer)

try like that idk if it will work

textbox is gone

Link to comment

addCommandHandler("group", 
function(source)
    if exports.Qacl:isPlayerInGroup(source, "admin") or exports.Qacl:isPlayerInGroup(source, "subadmin") then
        triggerClientEvent(source, "createWindow", getRootElement())
        triggerClientEvent(source, "fillagrid", getRootElement())
        triggerClientEvent(source, "fillcgrid", getRootElement())
        triggerClientEvent(source, "fillugrid", getRootElement())
    end
end
)
function addGroup(clientname, group)
local client=getAccountPlayer(getAccount(clientname))
      if isElement(client) then
  local playerToAdd = getPlayerAccount(client)
    if not exports.Qacl:isPlayerInGroup(playerToAdd, group)then
        exports.Qacl:addAccountToGroup(playerToAdd,group)
        exports.Qcommands:sendMessage("You've been added to: " ..group.. "!", 0, 150, 0, client)
        end
    end
end
addEvent("addPlayerToGroup", true)
addEventHandler("addPlayerToGroup", resourceRoot, addGroup)

function removeGroup(client, group)
    local playerToRemove = getPlayerAccount(client)
    if exports.Qacl:isPlayerInGroup(playerToAdd, group) then
        exports.Qacl:removeAccountFromGroup(playerToRemove,group)
        exports.Qcommands:sendMessage("You've been removed from: " ..group.. "!", 0, 150, 0, client)
    end
end
addEvent("removePlayerFromGroup", true)
addEventHandler("removePlayerFromGroup", resourceRoot, removeGroup)

 

 

client.lua

 


 

uniongroups = {"unionrecruit", "unionsoldier" }
confedgroups = {"confedrecruit", "confedsoldier"}
rpgroups = {"ssmember", "nsamember", "aramember", "lsfdmember", "usocmember"} 
window = guiCreateWindow(555, 381, 220, 288, "Q:RPG - Group management", false)
    guiWindowSetSizable(window, false)
    groupGrid = guiCreateGridList(10, 70, 201, 176, false, window)
    guiGridListAddColumn(groupGrid, "Groups:", 0.9)
    addButton = guiCreateButton(10, 254, 95, 25, "Add", false, window)
    remButton = guiCreateButton(110, 254, 95, 25, "Remove", false, window)
    closeButton = guiCreateButton(184, 31, 27, 23, "X", false, window)
    name = guiCreateEdit(0.05, 0.09, 0.75, 0.11, "Enter account name", false, window)
function openWindow() 
    showCursor(true)
	guiSetVisible(window,true)
    
end
addEvent("createWindow", true)
addEventHandler("createWindow", root, openWindow)

function fillUnionGrids()
    for i,v in ipairs(uniongroups) do guiGridListSetItemText(groupGrid, guiGridListAddRow(groupGrid), 1, v, false, false) end
end
addEvent("fillugrid", true)
addEventHandler("fillugrid", root, fillUnionGrids)

function fillConfGrids()
    for i,v in ipairs(confedgroups) do guiGridListSetItemText(groupGrid, guiGridListAddRow(groupGrid), 1, v, false, false) end
end
addEvent("fillcgrid", true)
addEventHandler("fillcgrid", root, fillConfGrids)

function fillAdminGrids()
    for i,v in ipairs(rpgroups) do guiGridListSetItemText(groupGrid, guiGridListAddRow(groupGrid), 1, v, false, false) end
end
addEvent("fillagrid", true)
addEventHandler("fillagrid", root, fillAdminGrids)

function close()
    if (source == closeButton) then
        guiSetVisible(window, false)
        showCursor(false)
		elseif source==name then
		guiSetText(source,'')
    end
end
addEventHandler("onClientGUIClick", root, close)

function addThePlayer(thePlayer)
    if (source==addButton) then
    triggerServerEvent("addPlayerToGroup", getRootElement(), guiGetText(name), guiGridListGetSelectedItem(groupGrid))
    end
end
addEventHandler("onClientGUIClick", root, addThePlayer)

function removeThePlayer(thePlayer)
    if (source==remButton) then
    triggerServerEvent("addPlayerFromGroup", getRootElement(), guiGetText(name), guiGridListGetSelectedItem(groupGrid))
    end
end
addEventHandler("onClientGUIClick", root, removeThePlayer)

 

Link to comment
10 minutes ago, Dimos7 said:

addCommandHandler("group", function(source)    if exports.Qacl:isPlayerInGroup(source, "admin") or exports.Qacl:isPlayerInGroup(source, "subadmin") then        triggerClientEvent(source, "createWindow", getRootElement())        triggerClientEvent(source, "fillagrid", getRootElement())        triggerClientEvent(source, "fillcgrid", getRootElement())        triggerClientEvent(source, "fillugrid", getRootElement())    endend)function addGroup(clientname, group)local client=getAccountPlayer(getAccount(clientname))      if isElement(client) then  local playerToAdd = getPlayerAccount(client)    if not exports.Qacl:isPlayerInGroup(playerToAdd, group)then        exports.Qacl:addAccountToGroup(playerToAdd,group)        exports.Qcommands:sendMessage("You've been added to: " ..group.. "!", 0, 150, 0, client)        end    endendaddEvent("addPlayerToGroup", true)addEventHandler("addPlayerToGroup", resourceRoot, addGroup)function removeGroup(client, group)    local playerToRemove = getPlayerAccount(client)    if exports.Qacl:isPlayerInGroup(playerToAdd, group) then        exports.Qacl:removeAccountFromGroup(playerToRemove,group)        exports.Qcommands:sendMessage("You've been removed from: " ..group.. "!", 0, 150, 0, client)    endendaddEvent("removePlayerFromGroup", true)addEventHandler("removePlayerFromGroup", resourceRoot, removeGroup)  client.lua  uniongroups = {"unionrecruit", "unionsoldier" }confedgroups = {"confedrecruit", "confedsoldier"}rpgroups = {"ssmember", "nsamember", "aramember", "lsfdmember", "usocmember"} window = guiCreateWindow(555, 381, 220, 288, "Q:RPG - Group management", false)    guiWindowSetSizable(window, false)    groupGrid = guiCreateGridList(10, 70, 201, 176, false, window)    guiGridListAddColumn(groupGrid, "Groups:", 0.9)    addButton = guiCreateButton(10, 254, 95, 25, "Add", false, window)    remButton = guiCreateButton(110, 254, 95, 25, "Remove", false, window)    closeButton = guiCreateButton(184, 31, 27, 23, "X", false, window)    name = guiCreateEdit(0.05, 0.09, 0.75, 0.11, "Enter account name", false, window)function openWindow()     showCursor(true)	guiSetVisible(window,true)    endaddEvent("createWindow", true)addEventHandler("createWindow", root, openWindow)function fillUnionGrids()    for i,v in ipairs(uniongroups) do guiGridListSetItemText(groupGrid, guiGridListAddRow(groupGrid), 1, v, false, false) endendaddEvent("fillugrid", true)addEventHandler("fillugrid", root, fillUnionGrids)function fillConfGrids()    for i,v in ipairs(confedgroups) do guiGridListSetItemText(groupGrid, guiGridListAddRow(groupGrid), 1, v, false, false) endendaddEvent("fillcgrid", true)addEventHandler("fillcgrid", root, fillConfGrids)function fillAdminGrids()    for i,v in ipairs(rpgroups) do guiGridListSetItemText(groupGrid, guiGridListAddRow(groupGrid), 1, v, false, false) endendaddEvent("fillagrid", true)addEventHandler("fillagrid", root, fillAdminGrids)function close()    if (source == closeButton) then        guiSetVisible(window, false)        showCursor(false)		elseif source==name then		guiSetText(source,'')    endendaddEventHandler("onClientGUIClick", root, close)function addThePlayer(thePlayer)    if (source==addButton) then    triggerServerEvent("addPlayerToGroup", getRootElement(), guiGetText(name), guiGridListGetSelectedItem(groupGrid))    endendaddEventHandler("onClientGUIClick", root, addThePlayer)function removeThePlayer(thePlayer)    if (source==remButton) then    triggerServerEvent("addPlayerFromGroup", getRootElement(), guiGetText(name), guiGridListGetSelectedItem(groupGrid))    endendaddEventHandler("onClientGUIClick", root, removeThePlayer)

 

now there is no debugscript 3 error but my groups not add selected group

and I try restart acl database sql check and still not add

sorry for bad english

https://prnt.sc/g1dcrk

http://prntscr.com/g1dd65

 

I select unionsoldier members and press add guiedit: admin

Edited by orcun99
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...