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

Lua Only Colors [TFS 0.4]

ausirosiris

New Member
Joined
May 23, 2020
Messages
57
Reaction score
2
Guys, i have this script for team war but, i only need to change the COLORS because i'm using another script to set the outfit per vocation.

can't figure how to make it... (maybe i'm stupid)


Code:
local t = {
    red = {x = 1035, y = 1077, z = 6},
    blue = {x = 1102, y = 1036, z = 6}
}

local outfit = {
    red = {lookType = 135, lookHead = 132, lookBody = 132, lookLegs = 132, lookFeet = 132},
    blue = {lookType = 135, lookHead = 126, lookBody = 126, lookLegs = 126, lookFeet = 126}
}

function onLogin(cid)
local R = math.random(1,2)
    if R <=  1 then
        doTeleportThing(cid, t.red)
            doCreatureChangeOutfit(cid, outfit.red)
                doPlayerFeed(cid, 100000)
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You were sent to fight for the Red Team!")

 elseif R <= 2 then
    doTeleportThing(cid, t.blue)
        doCreatureChangeOutfit(cid, outfit.blue)
            doPlayerFeed(cid, 100000)
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You were sent to fight for the Blue Team!")

end
    return true
        end
 
I'm not sure about the getOutfit() function on your server version, but you can try:

Lua:
local t = {
    red = {x = 1035, y = 1077, z = 6},
    blue = {x = 1102, y = 1036, z = 6}
}

local colors = {
    red = {lookHead = 132, lookBody = 132, lookLegs = 132, lookFeet = 132},
    blue = {lookHead = 126, lookBody = 126, lookLegs = 126, lookFeet = 126}
}

function onLogin(cid)
    local R = math.random(1, 2)
    local player = Player(cid)
    if not player then
        return false
    end

    local currentOutfit = player:getOutfit()
    local newOutfit = {}

    if R <= 1 then
        doTeleportThing(cid, t.red, true)
        newOutfit = {lookType = currentOutfit.lookType, lookHead = colors.red.lookHead, lookBody = colors.red.lookBody, lookLegs = colors.red.lookLegs, lookFeet = colors.red.lookFeet}
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You were sent to fight for the Red Team!")
    else
        doTeleportThing(cid, t.blue, true)
        newOutfit = {lookType = currentOutfit.lookType, lookHead = colors.blue.lookHead, lookBody = colors.blue.lookBody, lookLegs = colors.blue.lookLegs, lookFeet = colors.blue.lookFeet}
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You were sent to fight for the Blue Team!")
    end

    doCreatureChangeOutfit(cid, newOutfit)
    doPlayerFeed(cid, 100000)

    return true
end

Although I think it would be better for you to adapt the other script you are using to define the outfit to also define the colors.
 
Last edited:
I'm not sure about the getOutfit() function on your server version, but you can try:

Lua:
local t = {
    red = {x = 1035, y = 1077, z = 6},
    blue = {x = 1102, y = 1036, z = 6}
}

local colors = {
    red = {lookHead = 132, lookBody = 132, lookLegs = 132, lookFeet = 132},
    blue = {lookHead = 126, lookBody = 126, lookLegs = 126, lookFeet = 126}
}

function onLogin(cid)
    local R = math.random(1, 2)
    local player = Player(cid)
    if not player then
        return false
    end

    local currentOutfit = player:getOutfit()
    local newOutfit = {}

    if R <= 1 then
        doTeleportThing(cid, t.red, true)
        newOutfit = {lookType = currentOutfit.lookType, lookHead = colors.red.lookHead, lookBody = colors.red.lookBody, lookLegs = colors.red.lookLegs, lookFeet = colors.red.lookFeet}
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You were sent to fight for the Red Team!")
    else
        doTeleportThing(cid, t.blue, true)
        newOutfit = {lookType = currentOutfit.lookType, lookHead = colors.blue.lookHead, lookBody = colors.blue.lookBody, lookLegs = colors.blue.lookLegs, lookFeet = colors.blue.lookFeet}
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You were sent to fight for the Blue Team!")
    end

    doCreatureChangeOutfit(cid, newOutfit)
    doPlayerFeed(cid, 100000)

    return true
end

Although I think it would be better for you to adapt the other script you are using to define the outfit to also define the colors.
I'm not sure about the getOutfit() function on your server version, but you can try:

Lua:
local t = {
    red = {x = 1035, y = 1077, z = 6},
    blue = {x = 1102, y = 1036, z = 6}
}

local colors = {
    red = {lookHead = 132, lookBody = 132, lookLegs = 132, lookFeet = 132},
    blue = {lookHead = 126, lookBody = 126, lookLegs = 126, lookFeet = 126}
}

function onLogin(cid)
    local R = math.random(1, 2)
    local player = Player(cid)
    if not player then
        return false
    end

    local currentOutfit = player:getOutfit()
    local newOutfit = {}

    if R <= 1 then
        doTeleportThing(cid, t.red, true)
        newOutfit = {lookType = currentOutfit.lookType, lookHead = colors.red.lookHead, lookBody = colors.red.lookBody, lookLegs = colors.red.lookLegs, lookFeet = colors.red.lookFeet}
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You were sent to fight for the Red Team!")
    else
        doTeleportThing(cid, t.blue, true)
        newOutfit = {lookType = currentOutfit.lookType, lookHead = colors.blue.lookHead, lookBody = colors.blue.lookBody, lookLegs = colors.blue.lookLegs, lookFeet = colors.blue.lookFeet}
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You were sent to fight for the Blue Team!")
    end

    doCreatureChangeOutfit(cid, newOutfit)
    doPlayerFeed(cid, 100000)

    return true
end

Although I think it would be better for you to adapt the other script you are using to define the outfit to also define the colors.
thanks for answering. yeah, i tried to merge both but one version ended up not working and the other one was only changing the outfit but kept the colors white. ill continue experiments. not a big deal! thanks
 
Back
Top