Gostaria de um script pra não poder deslogar enquanto estiver em uma bike
bike.lua
Spoiler
local t = {text='Mount, bike!', dtext='Demount, bike!', s=5700, speed = 9999}
local bikeid = 12774 -- 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
if item.actionid ~= 12120 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 = 2518}, -1)
else
doSetCreatureOutfit(cid, {lookType = 2517}, -1)
end
else
doPlayerSendCancel(cid, "This bike is in use.")
end
else
if item.actionid == 12120 and getCreatureOutfit(cid).lookType == 2518 or getCreatureOutfit(cid).lookType == 2517 then
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)
else
Pergunta
StrikersBR12 1
Gostaria de um script pra não poder deslogar enquanto estiver em uma bike
bike.lua
local t = {text='Mount, bike!', dtext='Demount, bike!', s=5700, speed = 9999}
local bikeid = 12774 -- 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
if item.actionid ~= 12120 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 = 2518}, -1)
else
doSetCreatureOutfit(cid, {lookType = 2517}, -1)
end
else
doPlayerSendCancel(cid, "This bike is in use.")
end
else
if item.actionid == 12120 and getCreatureOutfit(cid).lookType == 2518 or getCreatureOutfit(cid).lookType == 2517 then
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)
else
end
end
return true
end
Link para o comentário
Compartilhar em outros sites
Top Posters For This Question
25
9
6
3
Popular Days
Set 16
45
Set 15
1
Top Posters For This Question
StrikersBR12 25 posts
Marshmello 9 posts
FlamesAdmin 6 posts
Ayron5 3 posts
Popular Days
Set 16 2019
45 posts
Set 15 2019
1 post
Popular Posts
Yan Liima
Usa da maneira que o Marsh mandou, porém ele cometeu um pequeno erro. Só está verificando apartir da storage de valor 2. Tente assim: function onLogout(cid) if getPlayerStorageValue(cid, 5700) >
Marshmello
@StrikersBR12 Vou ver aqui @Renzyx Acabei de falar com o mano ali que n precisa de registro de events no loguin.lua quando se trate em logout mdsss
45 respostass a esta questão
Posts Recomendados