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)