DRW Posted April 4, 2016 Share Posted April 4, 2016 So I'm using Castillo's Gang System (https://community.multitheftauto.com/?p ... ls&id=1514) and this script has an export called "getGangMembers" which is supposed to return a table. I need that, so I made a command which is this: addCommandHandler ("getmembers",function(player,cmd,gang,sgang) for i,gangmembers in ipairs (exports.gang_system:getGangMembers (gang.." "..sgang)) do for i,members in pairs (gangmembers) do outputChatBox (members) end end end) When I use this command along with the gang name, well, it outputs three chat messages, which means each member has a table part with three parameters: 1,2 and 3. Every parameter is printed to the chatbox. I only want the script to select the third parameter only and ignore the first two. So, instead of printing to the chatbox: 1,2 and 3 it'll have to print the third parameter only. Tried using this: addCommandHandler ("getmembers",function(player,cmd,gang,sgang) for i,gangmembers in ipairs (exports.gang_system:getGangMembers (gang.." "..sgang)) do for i,members in pairs (gangmembers) do outputChatBox (members[3]) -- Added the [3] here, but either [1] or [2] don't work end end end) Also tried to use ipairs instead of pairs but it didn't work either. ¿What should I do? Link to comment
KariiiM Posted April 6, 2016 Share Posted April 6, 2016 addCommandHandler ("getmembers", function(player,cmd,...) -- type /getmembers for index, members in pairs(exports.gang_system:getGangMembers(table.concat({...}," "))) do if members[3] then outputChatBox(members[3],player) end end end) Link to comment
KariiiM Posted April 6, 2016 Share Posted April 6, 2016 addCommandHandler ("getmembers", function(player,cmd,...) -- type /getmembers for index, members in pairs(exports.gang_system:getGangMembers(table.concat({...}," "))) do if members[3] then outputChatBox(members[3],player) end end end) 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