Jump to content

get texture Name from ID ?


pcisoft

Recommended Posts

Posted
Hello!

Please, is there any way to retrieve the Texture name of a skin or car by it's ID ?

Regards :)

try this untested i'm using the phone.

function getTextureNameFromID(model) 
    if model and tonumber(model) then 
        for k, v in ipairs(engineGetModelTextureNames(model)) do 
            return v 
        end 
    end  
end 

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted
Hello!

Please, is there any way to retrieve the Texture name of a skin or car by it's ID ?

Regards :)

try this untested i'm using the phone.

function getTextureNameFromID(model) 
    if model and tonumber(model) then 
        for k, v in ipairs(engineGetModelTextureNames(model)) do 
            return v 
        end 
    end  
end 

Thanks, but is there a way to reverse the function and get an ID from Texture ?

Regards.

[CAG]PcIsOft

Posted

Please note, this will not work for world models (There might be a way but I'm unsure of it.)

Also, it's untested. So I'm not sure if it will actually work..

     
    function getModelsWithTexture(texture) 
    local theTable = {} 
        for _,v in pairs(getElementsByType("object")) do 
            for _, va in ipairs(engineGetModelTextureNames(v)) do 
                if texture == va then 
                table.insert(theTable,v) 
                end 
            end 
        end 
          return theTable 
    end 
     

usage --

local models =  getModelsWithTexture(texture) 
  

returns a table with all of the models.

Wolf Inc Discord

Youtube channel
Github

Posted

@CodyL , He need skins and cars and you are using getElementsByType("object") ???

472bd65096.png

Hello!

Please, is there any way to retrieve the Texture name of a skin or car by it's ID ?

Regards :)

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted

For peds --

      
SkinIDs = {0, 1, 2, 7, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 57, 58, 59, 60, 61, 62, 66, 67, 68, 70, 71, 72, 73, 78, 79, 80, 81, 82, 83, 84, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 120, 121, 122, 123, 124, 125, 126, 127, 128, 132, 133, 134, 135, 136, 137, 142, 143, 144, 146, 147, 153, 154, 155, 156, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 170, 171, 173, 174, 175, 176, 177, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 200, 202, 203, 204, 206, 209, 210, 212, 213, 217, 220, 221, 222, 223, 227, 228, 229, 230, 234, 235, 236, 239, 240, 241, 242, 247, 248, 249, 250, 252, 253, 254, 255, 258, 259, 260, 261, 262, 264, 265, 266, 267, 268, 269, 270, 271, 272, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 290, 291, 292, 293, 294, 295, 296, 297, 299, 300, 301, 302, 303, 305, 306, 307, 308, 309, 310, 311, 312,9, 10, 11, 12, 13, 31, 38, 39, 40, 41, 53, 54, 55, 56, 63, 64, 69, 75, 76, 77, 85, 87, 88, 89, 90, 91, 92, 93, 129, 130, 131, 138, 139, 140, 141, 145, 148, 150, 151, 152, 157, 169, 172, 178, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 201, 205, 207, 211, 214, 215, 216, 218, 219, 224, 225, 226, 231, 232, 233, 237, 238, 243, 244, 245, 246, 251, 256, 257, 263, 298, 304} 
  
        function getSkinWithTexture(texture) 
        local theTable = {} 
            for _,v in pairs(SkinIDs) do 
                for _, va in pairs(engineGetModelTextureNames(v)) do 
                    if texture == va then 
                    table.insert(theTable,v) 
                    end 
                end 
            end 
              return theTable 
        end 
         

for vehicles --

      
vehicleIDS = { 
    602, 545, 496, 517, 401, 410, 518, 600, 527, 436, 589, 580, 419, 439, 533, 549, 526, 491, 474, 445, 467, 604, 426, 507, 547, 585, 405, 587, 
    409, 466, 550, 492, 566, 546, 540, 551, 421, 516, 529, 592, 553, 577, 488, 511, 497, 548, 563, 512, 476, 593, 447, 425, 519, 520, 460, 417, 
    469, 487, 513, 581, 510, 509, 522, 481, 461, 462, 448, 521, 468, 463, 586, 472, 473, 493, 595, 484, 430, 453, 452, 446, 454, 485, 552, 431, 
    438, 437, 574, 420, 525, 408, 416, 596, 433, 597, 427, 599, 490, 432, 528, 601, 407, 428, 544, 523, 470, 598, 499, 588, 609, 403, 498, 514, 
    524, 423, 532, 414, 578, 443, 486, 515, 406, 531, 573, 456, 455, 459, 543, 422, 583, 482, 478, 605, 554, 530, 418, 572, 582, 413, 440, 536, 
    575, 534, 567, 535, 576, 412, 402, 542, 603, 475, 449, 537, 538, 570, 441, 464, 501, 465, 564, 568, 557, 424, 471, 504, 495, 457, 539, 483, 
    508, 571, 500, 444, 556, 429, 411, 541, 559, 415, 561, 480, 560, 562, 506, 565, 451, 434, 558, 494, 555, 502, 477, 503, 579, 400, 404, 489, 
    505, 479, 442, 458, 606, 607, 610, 590, 569, 611, 584, 608, 435, 450, 591, 594 
} 
  
        function getCarsWithTexture(texture) 
        local theTable = {} 
            for _,v in pairs(vehicleIDS) do 
                for _, va in pairs(engineGetModelTextureNames(v)) do 
                    if texture == va then 
                    table.insert(theTable,v) 
                    end 
                end 
            end 
              return theTable 
        end 
         

Both of those functions return a table with a list of Ids that contain that texture (May be a bit laggy)

Basicly it just runs through each ID, checks if it has that texture, if so adds it to table

Wolf Inc Discord

Youtube channel
Github

Posted (edited)

@CodyL, :o what are you doing are you serierus. you want to create more than 100 vehicle at the same time

Edited by Guest

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

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...