Sasu Posted April 20, 2013 Share Posted April 20, 2013 (edited) Client: function obtenerIPSerialPing(serial, ip, account, groups) guiSetText(serialLabel, "Serial: "..serial) guiSetText(IPLabel, "IP: "..ip) guiSetText(accountLabel, "Cuenta: "..account) guiSetText(aclLabel, "Derechos en ACL: "..table["groups"]) end addEvent("getData", true) addEventHandler("getData", root, obtenerIPSerialPing) Server: function obtenerdatos(source, name) local player = getPlayerFromName(name) local serial = getPlayerSerial(player) local IP = getPlayerIP (player) local playerAcc = getPlayerAccount(player) local account = getAccountName(playerAcc) local groups = aclGetAccountGroups(playerAcc) triggerClientEvent(source, "getData", source, serial, IP, account, groups) end addEvent("datos", true) addEventHandler("datos", root, obtenerdatos) My error on debugscript 3: ERROR: adminPanel\panel.lua:294: attempt to concatenate field 'groups'(a nil value) I want that set text with the acl like the admin panel 'p' -> Groups: Admin, Everyone, etc Can anybody help me? Thanks in advance. Edited April 20, 2013 by Guest Link to comment
iPrestege Posted April 20, 2013 Share Posted April 20, 2013 And aclGetAccountGroups = ? Link to comment
DNL291 Posted April 20, 2013 Share Posted April 20, 2013 aclGetAccountGroups function doesn't exist. https://wiki.multitheftauto.com/wiki/Se ... _functions Link to comment
Sasu Posted April 20, 2013 Author Share Posted April 20, 2013 aclGetAccountGroups function doesn't exist.https://wiki.multitheftauto.com/wiki/Se ... _functions function aclGetAccountGroups ( account ) local acc = getAccountName ( account ) if ( not acc ) then return false end local res = {} acc = "user."..acc local all = "user.*" for ig, group in ipairs ( aclGroupList() ) do for io, object in ipairs ( aclGroupListObjects ( group ) ) do if ( ( acc == object ) or ( all == object ) ) then table.insert ( res, aclGroupGetName ( group ) ) break end end end return res end Link to comment
DNL291 Posted April 20, 2013 Share Posted April 20, 2013 aclGetAccountGroups function doesn't exist.https://wiki.multitheftauto.com/wiki/Se ... _functions function aclGetAccountGroups ( account ) local acc = getAccountName ( account ) if ( not acc ) then return false end local res = {} acc = "user."..acc local all = "user.*" for ig, group in ipairs ( aclGroupList() ) do for io, object in ipairs ( aclGroupListObjects ( group ) ) do if ( ( acc == object ) or ( all == object ) ) then table.insert ( res, aclGroupGetName ( group ) ) break end end end return res end Ok, I could not see where the function was created. Link to comment
Sasu Posted April 20, 2013 Author Share Posted April 20, 2013 aclGetAccountGroups function doesn't exist.https://wiki.multitheftauto.com/wiki/Se ... _functions function aclGetAccountGroups ( account ) local acc = getAccountName ( account ) if ( not acc ) then return false end local res = {} acc = "user."..acc local all = "user.*" for ig, group in ipairs ( aclGroupList() ) do for io, object in ipairs ( aclGroupListObjects ( group ) ) do if ( ( acc == object ) or ( all == object ) ) then table.insert ( res, aclGroupGetName ( group ) ) break end end end return res end Ok, I could not see where the function was created. And can you help me? Link to comment
DNL291 Posted April 20, 2013 Share Posted April 20, 2013 Try this: guiSetText(aclLabel, "Derechos en ACL: "..table["groups"] or "None") Is really difficult to know where the problem is because the code isn't full. Link to comment
Sasu Posted April 20, 2013 Author Share Posted April 20, 2013 The same problem. Client: aclLabel = guiCreateLabel(17, 87, 274, 15, "Derechos en ACL: N/A", false, tabPanelInfo1) addEventHandler("onClientGUIClick", root, function () if source == listaPlayers then local row,column = guiGridListGetSelectedItem(listaPlayers) if row == -1 then return end if row then getPlayerData(playerName) end end end ) function obtenerIPSerialPing(serial, ip, account, groups) guiSetText(serialLabel, "Serial: "..serial) guiSetText(IPLabel, "IP: "..ip) guiSetText(accountLabel, "Cuenta: "..account) guiSetText(aclLabel, "Derechos en ACL: "..table["groups"] or "None") end addEvent("getData", true) addEventHandler("getData", root, obtenerIPSerialPing) function getPlayerData(name) triggerServerEvent("datos", root, localPlayer, name) end Server: function aclGetAccountGroups ( account ) local acc = getAccountName ( account ) if ( not acc ) then return false end local res = {} acc = "user."..acc local all = "user.*" for ig, group in ipairs ( aclGroupList() ) do for io, object in ipairs ( aclGroupListObjects ( group ) ) do if ( ( acc == object ) or ( all == object ) ) then table.insert ( res, aclGroupGetName ( group ) ) break end end end return res end function obtenerdatos(source, name) local player = getPlayerFromName(name) local serial = getPlayerSerial(player) local IP = getPlayerIP (player) local playerAcc = getPlayerAccount(player) local account = getAccountName(playerAcc) local groups = aclGetAccountGroups(playerAcc) triggerClientEvent(source, "getData", source, serial, IP, account, groups) end addEvent("datos", true) addEventHandler("datos", root, obtenerdatos) Link to comment
DNL291 Posted April 20, 2013 Share Posted April 20, 2013 Try this: guiSetText(aclLabel, "Derechos en ACL: "..table["groups"] or "None") My bad. local groups = table["groups"] or "None" guiSetText(aclLabel, "Derechos en ACL: "..groups) Link to comment
Sasu Posted April 21, 2013 Author Share Posted April 21, 2013 It set "None" when I am admin. Why? Link to comment
Castillo Posted April 21, 2013 Share Posted April 21, 2013 @DNL291: Where's "table" defined? @Sasuke: Try this: function obtenerIPSerialPing ( serial, ip, account, groups ) guiSetText ( serialLabel, "Serial: ".. serial ) guiSetText ( IPLabel, "IP: ".. ip ) guiSetText ( accountLabel, "Cuenta: ".. account ) guiSetText ( aclLabel, "Derechos en ACL: ".. table.concat ( groups, ", " ) ) end addEvent ( "getData", true ) addEventHandler ( "getData", root, obtenerIPSerialPing ) Link to comment
Sasu Posted April 21, 2013 Author Share Posted April 21, 2013 ERROR: adminPanel\panel.lua:313: bad argument #1 to 'concat' (table expected, got string) Link to comment
DNL291 Posted April 21, 2013 Share Posted April 21, 2013 @DNL291: Where's "table" defined? 'table' is defined in Sasuke's code. If he had not set, he would have an error in debug. You can see that he is using 'table' in the first post. It set "None" when I am admin. Why? 'table' or 'groups' is returning nil. Make sure that the table is defined. Link to comment
Castillo Posted April 21, 2013 Share Posted April 21, 2013 ERROR: adminPanel\panel.lua:313: bad argument #1 to 'concat' (table expected, got string) Works fine here, so the problem must be somewhere else on your script. My test script: addCommandHandler ( "groups", function ( p ) outputChatBox ( table.concat ( aclGetAccountGroups ( getPlayerAccount ( p ) ), ", " ) ) end ) function aclGetAccountGroups ( account ) local acc = getAccountName ( account ) if ( not acc ) then return false end local res = {} acc = "user."..acc local all = "user.*" for ig, group in ipairs ( aclGroupList() ) do for io, object in ipairs ( aclGroupListObjects ( group ) ) do if ( ( acc == object ) or ( all == object ) ) then table.insert ( res, aclGroupGetName ( group ) ) break end end end return res end Link to comment
Sasu Posted April 21, 2013 Author Share Posted April 21, 2013 It was happening that the triggerClientEvent was wrong. Arguments in client function function obtenerIPSerialPing ( serial, ip, account, groups ) Arguments passed that I had triggerClientEvent(source, "getData", source, name, serial, IP, account, groups) So I deleted 'name' and now works . Stupid error . Thank you very much solid. 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