• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

[TFS 1.2][Talkaction] OUTFIT CHANGER /choutfit

Snavy

Bakasta
Senator
Joined
Apr 1, 2012
Messages
1,249
Solutions
71
Reaction score
621
Location
Hell
I was looking for outfit changing script on otland that was for TFS 1.2 But couldn't find any so I decided to edit /newtype script and make a better use of it.

Code:
<talkaction words="/choutfit" seperator=" " script="choutfit.lua"/>

Code:
local outfits = {
  1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
  24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
  47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
  70, 71, 72, 73, 74, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
  93, 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, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
  132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150,
  151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
  170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188,
  189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
  208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226,
  227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245,
  246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264,
  265, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283,
  284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301,
  303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321,
  322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340,
  341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359,
  360, 361, 362, 363, 364, 365}

function onSay(player, words, param)
   if not player:getGroup():getAccess() then
       return true
   end

  local Outfit_Choice = math.random( #outfits )
   if Outfit_Choice >= 0 and Outfit_Choice ~= 1 and Outfit_Choice ~= 135 and Outfit_Choice ~= 411 and Outfit_Choice ~= 415 and Outfit_Choice ~= 424 and (Outfit_Choice <= 160 or Outfit_Choice >= 192) and Outfit_Choice ~= 439 and Outfit_Choice ~= 440 and Outfit_Choice ~= 468 and Outfit_Choice ~= 469 and (Outfit_Choice < 474 or lookType > 485) and Outfit_Choice ~= 501 and Outfit_Choice ~= 518 and Outfit_Choice ~= 519 and Outfit_Choice ~= 520 and Outfit_Choice ~= 524 and Outfit_Choice ~= 525 and Outfit_Choice ~= 536 and Outfit_Choice ~= 543 and Outfit_Choice ~= 549 and Outfit_Choice ~= 576 and Outfit_Choice ~= 581 and Outfit_Choice ~= 582 and Outfit_Choice ~= 597 and Outfit_Choice ~= 616 and Outfit_Choice ~= 623 and Outfit_Choice ~= 625 and (Outfit_Choice <= 637 or Outfit_Choice >= 644) and (Outfit_Choice <= 644 or Outfit_Choice >= 647) and (Outfit_Choice <= 651 or Outfit_Choice >= 664) and Outfit_Choice <= 699 then
       local playerOutfit = player:getOutfit()

       playerOutfit.lookType = Outfit_Choice
       player:setOutfit(playerOutfit)
    player:getPosition():sendMagicEffect(35)
   else
       player:sendCancelMessage("A look type with that id does not exist.")
   end
   return false
end

NOTE: If you have a better way of doing this, let me know.
 
assuming you're using 8.6 tfs 1.2
Code:
local refuse = {0, 1, 135}

function onSay(player, words, param)
    if not player:getGroup():getAccess() then
        return true
    end
    local outfit = math.random(1, 367)
    if not isInArray(refuse) and (outfit < 161 and outfit > 191) then
        player:setOutfit({lookType = outfit})
        player:getPosition():sendMagicEffect(35)
    else
        player:sendCancelMessage("A look type with that id does not exist.")
    end
    return false
end
 
assuming you're using 8.6 tfs 1.2
Code:
local refuse = {0, 1}

function onSay(player, words, param)
    if not player:getGroup():getAccess() then
        return true
    end
    local outfit = math.random(1, 367)
    if not isInArray(refuse) and (outfit < 161 and outfit > 191) then
        player:setOutfit({lookType = outfit})
        player:getPosition():sendMagicEffect(35)
    else
        player:sendCancelMessage("A look type with that id does not exist.")
    end
    return false
end
fucken beat me too it damn
 
Code:
local outfitsRange = 367
local outfitsRefuse = {135, {161, 191}}

local function isInAltArray(array, value)
    for _, _value in pairs(array) do if type(_value) == "table" and value >= _value[1] and value <= _value[2] then return true elseif value == _value then return true end end
    return false
end

local function recursiveOutfitSearch()
    local outfit = math.random(2, outfitsRange)
    if isInAltArray(outfitsRefuse, outfit) then return recursiveOutfitSearch() end
    return outfit
end

function onSay(player, words, param)
    if not player:getGroup():getAccess() then
        return true
    end

    local outfit = player:getOutfit()
    outfit.lookType = recursiveOutfitSearch()
    player:setOutfit(outfit)
    player:getPosition():sendMagicEffect(CONST_ME_GROUNDSHAKER)
    return false
end
 
Code:
local outfitsRange = 367
local outfitsRefuse = {135, {161, 191}}

local function isInAltArray(array, value)
    for _, _value in pairs(array) do if type(_value) == "table" and value >= _value[1] and value <= _value[2] then return true elseif value == _value then return true end end
    return false
end

local function recursiveOutfitSearch()
    local outfit = math.random(2, outfitsRange)
    if isInAltArray(outfitsRefuse, outfit) then return recursiveOutfitSearch() end
    return outfit
end

function onSay(player, words, param)
    if not player:getGroup():getAccess() then
        return true
    end

    local outfit = player:getOutfit()
    outfit.lookType = recursiveOutfitSearch()
    player:setOutfit(outfit)
    player:getPosition():sendMagicEffect(CONST_ME_GROUNDSHAKER)
    return false
end

Code:
local outfitsRefuse = {135, {161, 191}}

local function isInAltArray(array, value)
    for i = 1, #array do
        if type(array[i]) == 'table' then
            return (value < array[i][1] and value > array[i][2])
        elseif array[i] == value then
            return true
        end
    end
end

local function outfitSearch()
    local outfit = math.random(2, 367)
    if not isInAltArray(outfitsRefuse, outfit) then
      return outfit
    end
    return outfitSearch()
end

function onSay(player, words, param)
    if not player:getGroup():getAccess() then
        return true
    end
    player:setOutfit({lookType = outfitSearch()})
    player:getPosition():sendMagicEffect(CONST_ME_GROUNDSHAKER)
    return false
end
please dont throw everything into 1 line
 
Last edited:
assuming you're using 8.6 tfs 1.2
Code:
local refuse = {0, 1, 135}

function onSay(player, words, param)
    if not player:getGroup():getAccess() then
        return true
    end
    local outfit = math.random(1, 367)
    if not isInArray(refuse) and (outfit < 161 and outfit > 191) then
        player:setOutfit({lookType = outfit})
        player:getPosition():sendMagicEffect(35)
    else
        player:sendCancelMessage("A look type with that id does not exist.")
    end
    return false
end

using 10.98 with TFS 1.(2)
 
Back
Top