• 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!

Trying to Scripting:

Derlexy

Intermediate OT User
Joined
Jun 29, 2011
Messages
219
Reaction score
101
I'm trying to do this script, but it isn't work, and i got this warning idk why:
Sem%20tiacutetulo_zpsgmlfhqbe.png

Can someone help me? =P
 
Code:
local Voc = getPlayerVocation(player)
    for k in pairs(outfits) do
        if k == Voc then
            player:addOutfit(outfits[k].male)
            player:addOutfit(outfits[k].female)
            if player:getSex() == 0 then
                player:setOutfit(outfits[k].female
            else
                player:setOutfit(outfits[k].male)
            end
        else
            player:removeOutfit(outfits[k].male)
            player:removeOutfit(outfits[k].female)
        end
    end
 
Code:
local Voc = getPlayerVocation(player)
    for k in pairs(outfits) do
        if k == Voc then
            player:addOutfit(outfits[k].male)
            player:addOutfit(outfits[k].female)
            if player:getSex() == 0 then
                player:setOutfit(outfits[k].female
            else
                player:setOutfit(outfits[k].male)
            end
        else
            player:removeOutfit(outfits[k].male)
            player:removeOutfit(outfits[k].female)
        end
    end

Ty dude. Now i understand how it works =P
Thank you...
 
Also, next time post the script instead of a picture, it's easier and would save some time.
Ofc, my bad =P I will do it next time.
Just one more thing here: I'm using TFS 1.1, did you know if exists some function to set the player outfit to the outfit i've added him? This player:setOutfit() doesnt work and i dont know why =/
 
Ofc, my bad =P I will do it next time.
Just one more thing here: I'm using TFS 1.1, did you know if exists some function to set the player outfit to the outfit i've added him? This player:setOutfit() doesnt work and i dont know why =/
errors?
 
Code:
player:setOutfit({lookType = outfits[k].male})
Okey, that works...
Now, did you know how can i do to take the looktype colors from the database?
I want to fill this table with the lookhead, lookbody, looklegs and lookfeet that are database fields in player table:
Code:
local Colors = {
        head = 0,
        body = 0,
        legs = 0,
        feet = 0
    }
 
Uh, you want the players to have colors you specify?
Forget, i got it! This is the Script:
Code:
-- Vocation Outfits:
local outfits = {
    [110] = {male = 131, female = 139}, -- Human Warrior: Knight Outfit.
    [120] = {male = 130, female = 138}, -- Human Magician: Mage Outfit.
    [130] = {male = 129, female = 137}, -- Human Ranger: Hunter Outfit.
    [210] = {male = 7, female = 7},     -- Orc Warrior: Orc Warrior Outfit.
    [220] = {male = 5, female = 5},     -- Orc Magician: Orc Outfit.
    [230] = {male = 50, female = 50},   -- Orc Hunter: Orc Spearman Outfit.
    [310] = {male = 62, female = 62},   -- Elf Warrior: Elf Outfit.
    [320] = {male = 62, female = 62},   -- Elf Magician: Elf Outfit.
    [330] = {male = 62, female = 62},   -- Elf Ranger: Elf Outfit.
    [410] = {male = 71, female = 71},   -- Dwarf Warrior: Dwarf Soldier Outfit.
    [420] = {male = 69, female = 69},   -- Dwarf Magician: Dwarf Outfit.
    [430] = {male = 69, female = 69}    -- Dwarf Magician: Dwarf Outfit.
}

    local Voc = getPlayerVocation(player)
    local Sex = player:getSex()
    local Outfit = player:getOutfit()
    local Colors = {
        head = Outfit.lookHead,
        body = Outfit.lookBody,
        legs = Outfit.lookLegs,
        feet = Outfit.lookFeet
    }
    for i in pairs(outfits) do
        if i == Voc then
            player:addOutfit(outfits[i].male)
            player:addOutfit(outfits[i].female)
            if Sex == 1 then -- If player are Male:
                player:setOutfit({lookType = outfits[i].male, lookHead = Colors.head, lookBody = Colors.body, lookLegs = Colors.legs, lookFeet = Colors.feet})
            elseif Sex == 0 then -- If player are Female:
                player:setOutfit({lookType = outfits[i].female, lookHead = Colors.head, lookBody = Colors.body, lookLegs = Colors.legs, lookFeet = Colors.feet})
            end
        elseif i ~= Voc then
            player:removeOutfit(outfits[i].male)
            player:removeOutfit(outfits[i].female)
        end
    end
    --

Thank you very much dude!!! You help me a lot *-*
 
Back
Top