Postado Março 6, 2015 10 anos Tente assim: Atualize seu script da bike por este e configure a id do item no início do script "bikeid": local t = {text='Mount, bike!', dtext='Demount, bike!', s=5700, speed = 9999} local bikeid = 1212 -- ITEMID da Bike local function BikeSpeedOn(cid, t) setPlayerStorageValue(cid, t.s, t.speed) doChangeSpeed(cid, -getCreatureSpeed(cid)) doChangeSpeed(cid, t.speed) end local function BikeSpeedOff(cid, t) setPlayerStorageValue(cid, t.s, -1) doRegainSpeed(cid) end function onUse(cid, item, fromPosition, itemEx, toPosition) local pos = getThingPos(cid) if getPlayerItemCount(cid, 12774) <= 0 then return doPlayerSendCancel(cid, "Você precisa ter a bike na sua bag.") end if getPlayerStorageValue(cid, 17001) >= 1 or getPlayerStorageValue(cid, 63215) >= 1 or getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 75846) >= 1 or getPlayerStorageValue(cid, 6598754) >= 1 or getPlayerStorageValue(cid, 6598755) >= 1 then return doPlayerSendCancel(cid, "You can't do that right now.") end if getPlayerStorageValue(cid, t.s) <= 0 then doRemoveItem(item.uid, 1) local create_action = doPlayerAddItem(cid, bikeid, 1) doItemSetAttribute(create_action, "aid", 12120) doSendMagicEffect(pos, 177) doCreatureSay(cid, t.text, 19) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'You have mounted in a bike.') BikeSpeedOn(cid, t) if getPlayerSex(cid) == 1 then doSetCreatureOutfit(cid, {lookType = 1951}, -1) else doSetCreatureOutfit(cid, {lookType = 1950}, -1) end else doRemoveItem(item.uid, 1) doPlayerAddItem(cid, bikeid, 1) doSendMagicEffect(pos, 177) doCreatureSay(cid, t.dtext, 19) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'You haven demouted of a bike.') BikeSpeedOff(cid, t) doRemoveCondition(cid, CONDITION_OUTFIT) end return true end Agora em movements.xml adicione a tag abaixo: <movevent type="RemoveItem" actionid="12120" event="script" value="bikesystem.lua"/> E agora o script bikesystem.lua: function onRemoveItem(item, tile, lastpos, cid) if isPlayer(cid) then return false end end Boa sorte. Editado Março 6, 2015 10 anos por Adriano SwaTT (veja o histórico de edições)
Postado Março 6, 2015 10 anos Autor Tente assim: Atualize seu script da bike por este e configure a id do item no início do script "bikeid": local t = {text='Mount, bike!', dtext='Demount, bike!', s=5700, speed = 9999} local bikeid = 1212 -- ITEMID da Bike local function BikeSpeedOn(cid, t) setPlayerStorageValue(cid, t.s, t.speed) doChangeSpeed(cid, -getCreatureSpeed(cid)) doChangeSpeed(cid, t.speed) end local function BikeSpeedOff(cid, t) setPlayerStorageValue(cid, t.s, -1) doRegainSpeed(cid) end function onUse(cid, item, fromPosition, itemEx, toPosition) local pos = getThingPos(cid) if getPlayerItemCount(cid, 12774) <= 0 then return doPlayerSendCancel(cid, "Você precisa ter a bike na sua bag.") end if getPlayerStorageValue(cid, 17001) >= 1 or getPlayerStorageValue(cid, 63215) >= 1 or getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 75846) >= 1 or getPlayerStorageValue(cid, 6598754) >= 1 or getPlayerStorageValue(cid, 6598755) >= 1 then return doPlayerSendCancel(cid, "You can't do that right now.") end if getPlayerStorageValue(cid, t.s) <= 0 then doRemoveItem(item.uid, 1) local create_action = doPlayerAddItem(cid, bikeid, 1) doItemSetAttribute(create_action, "aid", 12120) doSendMagicEffect(pos, 177) doCreatureSay(cid, t.text, 19) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'You have mounted in a bike.') BikeSpeedOn(cid, t) if getPlayerSex(cid) == 1 then doSetCreatureOutfit(cid, {lookType = 1951}, -1) else doSetCreatureOutfit(cid, {lookType = 1950}, -1) end else doRemoveItem(item.uid, 1) doPlayerAddItem(cid, bikeid, 1) doSendMagicEffect(pos, 177) doCreatureSay(cid, t.dtext, 19) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'You haven demouted of a bike.') BikeSpeedOff(cid, t) doRemoveCondition(cid, CONDITION_OUTFIT) end return true end Agora em movements.xml adicione a tag abaixo: <movevent type="RemoveItem" actionid="12120" event="script" value="bikesystem.lua"/> E agora o script bikesystem.lua: function onRemoveItem(item, tile, lastpos, cid) doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTMOVEABLE) doTeleportThing(item.uid, lastpos, true) return true end Boa sorte. Vou Testar Jaja Digo Se Funcionou Vlw Amigo Amigo Deu Esse Erro [06/03/2015 13:39:27] [Error - MoveEvents Interface] [06/03/2015 13:39:27] data/movements/scripts/bikesystem.lua:onRemoveItem [06/03/2015 13:39:27] Description: [06/03/2015 13:39:27] (luaDoSendDefaultCancel) Player not found [06/03/2015 13:39:28] [Error - MoveEvent::executeAddRemItem] Call stack overflow. E Ainda Dá Pra Tacar No Chão Ai Quando Tá No Chão Não Dá Mais Pra Mover o Item Da Bike Tem Como Ajudar
Postado Março 6, 2015 10 anos hmm, então a função primária sobre a bike está certo, agora temos que ver uma função para bloquear o item de ser jogado. No caso, é só dar use no item né? Não precisa equipar na cabeça, e tals?
Postado Março 6, 2015 10 anos Autor hmm, então a função primária sobre a bike está certo, agora temos que ver uma função para bloquear o item de ser jogado. No caso, é só dar use no item né? Não precisa equipar na cabeça, e tals? Olha Eu Quero Que Não De Para Jogar o Item Da Bike No Chão Quando ela Estiver Sendo Usada/Equipada Ai Quando Ela Não Estiver Sendo Usado Ela Fique Tipo Desbloqueada
Postado Março 6, 2015 10 anos Entendi, olhando o script eu entendi como funciona. Seria mais fácil se no caso ela tivesse em algum slot do player, como helmet, etc.. Aí daria pra bloquear, mas assim na backpack teria que ver as possibilidades de criar uma função.
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.