• 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 Outfit Color Change BLOCK - TFS 1.x

HeberPcL

[PowerOT.com.br]
Joined
Aug 21, 2007
Messages
1,292
Reaction score
51
Location
Brazil
GitHub
heberpcl
Code:
function Creature:onChangeOutfit(outfit)
    local old = self:getOutfit()
    if ( (old.lookHead ~= outfit.lookHead) or (old.lookBody ~= outfit.lookBody) or (old.lookLegs ~= outfit.lookLegs) or (old.lookFeet ~= outfit.lookFeet) ) then
        self:sendCancelMessage("You cannot change your outfit color.")
        return FALSE
    end
   return true
end
 
Last edited:
Code:
function Creature:onChangeOutfit(outfit)
    local old = self:getOutfit()
    if ( (old.lookHead ~= outfit.lookHead) or (old.lookBody ~= outfit.lookBody) or (old.lookLegs ~= outfit.lookLegs) or (old.lookFeet ~= outfit.lookFeet) ) then
        self:sendCancelMessage("You cannot change your outfit color.")
        return FALSE
    end
   return true
end
should check if self is player incase you send cancel messages to creatures that change outfits ;)
 
I don't really remember how onChangeOutfit works, but why don't you just update the new outfit with the old colors instead of returning false?
 
cause that's pointless if you can just return false ._.
It doesn't really matter if you return false, it will only stop the player from updating the "client view" of the new outfit, but as long as you reconnect or something you'll see the changes, since the defaultOutfit is changed no matter what of the return is.
1ffb9d846a.png
 
Back
Top