ST

Logout

Por StrikersBR12, 15 de set. de 2019 em Scripts

logout
46
7.9k
StrikersBR12S
15 de setembro de 2019 às 20:58

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

        end
    end
    
return true
end

Editado Setembro 15 por StrikersBR12

MarshmelloM
16 de setembro de 2019 às 02:08

@StrikersBR12 Em creatureScript crie um arquivo chamado blockl.lua e cole isso dentro

 

 

Spoiler

function onLogout(cid)
    if getPlayerStorageValue(cid, 5700) > 0 then
        doPlayerSendTextMessage(cid, 25, "Você não pode deslogar montado em uma bike)
    return false
    end
    return true
end

 

 

depois vá em creatureScript.xml e cole

Spoiler

<event type="logout" name="BlockL" event="script" value="blockl.lua"/>

 

Editado Setembro 16 por Marshmello

StrikersBR12S
16 de setembro de 2019 às 05:19
3 horas atrás, Marshmello disse:

@StrikersBR12 Em creatureScript crie um arquivo chamado blockl.lua e cole isso dentro

 

 

  Ocultar conteúdo

function onLogout(cid)
    if getPlayerStorageValue(cid, 5700) > 1 then
        doPlayerSendTextMessage(cid, 25, "Você não pode deslogar montado em uma bike)
    return false
    end
    return true
end

 

 

depois vá em creatureScript.xml e cole

  Ocultar conteúdo

<event type="logout" name="BlockL" event="script" value="blockl.lua"/>

 

ainda consigo deslogar e fica assim quando deslogo na bike http://prntscr.com/p6nztt

 

você teria algum script de bike sem bug que não possa tacar a bike no chão pra geral usar a msm bike ou então caso uma pessoa esteja usando uma certa bike a outra não use

 

@Marshmello

Ayron5A
16 de setembro de 2019 às 07:49
10 horas atrás, StrikersBR12 disse:

Gostaria de um script pra não poder deslogar enquanto estiver em uma bike

 

bike.lua

  Mostrar conteúdo oculto

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

Teste esse meu brother. ^^ 

script da bike

Spoiler
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
        if item.actionid ~= 12120 then
            doRemoveItem(item.uid, 1)
            local create_action = doPlayerAddItem(cid, bikeid, 1)
            doItemSetAttribute(create_action, "aid", 12120)

            setPlayerStorageValue(cid, 12120, 1)
            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
            doPlayerSendCancel(cid, "This bike is in use.")
        end
    else
        if item.actionid == 12120 and getCreatureOutfit(cid).lookType == 1951 or getCreatureOutfit(cid).lookType == 1950 then
            doRemoveItem(item.uid, 1)
            doPlayerAddItem(cid, bikeid, 1)
            setPlayerStorageValue(cid, 12120, -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
            doPlayerSendCancel(cid, "This bike isn't yours.")
        end
    end
    
return true
end

 

Agora em creaturescripts.xml adicione a tag:

 

<event type="logout" name="EventLogout" event="script" value="SystemLogout.lua"/>

 

E em SystemLogout.lua, adicione o script abaixo:

 

function onLogout(cid)
    if getPlayerStorageValue(cid, 12120) > 0 then
        return doPlayerSendCancel(cid, "You can't logout while riding in the bike.") and false
    end
return true
end

 

Agora em login.lua, adicione a tag abaixo junto com as do gênero:

 

registerCreatureEvent(cid, "EventLogout")

 

créditos: driano swatt

StrikersBR12S
16 de setembro de 2019 às 13:45
6 horas atrás, Ayron5 disse:

Teste esse meu brother. ^^ 

script da bike

  Mostrar conteúdo oculto

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
        if item.actionid ~= 12120 then
            doRemoveItem(item.uid, 1)
            local create_action = doPlayerAddItem(cid, bikeid, 1)
            doItemSetAttribute(create_action, "aid", 12120)

            setPlayerStorageValue(cid, 12120, 1)
            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
            doPlayerSendCancel(cid, "This bike is in use.")
        end
    else
        if item.actionid == 12120 and getCreatureOutfit(cid).lookType == 1951 or getCreatureOutfit(cid).lookType == 1950 then
            doRemoveItem(item.uid, 1)
            doPlayerAddItem(cid, bikeid, 1)
            setPlayerStorageValue(cid, 12120, -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
            doPlayerSendCancel(cid, "This bike isn't yours.")
        end
    end
    
return true
end

 

Agora em creaturescripts.xml adicione a tag:

 

<event type="logout" name="EventLogout" event="script" value="SystemLogout.lua"/>

 

E em SystemLogout.lua, adicione o script abaixo:

 

function onLogout(cid)
    if getPlayerStorageValue(cid, 12120) > 0 then
        return doPlayerSendCancel(cid, "You can't logout while riding in the bike.") and false
    end
return true
end

 

Agora em login.lua, adicione a tag abaixo junto com as do gênero:

 

registerCreatureEvent(cid, "EventLogout")

 

créditos: driano swatt

registerCreatureEvent(cid, "EventLogout"

 

coloco aonde exatamente no login.lua?

 

ainda continua deslogando encima da bike

pra ficar mais fácil tenta colocar pra mim o sistema de bloquear o uso de uma mesma bike por mais de uma pessoa

 

bike.lua sem bugs , so preciso bloquear o uso da bike por mais de uma pessoa

Spoiler

-- { Autor: Lucas Rafaeel }
-- { Version: 1.0 }


local config =
{
    velocidadeDaSuaBike = 5000, -- Velocidade da bike coloquei igual o do OtPokemon 
    outfitMale = 2518, -- Outfit MALE
    outfitFemale = 2517, -- Outfit FEMALE
    storageValue = 243656, -- Não mude
}
 
function onUse(cid, item, itemEx, fromPosition, toPosition)

    if item.uid ~= getPlayerSlotItem(cid, CONST_SLOT_RING).uid then
        doPlayerSendCancel(cid, "Você deve colocar sua bike no local correto.") -- Mensagem que da ao tentar usar a bike fora do slot (by: Lukas)
    return TRUE
end

    if getPlayerStorageValue(cid, 17001) > 0 or getPlayerStorageValue(cid, 17000) > 0 or getPlayerStorageValue(cid, 63215) > 0 then
        doPlayerSendCancel(cid, "Você não pode usar bike em situações especiais.")
    return true
end
 
    if isPlayer(cid) and getCreatureOutfit(cid).lookType == 814 then return false end
        if getPlayerStorageValue(cid, config.storageValue) <= 0 then
            local a = {lookType = config.outfitMale, lookHead = getCreatureOutfit(cid).lookHead, lookBody = getCreatureOutfit(cid).lookBody, lookLegs = getCreatureOutfit(cid).lookLegs, lookFeet = getCreatureOutfit(cid).lookFeet}
            local b = {lookType = config.outfitFemale, lookHead = getCreatureOutfit(cid).lookHead, lookBody = getCreatureOutfit(cid).lookBody, lookLegs = getCreatureOutfit(cid).lookLegs, lookFeet = getCreatureOutfit(cid).lookFeet}
            setPlayerStorageValue(cid, 3624, ""..getPlayerStamina(cid).."")
            doChangeSpeed(cid, -getCreatureSpeed(cid))
            doChangeSpeed(cid, config.velocidadeDaSuaBike)
            setPlayerStorageValue(cid, config.storageValue, 1)        
            if getPlayerSex(cid) == 0 then
                doSetCreatureOutfit(cid, b, -1)
            else
                doSetCreatureOutfit(cid, a, -1)
            end
        else
            setPlayerStorageValue(cid, config.storageValue, 0)
            doRemoveCondition(cid, CONDITION_OUTFIT)
            doRegainSpeedLevel(cid)
       end
    return true
end

 

Outro bike.lua

Spoiler

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=99999999, condition=bikeCondition},
}

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 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)
if getPlayerSex(cid) == 1 then
doSetCreatureOutfit(cid, {lookType = 2518, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1)
else
doSetCreatureOutfit(cid, {lookType = 2517, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -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)
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

 

 

@Ayron5 ou @Marshmello ou @Yan Liima ajuda ae

Editado Setembro 16 por StrikersBR12

RefeR
16 de setembro de 2019 às 15:59
2 horas atrás, StrikersBR12 disse:

registerCreatureEvent(cid, "EventLogout"

 

coloco aonde exatamente no login.lua?

 

ainda continua deslogando encima da bike

pra ficar mais fácil tenta colocar pra mim o sistema de bloquear o uso de uma mesma bike por mais de uma pessoa

 

bike.lua sem bugs , so preciso bloquear o uso da bike por mais de uma pessoa

  Ocultar conteúdo

-- { Autor: Lucas Rafaeel }
-- { Version: 1.0 }


local config =
{
    velocidadeDaSuaBike = 5000, -- Velocidade da bike coloquei igual o do OtPokemon 
    outfitMale = 2518, -- Outfit MALE
    outfitFemale = 2517, -- Outfit FEMALE
    storageValue = 243656, -- Não mude
}
 
function onUse(cid, item, itemEx, fromPosition, toPosition)

    if item.uid ~= getPlayerSlotItem(cid, CONST_SLOT_RING).uid then
        doPlayerSendCancel(cid, "Você deve colocar sua bike no local correto.") -- Mensagem que da ao tentar usar a bike fora do slot (by: Lukas)
    return TRUE
end

    if getPlayerStorageValue(cid, 17001) > 0 or getPlayerStorageValue(cid, 17000) > 0 or getPlayerStorageValue(cid, 63215) > 0 then
        doPlayerSendCancel(cid, "Você não pode usar bike em situações especiais.")
    return true
end
 
    if isPlayer(cid) and getCreatureOutfit(cid).lookType == 814 then return false end
        if getPlayerStorageValue(cid, config.storageValue) <= 0 then
            local a = {lookType = config.outfitMale, lookHead = getCreatureOutfit(cid).lookHead, lookBody = getCreatureOutfit(cid).lookBody, lookLegs = getCreatureOutfit(cid).lookLegs, lookFeet = getCreatureOutfit(cid).lookFeet}
            local b = {lookType = config.outfitFemale, lookHead = getCreatureOutfit(cid).lookHead, lookBody = getCreatureOutfit(cid).lookBody, lookLegs = getCreatureOutfit(cid).lookLegs, lookFeet = getCreatureOutfit(cid).lookFeet}
            setPlayerStorageValue(cid, 3624, ""..getPlayerStamina(cid).."")
            doChangeSpeed(cid, -getCreatureSpeed(cid))
            doChangeSpeed(cid, config.velocidadeDaSuaBike)
            setPlayerStorageValue(cid, config.storageValue, 1)        
            if getPlayerSex(cid) == 0 then
                doSetCreatureOutfit(cid, b, -1)
            else
                doSetCreatureOutfit(cid, a, -1)
            end
        else
            setPlayerStorageValue(cid, config.storageValue, 0)
            doRemoveCondition(cid, CONDITION_OUTFIT)
            doRegainSpeedLevel(cid)
       end
    return true
end

 

Outro bike.lua

  Mostrar conteúdo oculto

 

 

@Ayron5 ou @Marshmello ou @Yan Liima ajuda ae

me manda qual arquivo do sistema de bike que tá no seu servidor ativo, assim eu posso tentar ajudar.

StrikersBR12S
16 de setembro de 2019 às 16:00
Agora, Ceetros disse:

me manda qual arquivo do sistema de bike que tá no seu servidor ativo, assim eu posso tentar ajudar.

Atualmente esse

 

Spoiler

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=99999999, condition=bikeCondition},
}

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 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)
if getPlayerSex(cid) == 1 then
doSetCreatureOutfit(cid, {lookType = 2518, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1)
else
doSetCreatureOutfit(cid, {lookType = 2517, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -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)
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

 

o que quero é o seguinte 

 

Impedir que dois player usem a mesma bike

Yan LiimaY
16 de setembro de 2019 às 16:01

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) >= 1 then
doPlayerSendTextMessage(cid, 25, "Você não pode deslogar montado em uma bike)
return false
else
return true
end
end

E só pra deixar ciente, não precisa registrar no login.lua, eventos de login e logout não é necessário.

StrikersBR12S
16 de setembro de 2019 às 16:04
3 minutos atrás, Yan Liima disse:

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) >= 1 then
doPlayerSendTextMessage(cid, 25, "Você não pode deslogar montado em uma bike)
return false
else
return true
end
end

E só pra deixar ciente, não precisa registrar no login.lua, eventos de login e logout não é necessário.

ainda deslogo normalmente ksks

base Utilizada PokeZR

 

RefeR
16 de setembro de 2019 às 16:22
17 minutos atrás, StrikersBR12 disse:

ainda deslogo normalmente ksks

base Utilizada PokeZR

 

Então, os caras tão pegando algo pronto da net, muda ali na segunda linha o 5700 para 99999999, que é a storago do seu servidor

StrikersBR12S
16 de setembro de 2019 às 16:24
2 minutos atrás, Ceetros disse:

Então, os caras tão pegando algo pronto da net, muda ali na segunda linha o 5700 para 99999999, que é a storago do seu servidor

vou testar aqui

4 minutos atrás, Ceetros disse:

Então, os caras tão pegando algo pronto da net, muda ali na segunda linha o 5700 para 99999999, que é a storago do seu servidor

ainda consigo deslogar porem , esse não é o problema agora , eu so quero que dois players n consigam usar a mesma bike

MarshmelloM
16 de setembro de 2019 às 16:28
27 minutos atrás, Yan Liima disse:

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) >= 1 then
doPlayerSendTextMessage(cid, 25, "Você não pode deslogar montado em uma bike)
return false
else
return true
end
end

E só pra deixar ciente, não precisa registrar no login.lua, eventos de login e logout não é necessário.

Tinha feito Pelo Celular nem vi a cagada kk vlw pela correção

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

Tinha feito Pelo Celular nem vi a cagada kk vlw pela correção

da pra me ajudar ae??

MarshmelloM
16 de setembro de 2019 às 16:31
Agora, StrikersBR12 disse:

da pra me ajudar ae??

Eu atualizei o codigo lá em cima testa lá

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

Eu atualizei o codigo lá em cima testa lá

to querendo um código pra bloquear o uso da mesma bike por dois players por exemplo um cara tem uma bike ele usa e taca pra outro e o outro usa tbm

 

meus scripts de bike.lua

 

bike.lua

 

Spoiler

-- { Autor: Lucas Rafaeel }
-- { Version: 1.0 }


local config =
{
    velocidadeDaSuaBike = 5000, -- Velocidade da bike coloquei igual o do OtPokemon 
    outfitMale = 2518, -- Outfit MALE
    outfitFemale = 2517, -- Outfit FEMALE
    storageValue = 243656, -- Não mude
}
 
function onUse(cid, item, itemEx, fromPosition, toPosition)

    if item.uid ~= getPlayerSlotItem(cid, CONST_SLOT_RING).uid then
        doPlayerSendCancel(cid, "Você deve colocar sua bike no local correto.") -- Mensagem que da ao tentar usar a bike fora do slot (by: Lukas)
    return TRUE
end

    if getPlayerStorageValue(cid, 17001) > 0 or getPlayerStorageValue(cid, 17000) > 0 or getPlayerStorageValue(cid, 63215) > 0 then
        doPlayerSendCancel(cid, "Você não pode usar bike em situações especiais.")
    return true
end
 
    if isPlayer(cid) and getCreatureOutfit(cid).lookType == 814 then return false end
        if getPlayerStorageValue(cid, config.storageValue) <= 0 then
            local a = {lookType = config.outfitMale, lookHead = getCreatureOutfit(cid).lookHead, lookBody = getCreatureOutfit(cid).lookBody, lookLegs = getCreatureOutfit(cid).lookLegs, lookFeet = getCreatureOutfit(cid).lookFeet}
            local b = {lookType = config.outfitFemale, lookHead = getCreatureOutfit(cid).lookHead, lookBody = getCreatureOutfit(cid).lookBody, lookLegs = getCreatureOutfit(cid).lookLegs, lookFeet = getCreatureOutfit(cid).lookFeet}
            setPlayerStorageValue(cid, 3624, ""..getPlayerStamina(cid).."")
            doChangeSpeed(cid, -getCreatureSpeed(cid))
            doChangeSpeed(cid, config.velocidadeDaSuaBike)
            setPlayerStorageValue(cid, config.storageValue, 1)        
            if getPlayerSex(cid) == 0 then
                doSetCreatureOutfit(cid, b, -1)
            else
                doSetCreatureOutfit(cid, a, -1)
            end
        else
            setPlayerStorageValue(cid, config.storageValue, 0)
            doRemoveCondition(cid, CONDITION_OUTFIT)
            doRegainSpeedLevel(cid)
       end
    return true
end

 

Atualmente esse \/

 

Spoiler

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=99999999, condition=bikeCondition},
}

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 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)
if getPlayerSex(cid) == 1 then
doSetCreatureOutfit(cid, {lookType = 2518, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1)
else
doSetCreatureOutfit(cid, {lookType = 2517, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -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)
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