Jump to content

[HELP] Table with all clothes CJ


[M]ister

Recommended Posts

In that case this could do the trick.

local clothesCJ = {[0]= 67,[1]=32,[2]=44,[3]=37,[4]=2,[5]=3,[6]=3,[7]=3,[8]=6,[9]=5,[10]=6,[11]=6,[12]=5,[13]=11,[14]=11,[15]=16,[16]=56,[17]=8} 
  
function getRandomClothes(clothesType) 
    if (not clothesType) or (type(clothesType) ~= "number") or (not clothesCJ[clothesType]) then outputDebugString("Error in syntax!", 2) return false end 
    math.randomseed(getTickCount()) 
    return math.random(0, clothesCJ[clothesType]) 
end 

Link to comment
  • Moderators

You can try something like this.

  
local myTable = {} 
  
for clothesType=0, 17 do 
    local newTable = {} 
    for clothesIndex=0,1000 do -- in case if there are 1001… 
        local clothesTexture,model = getClothesByTypeIndex (clothesType, clothesIndex ) 
        if clothesTexture and model then 
            newTable[clothesIndex]={["clothesTexture"]=clothesTexture,["model"]=model} 
        else 
            break 
        end 
    end 
    myTable[clothesType]= newTable 
end 

  
local clothesTexture = myTable[0][0]["clothesTexture"] 
local model = myTable[0][0]["model"] 
  

It is better to buffer the table first, but I am to lazy to do that.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...