Charlekraft Posted June 25, 2017 Share Posted June 25, 2017 Hi, i've got a big problem for index, factionTable in ipairs ( factionDuty ) do -- Loop all the factions if isPlayerInFaction(targetPlayer, factionTable["factionID"]) then for index, factionPackage in ipairs ( factionTable["packages"] ) do -- Loop all the faction packages local found = false for index, packageColShape in ipairs ( factionPackage["colShape"] ) do -- Loop all the colshapes of the factionpackage if isElementWithinColShape( targetPlayer, packageColShape ) then found = true break -- We found this package already, no need to search the other colshapes end end if factionPackage.vehicle and getPedOccupiedVehicle( targetPlayer ) and factionPackage.vehicle[ getElementModel( getPedOccupiedVehicle( targetPlayer ) ) ] then found = true end if found and canPlayerUseDutyPackage(targetPlayer, factionPackage) then table.insert(availablePackages, factionPackage) end end end end I have this error :bad argument #1 to 'ipairs' (table excepted, got nil) Can you help me ? Thank's Link to comment
WorthlessCynomys Posted June 25, 2017 Share Posted June 25, 2017 I thik, factionTable is your table and factionDuty is the variable you want. Now... factionDuty is in ipairs() where factionTable should be. Your error message said that ipairs has a nil, not a table. Link to comment
Charlekraft Posted June 25, 2017 Author Share Posted June 25, 2017 (edited) Just now, StormFighter said: I thik, factionTable is your table and factionDuty is the variable you want. Now... factionDuty is in ipairs() where factionTable should be. Your error message said that ipairs has a nil, not a table. So i have to make factiontable in the ipairs ? I don't understand.. Edited June 25, 2017 by Charlekraft edit Link to comment
WorthlessCynomys Posted June 25, 2017 Share Posted June 25, 2017 You have to put the variable of the table in ipairs. Link to comment
Charlekraft Posted June 25, 2017 Author Share Posted June 25, 2017 Like this ? for index, in ipairs (factionTable(factionDuty)) do -- Loop all the factions Link to comment
WorthlessCynomys Posted June 25, 2017 Share Posted June 25, 2017 1 minute ago, Charlekraft said: -- IF factionTable is your table... for index, factionDuty in ipairs (factionTable) do -- Loop all the factions Link to comment
Charlekraft Posted June 25, 2017 Author Share Posted June 25, 2017 I've got the same error... 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