ST

Bike

Por StrikersBR12, 16 de set. de 2019 em Scripts

bike
26
4.5k
StrikersBR12S
16 de setembro de 2019 às 21:04
2 minutos atrás, Renzyx disse:

1° - Possua a function onMove na source do client

2° - Crie um arquivo chamado nomovebike.lua em data/creaturescripts e cole dentro:

 

--Thalles

local config = {
storage = 7201
}

function onMoveItem(cid, item, count, toContainer, fromContainer, fromPos, toPos)
if getPlayerStorageValue(cid, config.storage) >= 1 then
doPlayerSendTextMessage(cid, 25, "Você não pode arrastar a bike enquanto estiver montada nela.")
else
return true
end
return false
end

é o mesmo procedimento de bloquear o deslogamento ao estiver usando bike

cole isso em creaturescripts.xml:

<event type="move" name="nomovebike" script="nomovebike.lua"/>

Registre em login.lua:

registerCreatureEvent(cid, "nomovebike")

e só adicionar isso na parte de setar a outfit, no female e male como eu adicionei lá as storages para não deslogar enquanto estiver na bike.

setPlayerStorageValue(cid, 7201, 1)

e como eu disse, na condition (condição) de sair da bike, coloque:

setPlayerStorageValue(cid, 7201, -1)

Meus scripts são básicos, mas não precisa de ter 100 linhas de código pra não funcionar, ta aí ó, aqui funcionou normalmente, basta você ter a function onMoveItem na Source do Servidor.

 

Print demonstrativo:

Screenshot_148.png.922e9f189191852fc55dbf43f60d08e6.png

to compilando a source aqui qualquer erro mando aqui

MarshmelloM
16 de setembro de 2019 às 21:05

Mano é só colocar Um item da Nike com noMovible e fazer um transformItem

StrikersBR12S
16 de setembro de 2019 às 21:07
1 minuto atrás, Marshmello disse:

Mano é só colocar Um item da Nike com noMovible e fazer um transformItem

como faço isso , '-'

5 minutos atrás, Renzyx disse:

Também como nosso amigo marshmello citou ali em cima, você pode fazer de duas maneiras, duas delas são:

 

doTransformItem

e

onMoveItem

o onMoveItem, já postei o script acima, basta você testar já possuindo a function onMoveItem nas sources, que é provavél que você deva ter, eu acredito que sim.

olha compilei na source , porem se eu tento joga a bike na backpack o serv crasha

9 minutos atrás, Marshmello disse:

Mano é só colocar Um item da Nike com noMovible e fazer um transformItem

@Marshmello pode me ajudar ? fazendo um script dotransform?

MarshmelloM
16 de setembro de 2019 às 21:33
24 minutos atrás, StrikersBR12 disse:

@Marshmello pode me ajudar ? fazendo um script dotransform?

Me de os id's do item da bike  com ela movivel e não movivel e sua script da bike pf

StrikersBR12S
16 de setembro de 2019 às 22:23
49 minutos atrás, Marshmello disse:

Me de os id's do item da bike  com ela movivel e não movivel e sua script da bike pf

bikes moviveis

 

Bike normal - 12774

 

Bike Leaf - 12937

 

Bike Fire - 12938

 

Bike Water - 12936

 

Bike Thunder - 12935

 

bikes não moviveis

 

Bike - 16232

 

Bike Leaf - 16235

 

Bike Fire - 16236

 

Bike Water - 16234

 

Bike Thunder - 16233

script bike.lua

bike.lua bikefire.lua bikeleaf.lua bikethunder.lua bikewater.lua

@Marshmello tudo ae

MarshmelloM
16 de setembro de 2019 às 22:52

irei fazer os processos agora aguarde terminar não precisa ficar me mencionando toda hora

RefeR
18 de setembro de 2019 às 12:35
function onUse(cid, item, fromPosition, itemEx, toPosition) 
local sBike = 12774 
local t = {
[12774] = {article='a', name='bike', text='Vou montar na bike!', dtext='Vou sair da bike!', s=5700, condition=bikeCondition, nonMoveable = 16232},
} 
local premium = false 
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 
if not isPremium(cid) then
doPlayerSendCancel(cid, "Vc nao é premium, Vaza.")
return true
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 not getPlayerItemCount(cid, item.itemid) then
		return false
	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 getPlayerStorageValue(cid, s) <= 0 then
doCreatureSay(cid, r.text, 19)
setPlayerStorageValue(cid, s, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'Você montou na ' .. r.article .. ' '.. r.name .. '.')
BikeSpeedOn(cid,1100)
doTransformItem(item,uid, r.nonMoveable)
if getPlayerSex(cid) == 1 then
doSetCreatureOutfit(cid, {lookType = 2518, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1)
setPlayerStorageValue(cid, 7200, 1)
else
doSetCreatureOutfit(cid, {lookType = 2517, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1)
setPlayerStorageValue(cid, 7200, 1)
end 

elseif getPlayerStorageValue(cid, s) == 1 then
doCreatureSay(cid, r.dtext, 19)
setPlayerStorageValue(cid, s, 0)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'Você saiu da ' .. r.article .. ' '.. r.name .. '.')
BikeSpeedOff(cid)
setPlayerStorageValue(cid, 7200, -1)
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 

Pronto, só quando for registrar novas bikes por lá em nonMoveable o id dela.

StrikersBR12S
18 de setembro de 2019 às 14:39
2 horas atrás, Ceetros disse:
function onUse(cid, item, fromPosition, itemEx, toPosition) 
local sBike = 12774 
local t = {
[12774] = {article='a', name='bike', text='Vou montar na bike!', dtext='Vou sair da bike!', s=5700, condition=bikeCondition, nonMoveable = 16232},
} 
local premium = false 
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 
if not isPremium(cid) then
doPlayerSendCancel(cid, "Vc nao é premium, Vaza.")
return true
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 not getPlayerItemCount(cid, item.itemid) then
		return false
	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 getPlayerStorageValue(cid, s) <= 0 then
doCreatureSay(cid, r.text, 19)
setPlayerStorageValue(cid, s, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'Você montou na ' .. r.article .. ' '.. r.name .. '.')
BikeSpeedOn(cid,1100)
doTransformItem(item,uid, r.nonMoveable)
if getPlayerSex(cid) == 1 then
doSetCreatureOutfit(cid, {lookType = 2518, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1)
setPlayerStorageValue(cid, 7200, 1)
else
doSetCreatureOutfit(cid, {lookType = 2517, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1)
setPlayerStorageValue(cid, 7200, 1)
end 

elseif getPlayerStorageValue(cid, s) == 1 then
doCreatureSay(cid, r.dtext, 19)
setPlayerStorageValue(cid, s, 0)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'Você saiu da ' .. r.article .. ' '.. r.name .. '.')
BikeSpeedOff(cid)
setPlayerStorageValue(cid, 7200, -1)
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 

Pronto, só quando for registrar novas bikes por lá em nonMoveable o id dela.

por nonmoveable aonde é isso? creaturescripts? source?

MarshmelloM
18 de setembro de 2019 às 19:03

Cara começa a prestar mais atenção....

 

[12774] = {article='a', name='bike', text='Vou montar na bike!', dtext='Vou sair da bike!', s=5700, condition=bikeCondition, nonMoveable = 16232},

 

StrikersBR12S
18 de setembro de 2019 às 22:17
3 horas atrás, Marshmello disse:

Cara começa a prestar mais atenção....

 

[12774] = {article='a', name='bike', text='Vou montar na bike!', dtext='Vou sair da bike!', s=5700, condition=bikeCondition, nonMoveable = 16232},

 

[18/09/2019 22:17:07] [Error - Action Interface] 
[18/09/2019 22:17:07] datapack/actions/scripts/bike.lua:onUse
[18/09/2019 22:17:07] Description: 
[18/09/2019 22:17:07] (luaDoTransformItem) Item not found

MarshmelloM
18 de setembro de 2019 às 23:34
function onUse(cid, item, fromPosition, itemEx, toPosition) 
local sBike = 12774 
local t = {
[12774] = {article='a', name='bike', text='Vou montar na bike!', dtext='Vou sair da bike!', s=5700, condition=bikeCondition, nonMoveable = 16232, movable = 12774 },
} 
local premium = false 
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 
if not isPremium(cid) then
doPlayerSendCancel(cid, "Vc nao é premium, Vaza.")
return true
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 not getPlayerItemCount(cid, item.itemid) then
		return false
	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 getPlayerStorageValue(cid, s) <= 0 then
doCreatureSay(cid, r.text, 19)
setPlayerStorageValue(cid, s, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'Você montou na ' .. r.article .. ' '.. r.name .. '.')
BikeSpeedOn(cid,1100)
doTransformItem(itemEx,uid, r.nonMoveable)
if getPlayerSex(cid) == 1 then
doSetCreatureOutfit(cid, {lookType = 2518, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1)
setPlayerStorageValue(cid, 7200, 1)
else
doSetCreatureOutfit(cid, {lookType = 2517, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1)
setPlayerStorageValue(cid, 7200, 1)
end 

elseif getPlayerStorageValue(cid, s) == 1 then
doCreatureSay(cid, r.dtext, 19)
setPlayerStorageValue(cid, s, 0)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'Você saiu da ' .. r.article .. ' '.. r.name .. '.')
BikeSpeedOff(cid)
setPlayerStorageValue(cid, 7200, -1)
doTransformItem(itemEx,uid, r.movable)
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 

Modifiquei umas linhas na Scripts do ceetros , assim deve funcionar