Postado Fevereiro 18, 2015 10 anos sHOW! Gostei! Botei no meu servidor. Funfando 100% @edit Só faltou quando desligar o '!rainbow' ele voltar pra roupa que estava antes de ligar, e não parar em qualquer uma. Segue o código [não testei] local colors = {94, 81, 79, 88, 18, 11, 92, 128} local storage = 65535 local time = 10 --in miliseconds function onSay(cid, words, param, channel) if(param == "on") then if getPlayerStorageValue(cid, storage) < 1 then if doPlayerRemoveMoney(cid, 0) == TRUE then local outfit = getCreatureOutfit(cid) setPlayerStorageValue(cid, 65534, outfit.lookHead) setPlayerStorageValue(cid, 65533, outfit.lookLegs) setPlayerStorageValue(cid, 65532, outfit.lookBody) setPlayerStorageValue(cid, 65531, outfit.lookFeet) local event = addEvent(changeOutfit, time, cid) setPlayerStorageValue(cid, storage, 1) return TRUE else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You do not have enough money.") return TRUE end else return TRUE end elseif(param == "off") then if getPlayerStorageValue(cid, storage) > 0 then setPlayerStorageValue(cid, storage, 0) return TRUE else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You do not have rainbow outfit on.") return TRUE end else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Use !rainbow on-off.") return TRUE end return TRUE end function changeOutfit(cid) local randomHead = colors[math.random(#colors)] local randomLegs = colors[math.random(#colors)] local randomBody = colors[math.random(#colors)] local randomFeet = colors[math.random(#colors)] local tmp = {} if getPlayerStorageValue(cid, storage) > 0 then local outfit = getCreatureOutfit(cid) tmp = outfit tmp.lookType = outfit.lookType tmp.lookHead = randomHead tmp.lookLegs = randomLegs tmp.lookBody = randomBody tmp.lookFeet = randomFeet tmp.lookAddons = outfit.lookAddons doCreatureChangeOutfit(cid, tmp) local event = addEvent(repeatChangeOutfit, time, cid) return TRUE else stopEvent(event) outfit = getCreatureOutfit(cid) outfit.lookHead = getPlayerStorageValue(cid, 65534) outfit.lookLegs = getPlayerStorageValue(cid, 65533) outfit.lookBody = getPlayerStorageValue(cid, 65532) outfit.lookFeet = getPlayerStorageValue(cid, 65531) doCreatureChangeOutfit(cid, outfit) return TRUE end end function repeatChangeOutfit(cid) local randomHead = colors[math.random(#colors)] local randomLegs = colors[math.random(#colors)] local randomBody = colors[math.random(#colors)] local randomFeet = colors[math.random(#colors)] local tmp = {} if getPlayerStorageValue(cid, storage) > 0 then local outfit = getCreatureOutfit(cid) tmp = outfit tmp.lookType = outfit.lookType tmp.lookHead = randomHead tmp.lookLegs = randomLegs tmp.lookBody = randomBody tmp.lookFeet = randomFeet tmp.lookAddons = outfit.lookAddons doCreatureChangeOutfit(cid, tmp) local event = addEvent(changeOutfit, time, cid) return TRUE else stopEvent(event) return TRUE end end Azul : Salva as cores iniciais da outfit. Vermelho: Pega as cores salvas inicialmente e coloca no personagem. Editado Fevereiro 18, 2015 10 anos por david0703 (veja o histórico de edições) Atenciosamente, David Araujo Meu Conteúdo Fui útil? Gostou? Faça uma doação. "É errando que se erra." "Gambiarras resolvem instantemente, porém podem complicar em problemas futuros." "Cada dia vivido é um aprendizado."
Postado Fevereiro 19, 2015 10 anos Se o player desloga aparece isso : [19/02/2015 20:57:37] [Error - TalkAction Interface] [19/02/2015 20:57:37] In a timer event called from: [19/02/2015 20:57:37] data/talkactions/scripts/rainbow.lua:onSay [19/02/2015 20:57:37] Description: [19/02/2015 20:57:37] (luaGetCreatureStorage) Creature not found [19/02/2015 20:57:37] [Error - TalkAction Interface] [19/02/2015 20:57:37] In a timer event called from: [19/02/2015 20:57:37] data/talkactions/scripts/rainbow.lua:onSay [19/02/2015 20:57:37] Description: [19/02/2015 20:57:37] data/talkactions/scripts/rainbow.lua:43: attempt to compare number with boolean [19/02/2015 20:57:38] stack traceback: [19/02/2015 20:57:38] data/talkactions/scripts/rainbow.lua:43: in function <data/talkactions/scripts/rainbow.lua:35> tem como arrumar? :v rep+ pelo trabalho
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.