Shilka Posted May 10, 2020 Share Posted May 10, 2020 (edited) hello everyone i made a panel to give permissions that's to give players "Police" rank ihave a gridlist with column , now i need to add all objects that's already in "Police" Acl Group to my gridlist how to do it ?? , Quote wnd1 = guiCreateWindow(476, 161, 584, 648, " Rank Panel", false) guiWindowSetSizable(wnd1, false) grid1 = guiCreateGridList(344, 45, 192, 589, false, wnd1) guiGridListAddColumn(grid1, "Acl Objects Here", 0.9) guiGridListSetSelectionMode(grid1,1) gedit1 = guiCreateEdit(94, 104, 174, 39, "Account Name Here", false, wnd1) add = guiCreateButton(75, 186, 203, 38, "Add To Group", false, wnd1) rem = guiCreateButton(75, 258, 203, 36, "Remove From Group", false, wnd1) cl1 = guiCreateButton(551, 27, 23, 32, "X", false, wnd1) Edited May 10, 2020 by Shilka Link to comment
-Ilker. Posted May 10, 2020 Share Posted May 10, 2020 -- Example function getAccountsInGroup ( group ) if ( group and type ( group ) == "string" and aclGetGroup ( group ) ) then accounts = { } for _,v in ipairs ( aclGroupListObjects ( aclGetGroup ( group ) ) or { } ) do local data = split ( v , "." ) ; if ( data[1] == "user" ) then table.insert ( accounts , { acc = data[2] } ) end end end return accounts or { } end addCommandHandler ( "addUsers" , function ( player ) triggerClientEvent ( player , "addGridlist" , player , getAccountsInGroup ( "Console" ) ) end ) -- Client Side grid = guiCreateGridList ( 300 , 300 , 300 , 200 , false ) guiGridListAddColumn ( grid , "users" ,0.9) addEvent ( "addGridlist" , true ) addEventHandler ( "addGridlist" , root , function ( t ) guiGridListClear ( grid ) if ( #t > 0 ) then for k,v in ipairs ( t ) do local row = guiGridListAddRow ( grid ) ; guiGridListSetItemText ( grid , row , 1 , v.acc , false , false ) end end end ) Link to comment
Shilka Posted May 10, 2020 Author Share Posted May 10, 2020 11 minutes ago, -Ilker. said: -- Example function getAccountsInGroup ( group ) if ( group and type ( group ) == "string" and aclGetGroup ( group ) ) then accounts = { } for _,v in ipairs ( aclGroupListObjects ( aclGetGroup ( group ) ) or { } ) do local data = split ( v , "." ) ; if ( data[1] == "user" ) then table.insert ( accounts , { acc = data[2] } ) end end end return accounts or { } end addCommandHandler ( "addUsers" , function ( player ) triggerClientEvent ( player , "addGridlist" , player , getAccountsInGroup ( "Console" ) ) end ) -- Client Side grid = guiCreateGridList ( 300 , 300 , 300 , 200 , false ) guiGridListAddColumn ( grid , "users" ,0.9) addEvent ( "addGridlist" , true ) addEventHandler ( "addGridlist" , root , function ( t ) guiGridListClear ( grid ) if ( #t > 0 ) then for k,v in ipairs ( t ) do local row = guiGridListAddRow ( grid ) ; guiGridListSetItemText ( grid , row , 1 , v.acc , false , false ) end end end ) تمام حبي، انا بدي لما اضغط علي زر معين ينفذ الوظيفة يعني ما بدي امر اف 8 واشكرك علي تعبك ياغالي Link to comment
-Ilker. Posted May 10, 2020 Share Posted May 10, 2020 7 minutes ago, Shilka said: تمام حبي، انا بدي لما اضغط علي زر معين ينفذ الوظيفة يعني ما بدي امر اف 8 واشكرك علي تعبك ياغالي You're welcome , just i know but this is example only Link to comment
Shilka Posted May 10, 2020 Author Share Posted May 10, 2020 3 minutes ago, -Ilker. said: You're welcome , just i know but this is example only طيب ازاي ابدل الأمر اف 8 بالضغط علي زر؟ Link to comment
-Ilker. Posted May 10, 2020 Share Posted May 10, 2020 'onClientGUIClick' triggerServerEvent -- Server side addEvent addEventHandler triggerClientEvent please talk english if you need talk arabic go to arabic fourm Link to comment
Shilka Posted May 10, 2020 Author Share Posted May 10, 2020 ok now i have a button to add accounts to Group , how to make when i added account to the group makes the gridlist refreshed and show the added account ?? Link to comment
-Ilker. Posted May 10, 2020 Share Posted May 10, 2020 Put the accounts again with triggerClientEvent when add new account Link to comment
Shilka Posted May 10, 2020 Author Share Posted May 10, 2020 (edited) 34 minutes ago, -Ilker. said: Put the accounts again with triggerClientEvent when add new account when i used triggerClientEvent in the function that adds the account to group its says attempt to get length of local 't' (a nil value) , my function is when i remove line 33 it works normaly but not refreshes the list . function getAccountsInGroup ( group ) if ( group and type ( group ) == "string" and aclGetGroup ( group ) ) then accounts = { } for _,v in ipairs ( aclGroupListObjects ( aclGetGroup ( group ) ) or { } ) do local data = split ( v , "." ) ; if ( data[1] == "user" ) then table.insert ( accounts , { acc = data[2] } ) end end end return accounts or { } end addEvent("done",true) -- thats when i click on button it displays all accounts -- addEventHandler ( "done" ,root, function ( player ) triggerClientEvent ( "addGridlist" , root , getAccountsInGroup ( "Police" ) ) end ) function addToGroup( group,text,player ) group = aclGetGroup( group ) if group == false or group == nil then end local account = getAccount ( text ) if ( account ~= false ) then local add = aclGroupAddObject( aclGetGroup("Police"), "user."..text ) if add then outputChatBox( "The object has been added successfully to the group", root, 0, 255, 0, true ) triggerClientEvent ("addGridlist",root,addToGroup) else outputChatBox( "This object is already in the group", source, 255, 0, 0, true ) end else outputChatBox( "This account doesn't exists", source, 255, 0, 0, true ) end end addEvent( 'pe',true ) addEventHandler( 'pe',root,addToGroup) Edited May 10, 2020 by Shilka Link to comment
-Ilker. Posted May 10, 2020 Share Posted May 10, 2020 function getAccountsInGroup ( group ) if ( group and type ( group ) == "string" and aclGetGroup ( group ) ) then accounts = { } for _,v in ipairs ( aclGroupListObjects ( aclGetGroup ( group ) ) or { } ) do local data = split ( v , "." ) ; if ( data[1] == "user" ) then table.insert ( accounts , { acc = data[2] } ) end end end return accounts or { } end addEvent("done",true) -- thats when i click on button it displays all accounts -- addEventHandler ( "done" ,root, function ( player ) triggerClientEvent ( "addGridlist" , root , getAccountsInGroup ( "Police" ) ) end ) function addToGroup( group,text,player ) group = aclGetGroup( group ) if group == false or group == nil then end local account = getAccount ( text ) if ( account ~= false ) then local add = aclGroupAddObject( aclGetGroup("Police"), "user."..text ) if add then outputChatBox( "The object has been added successfully to the group", root, 0, 255, 0, true ) triggerClientEvent ( "addGridlist" , root , getAccountsInGroup ( "Police" ) ) else outputChatBox( "This object is already in the group", source, 255, 0, 0, true ) end else outputChatBox( "This account doesn't exists", source, 255, 0, 0, true ) end end addEvent( 'pe',true ) addEventHandler( 'pe',root,addToGroup) Link to comment
Shilka Posted May 10, 2020 Author Share Posted May 10, 2020 36 minutes ago, -Ilker. said: function getAccountsInGroup ( group ) if ( group and type ( group ) == "string" and aclGetGroup ( group ) ) then accounts = { } for _,v in ipairs ( aclGroupListObjects ( aclGetGroup ( group ) ) or { } ) do local data = split ( v , "." ) ; if ( data[1] == "user" ) then table.insert ( accounts , { acc = data[2] } ) end end end return accounts or { } end addEvent("done",true) -- thats when i click on button it displays all accounts -- addEventHandler ( "done" ,root, function ( player ) triggerClientEvent ( "addGridlist" , root , getAccountsInGroup ( "Police" ) ) end ) function addToGroup( group,text,player ) group = aclGetGroup( group ) if group == false or group == nil then end local account = getAccount ( text ) if ( account ~= false ) then local add = aclGroupAddObject( aclGetGroup("Police"), "user."..text ) if add then outputChatBox( "The object has been added successfully to the group", root, 0, 255, 0, true ) triggerClientEvent ( "addGridlist" , root , getAccountsInGroup ( "Police" ) ) else outputChatBox( "This object is already in the group", source, 255, 0, 0, true ) end else outputChatBox( "This account doesn't exists", source, 255, 0, 0, true ) end end addEvent( 'pe',true ) addEventHandler( 'pe',root,addToGroup) Thx bro for helping me Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now