Postado Junho 17, 2018 6 anos Ola galera tenho esse script como talk, gostaria que funcionasse como ACTION. (Clicando no ITEM) Teria como alguém ajudar pf ? local colors = {94, 81, 79, 88, 18, 11, 92, 128} local storage = 65535 local time = 5 --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 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, "Rainbow Sempre Estara Ativado!") 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) 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<talkaction words="!rainbow" event="script" value="rainbow.lua"/>
Postado Junho 17, 2018 6 anos Em 17/06/2018 em 01:05, Jinx disse: Ola galera tenho esse script como talk, gostaria que funcionasse como ACTION. (Clicando no ITEM) Teria como alguém ajudar pf ? local colors = {94, 81, 79, 88, 18, 11, 92, 128} local storage = 65535 local time = 5 --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 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, "Rainbow Sempre Estara Ativado!") 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) 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<talkaction words="!rainbow" event="script" value="rainbow.lua"/> troque a funçao function onSay por function onUse e a tag <action actionid="id do item que vai usar" event="script" value="nome do arquivo.lua"/>
Postado Junho 20, 2018 6 anos Autor Em 17/06/2018 em 03:30, mullino disse: troque a funçao function onSay por function onUse e a tag <action actionid="id do item que vai usar" event="script" value="nome do arquivo.lua"/> NÃO FUNCIONOU ! AO CLICAR NO ITEM NÃO FUNCIONADA NADA E NÃO DA NENHUM ERRO NO CONSOLE.
Postado Julho 28, 2019 5 anos Mostrar conteúdo oculto local t = { colors = {94, 81, 79, 88, 18, 11, 92, 128}, -- cores time = 5, -- intervalo de troca das cores em milisegundos money_cost = 1000, -- custo storage = 65535 } function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerStorageValue(cid, t.storage) == -1 then if not doPlayerRemoveMoney(cid, t.money_cost) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You do not have enough money.") return true end setPlayerStorageValue(cid, t.storage, 1) rainbowOutfit(cid) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Rainbow outfit: ON") else setPlayerStorageValue(cid, t.storage, -1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Rainbow outfit: OFF") end return true end function rainbowOutfit(cid) if isPlayer(cid) then if getPlayerStorageValue(cid, t.storage) == 1 then local rand_outfit = { lookHead = t.colors[math.random(#t.colors)], lookLegs = t.colors[math.random(#t.colors)], lookBody = t.colors[math.random(#t.colors)], lookFeet = t.colors[math.random(#t.colors)] } local outfit = getCreatureOutfit(cid) for look, value in pairs(outfit) do local new_value = rand_outfit[look] if new_value then outfit[look] = new_value end end doCreatureChangeOutfit(cid, outfit) addEvent(rainbowOutfit, t.time, cid) end end end Tag no actions.xml: <action itemid="ID DO ITEM" script="NOME DO ARQUIVO.lua" /> Contato: Email: dwarfer@sapo.pt Discord: Dwarfer#2715
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.