Postado Janeiro 21, 2018 7 anos Gostaria que a bike tivesse a speed base do jogador + uma certa quantidade. SCRIPT: function onUse(cid, item, fromPosition, itemEx, toPosition) local sBike = 2547 local t = { [16689] = {article='a', name='Bike', text='', dtext='', s=9999, condition=bikeCondition}, } function BikeSpeedOn(cid,nSpeed) setPlayerStorageValue(cid,sBike,getCreatureSpeed(cid)) doChangeSpeed(cid,-getCreatureSpeed(cid)) doChangeSpeed(cid,nSpeed) end function BikeSpeedOff(cid) doChangeSpeed(cid,-getCreatureSpeed(cid)) doChangeSpeed(cid,getPlayerStorageValue(cid,sBike)) end local v, r = getCreaturePosition(cid), t[item.itemid] local s = r.s local pos = {x = v.x, y = v.y, z = v.z} if r then if getPlayerStorageValue(cid, 25000) == 5 then return end if getPlayerStorageValue(cid, 23000) == 5 then return end if getPlayerStorageValue(cid, 17001) == 1 or getPlayerStorageValue(cid, 63215) == 1 or getPlayerStorageValue(cid, 17000) == 1 then doPlayerSendCancel(cid, "You can't use bike while ride/fly/surf.") return true end if getPlayerSlotItem(cid, CONST_SLOT_AMMO).uid == item.uid then doPlayerSendCancel("Não está no slot correto") return true end if getPlayerStorageValue(cid, s) <= 0 then doCreatureSay(cid, r.text, 19) setPlayerStorageValue(cid, s, 1) BikeSpeedOn(cid,800) if getPlayerSex(cid) == 1 then doSetCreatureOutfit(cid, {lookType = 2293, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1) ---Female else doSetCreatureOutfit(cid, {lookType = 2292, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1) --- Male end elseif getPlayerStorageValue(cid, s) == 1 then doCreatureSay(cid, r.dtext, 19) setPlayerStorageValue(cid, s, 0) BikeSpeedOff(cid) return doRemoveCondition(cid, CONDITION_OUTFIT) else return doPlayerSendCancel(cid, 'You can\'t do this.') end else return doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, 'Report bugs in Bike system.') end end Exemplo: Se sua velocidade for de 318 (velocidade real de um char Level 50) e você estiver usando a bicicleta (+20 níveis de velocidade), você terá a velocidade modificada para "338" (que é a velocidade real de um char Level 60).
Postado Janeiro 21, 2018 7 anos Solução Fiz corrido, testa aí: function onUse(cid, item, fromPosition, itemEx, toPosition) local sBike = 2547 local speed = 20 -- speed que você quer extra local t = { [16689] = {article='a', name='Bike', text='', dtext='', s=9999, condition=bikeCondition}, } function BikeSpeedOn(cid,nSpeed) setPlayerStorageValue(cid,sBike,getCreatureSpeed(cid)) doChangeSpeed(cid,getCreatureSpeed(cid)+nSpeed) end function BikeSpeedOff(cid) doChangeSpeed(cid,-getCreatureSpeed(cid)) doChangeSpeed(cid,getPlayerStorageValue(cid,sBike)) end local v, r = getCreaturePosition(cid), t[item.itemid] local s = r.s local pos = {x = v.x, y = v.y, z = v.z} if r then if getPlayerStorageValue(cid, 25000) == 5 then return end if getPlayerStorageValue(cid, 23000) == 5 then return end if getPlayerStorageValue(cid, 17001) == 1 or getPlayerStorageValue(cid, 63215) == 1 or getPlayerStorageValue(cid, 17000) == 1 then doPlayerSendCancel(cid, "You can't use bike while ride/fly/surf.") return true end if getPlayerSlotItem(cid, CONST_SLOT_AMMO).uid == item.uid then doPlayerSendCancel("Não está no slot correto") return true end if getPlayerStorageValue(cid, s) <= 0 then doCreatureSay(cid, r.text, 19) setPlayerStorageValue(cid, s, 1) BikeSpeedOn(cid,speed) if getPlayerSex(cid) == 1 then doSetCreatureOutfit(cid, {lookType = 2293, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1) ---Female else doSetCreatureOutfit(cid, {lookType = 2292, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1) --- Male end elseif getPlayerStorageValue(cid, s) == 1 then doCreatureSay(cid, r.dtext, 19) setPlayerStorageValue(cid, s, 0) BikeSpeedOff(cid) return doRemoveCondition(cid, CONDITION_OUTFIT) else return doPlayerSendCancel(cid, 'You can\'t do this.') end else return doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, 'Report bugs in Bike system.') end end Programador PHP, Lua, Java, database administrator. "Nada é verdade, tudo é permitido." Requiescat in pace.
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.