Ir para conteúdo

TFS 1.X Rainbow Outfit


Marco Oliveira

Posts Recomendados

Em talkactions/talkactions.xml:

<talkaction words="!rainbow" separator=" " script="rainbowoutfit.lua"/>

Em talkactions/scripts crie um arquivo chamado rainbowoutfit.lua dentro dele coloque:

function onSay(player, words, param)
    if param == 'on' or param == 'ON' then
        player:setStorageValue(8178237, 1)
        player:sendCancelMessage("rainbow outfit is actived.")
    elseif param == 'off' or param == 'OFF' then
        player:setStorageValue(8178237, 0)
        player:sendCancelMessage("rainbow outfit is disabled.")
    else
        player:sendCancelMessage("wrong parameter, use on or off.")
    end
    return false
end

Em globalevents/globalevents.xml:

<globalevent name="Rainbow" interval="500" script="others/rainbow_outfit.lua"/>

Em globalevents/scripts/others crie um arquivo chamado rainbow_outfit.lua:

function onThink(interval)
    for _, player in ipairs(Game.getPlayers()) do
        if player:getStorageValue(8178237) == 1 then -- here is the storage to check if is "on" or "off"
            local outfit = player:getOutfit()
            outfit.lookHead = math.random(0, 132)
            outfit.lookBody = math.random(0, 132)
            outfit.lookLegs = math.random(0, 132)
            outfit.lookFeet = math.random(0, 132)
            player:setOutfit(outfit)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
        end
    end
    return true
end
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...