Sasu Posted April 20, 2013 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 State: Inactive
DNL291 Posted April 20, 2013 Posted April 20, 2013 aclGetAccountGroups function doesn't exist. https://wiki.multitheftauto.com/wiki/Se ... _functions Please do not PM me with scripting related question nor support, use the forums instead.
Sasu Posted April 20, 2013 Author 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 State: Inactive
DNL291 Posted April 20, 2013 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. Please do not PM me with scripting related question nor support, use the forums instead.
Sasu Posted April 20, 2013 Author 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? State: Inactive
DNL291 Posted April 20, 2013 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. Please do not PM me with scripting related question nor support, use the forums instead.
Sasu Posted April 20, 2013 Author 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) State: Inactive
DNL291 Posted April 20, 2013 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) Please do not PM me with scripting related question nor support, use the forums instead.
Sasu Posted April 21, 2013 Author Posted April 21, 2013 It set "None" when I am admin. Why? State: Inactive
Castillo Posted April 21, 2013 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 ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Sasu Posted April 21, 2013 Author Posted April 21, 2013 ERROR: adminPanel\panel.lua:313: bad argument #1 to 'concat' (table expected, got string) State: Inactive
DNL291 Posted April 21, 2013 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. Please do not PM me with scripting related question nor support, use the forums instead.
Castillo Posted April 21, 2013 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 San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Sasu Posted April 21, 2013 Author 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. State: Inactive
Castillo Posted April 21, 2013 Posted April 21, 2013 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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