xmaster0 3 Postado Janeiro 24, 2014 Share Postado Janeiro 24, 2014 Pessoas, o char do xtibia (Wuva) me fez um script, o script basicamente é assim: Você pisa no chão e ele te manda um som, eu usei esse system: http://www.xtibia.com/forum/topic/206472-sistema-de-som-para-pda-com-barra-de-cooldown/ bem, mas um bug que ocorre: toda vez que eu player andar sobre o piso que eu escolhi pra mandar o som, vai sempre mandar o som toda vez toda vez.... e vai ficar um som doido, tem alguma forma de o script verificar se o som ja está sendo executado... e não mandar o som o script que ele fez foi esse: local config = { soundName = "sounds/Centralplains.wav", tileId = 103, storage = 55000, } function onStepIn(cid, item, pos, fromPos) if not isPlayer(cid) then return true end if getPlayerStorageValue(cid, config.storage) < 1 then doPlayerSendTextMessage(cid, 26, config.soundName) setPlayerStorageValue(cid,config.storage,1) end end function onStepOut(cid, item, position, fromPosition) if not isPlayer(cid) then return true end if getPlayerStorageValue(cid, config.storage) == 1 and getTileItemById(position, config.tileId).uid <= 0 then setPlayerStorageValue(cid, config.storage, -1) end end , e quebrando o mito de que só se pode criar esse script usando coordenadas, ou action e unick id's no remeres... Link para o comentário https://xtibia.com/forum/topic/227773-configurar-script-sound-system/ Compartilhar em outros sites More sharing options...
Wuv4 9 Postado Janeiro 24, 2014 Share Postado Janeiro 24, 2014 (editado) local config = { soundName = "sounds/Centralplains.wav", tileId = 103, storage = 55000, musicTime = 118, --em segundos musicTimeStorage = 91821 } function onStepIn(cid, item, frompos, item2, topos) if not isPlayer(cid) then return true end if getPlayerStorageValue(cid, config.storage) < 1 then if getPlayerStorageValue(cid, config.musicTimeStorage) > os.time() then return setPlayerStorageValue(cid,config.storage,1) else doPlayerSendTextMessage(cid, 26, config.soundName) setPlayerStorageValue(cid, config.storage, 1) setPlayerStorageValue(cid, config.musicTimeStorage, os.time() + config.musicTime) end end end function onStepOut(cid, item, frompos, item2, topos) if not isPlayer(cid) then return true end if getPlayerStorageValue(cid, config.storage) == 1 and item2.itemId ~= config.tileId then setPlayerStorageValue(cid, config.storage, -1) end end Editado Janeiro 25, 2014 por Wuva Link para o comentário https://xtibia.com/forum/topic/227773-configurar-script-sound-system/#findComment-1607587 Compartilhar em outros sites More sharing options...
xmaster0 3 Postado Janeiro 24, 2014 Autor Share Postado Janeiro 24, 2014 Não deu certo, varias musicas tocando ao mesmo tempo. -Não sei se vai ajudar, mas o tempo da musica é: 1:58 Link para o comentário https://xtibia.com/forum/topic/227773-configurar-script-sound-system/#findComment-1607612 Compartilhar em outros sites More sharing options...
zipter98 1102 Postado Janeiro 24, 2014 Share Postado Janeiro 24, 2014 (editado) Tenta: local config = { soundName = "sounds/Centralplains.wav", tileId = 103, storage = 55000, } function onStepIn(cid, item, pos, fromPos) if not isPlayer(cid) then return true end if getPlayerStorageValue(cid, config.storage) < 1 then if getPlayerStorageValue(cid, 91821) > os.time() then return setPlayerStorageValue(cid,config.storage,1) else doPlayerSendTextMessage(cid, 26, config.soundName) setPlayerStorageValue(cid, config.storage, 1) setPlayerStorageValue(cid, 91821, os.time() + 118) end end return true end function onStepOut(cid, item, position, fromPosition) if not isPlayer(cid) then return true end if getPlayerStorageValue(cid, config.storage) == 1 and getTileItemById(position, config.tileId).uid <= 0 then setPlayerStorageValue(cid, config.storage, -1) end return true end Editado Janeiro 24, 2014 por zipter98 Link para o comentário https://xtibia.com/forum/topic/227773-configurar-script-sound-system/#findComment-1607644 Compartilhar em outros sites More sharing options...
xmaster0 3 Postado Janeiro 24, 2014 Autor Share Postado Janeiro 24, 2014 Zipter98~~ deu esse erro \/ [24/01/2014 18:21:00] [Error - LuaScriptInterface::loadFile] data/movements/scripts/soundStep.lua:20: '<eof>' expected near 'end' [24/01/2014 18:21:00] [Warning - Event::loadScript] Cannot load script (data/movements/scripts/soundStep.lua) [24/01/2014 18:21:00] data/movements/scripts/soundStep.lua:20: '<eof>' expected near 'end' [24/01/2014 18:21:00] [Error - LuaScriptInterface::loadFile] data/movements/scripts/soundStep.lua:20: '<eof>' expected near 'end' [24/01/2014 18:21:00] [Warning - Event::loadScript] Cannot load script (data/movements/scripts/soundStep.lua) [24/01/2014 18:21:00] data/movements/scripts/soundStep.lua:20: '<eof>' expected near 'end' Link para o comentário https://xtibia.com/forum/topic/227773-configurar-script-sound-system/#findComment-1607667 Compartilhar em outros sites More sharing options...
zipter98 1102 Postado Janeiro 24, 2014 Share Postado Janeiro 24, 2014 Falta de atenção, rs. Já corrigi. Link para o comentário https://xtibia.com/forum/topic/227773-configurar-script-sound-system/#findComment-1607682 Compartilhar em outros sites More sharing options...
xmaster0 3 Postado Janeiro 24, 2014 Autor Share Postado Janeiro 24, 2014 ~~ Certo, a musica tocou quando eu andei sobre o piso, porém depois que à música terminou, retornei andar sobre piso, todavia a música não tocou... Link para o comentário https://xtibia.com/forum/topic/227773-configurar-script-sound-system/#findComment-1607697 Compartilhar em outros sites More sharing options...
Wuv4 9 Postado Janeiro 25, 2014 Share Postado Janeiro 25, 2014 (editado) local config = { soundName = "sounds/Centralplains.wav", tileId = 103, storage = 55000, musicTime = 118, --em segundos musicTimeStorage = 91821 } function onStepIn(cid, item, frompos, item2, topos) if not isPlayer(cid) then return true end if getPlayerStorageValue(cid, config.storage) < 1 then if getPlayerStorageValue(cid, config.musicTimeStorage) > os.time() then return setPlayerStorageValue(cid,config.storage,1) else doPlayerSendTextMessage(cid, 26, config.soundName) setPlayerStorageValue(cid, config.storage, 1) setPlayerStorageValue(cid, config.musicTimeStorage, os.time() + config.musicTime) end end end function onStepOut(cid, item, frompos, item2, topos) if not isPlayer(cid) then return true end if getPlayerStorageValue(cid, config.storage) == 1 and item2.itemId ~= config.tileId then setPlayerStorageValue(cid, config.storage, -1) end end Editado Janeiro 25, 2014 por Wuva NeTTriz reagiu a isso 1 Link para o comentário https://xtibia.com/forum/topic/227773-configurar-script-sound-system/#findComment-1608575 Compartilhar em outros sites More sharing options...
xmaster0 3 Postado Janeiro 26, 2014 Autor Share Postado Janeiro 26, 2014 Cara você é um gênio, deu certo, mas por exemplo, tocou a musica nesse piso, legal mas se o player pisar em outro piso que toca outra música, as duas musicas vão tocar ao mesmo tempo... tem como, pausar a musica que ta tocando e tocar outra do outro piso id do outro piso = 1009 Link para o comentário https://xtibia.com/forum/topic/227773-configurar-script-sound-system/#findComment-1608787 Compartilhar em outros sites More sharing options...
Nil Value 15 Postado Janeiro 26, 2014 Share Postado Janeiro 26, 2014 local config = { soundName = "sounds/Centralplains.wav", tileId = 103, storage = 55000, musicTime = 118, --em segundos musicTimeStorage = 91821 } function onStepIn(cid, item, frompos, item2, topos) if not isPlayer(cid) then return true end if getPlayerStorageValue(cid, config.storage) < 1 then if getPlayerStorageValue(cid, config.musicTimeStorage) > os.time() then return setPlayerStorageValue(cid,config.storage,1) else doPlayerSendTextMessage(cid, 26, config.soundName) setPlayerStorageValue(cid, config.storage, 1) setPlayerStorageValue(cid, config.musicTimeStorage, os.time() + config.musicTime) end end end function onStepOut(cid, item, frompos, item2, topos) if not isPlayer(cid) then return true end if getPlayerStorageValue(cid, config.storage) == 1 and item2.itemId ~= config.tileId then setPlayerStorageValue(cid, config.storage, -1) end end Ótimo codigo amigo irei utilizar. Link para o comentário https://xtibia.com/forum/topic/227773-configurar-script-sound-system/#findComment-1608788 Compartilhar em outros sites More sharing options...
Posts Recomendados