57 minutos atrás, R e d disse:Boa noite, alguem poderia me dizer qual a função devo colocar nesses scripts pra que o player so possa usar o Item se ele estiver na bag (atualmente se estiver no chão mais de uma pessoa pode usar).
Obgd desde já ❤️
O primeiro é de uma bike.
function onUse(cid, item, fromPosition, itemEx, toPosition)
local sBike = 16053
local t = {
[16053] = {article='a', name='bike', s=5000, condition=bikeCondition},
}function BikeSpeedOn(cid,nSpeed)
setPlayerStorageValue(cid,sBike,getCreatureSpeed(cid))
doChangeSpeed(cid,-getCreatureSpeed(cid))
doChangeSpeed(cid,nSpeed)
endfunction BikeSpeedOff(cid)
doChangeSpeed(cid,-getCreatureSpeed(cid))
doChangeSpeed(cid,getPlayerStorageValue(cid,sBike))
endlocal v, r = getCreaturePosition(cid), t[item.itemid]
local s = r.s
local pos = {x = v.x, y = v.y, z = v.z}
if r thenif getPlayerStorageValue(cid, 17001) == 1 or getPlayerStorageValue(cid, 63215) == 1 or getPlayerStorageValue(cid, 17000) == 1 then
return doPlayerSendCancel(cid, "Voce nao pode montar na (BIKE) se estiver no ride/fly/surf.")
endif getPlayerStorageValue(cid, s) <= 0 then
setPlayerStorageValue(cid, s, 1)
BikeSpeedOn(cid,1000)
if getPlayerSex(cid) == 1 then
doSetCreatureOutfit(cid, {lookType = 2566, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1)
else
doSetCreatureOutfit(cid, {lookType = 2565, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1)
end
elseif getPlayerStorageValue(cid, s) == 1 then
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
O segundo Outfit por item.
function onUse(cid, item, frompos, fromPosition, topos, itemEx, toPosition)
if getPlayerLevel(cid) >= 30 then
questOut = getPlayerStorageValue(cid, 31503)
if questOut == -1 then
setPlayerStorageValue(cid, 1816, 1)
doPlayerSendTextMessage(cid, 22, "Você Ganhou Um Novo Outfit.")
doPlayerRemoveItem(cid, 20981, 1)
setPlayerStorageValue(cid, 31503, 1)
else
doPlayerSendCancel(cid, "Você já possui essa outfit.")
end
else
doPlayerSendTextMessage(cid, 22, "Você Não tem Level suficiente para Pegar a Recompesa 30+.")
end
end
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
return TRUE
end
Utilize para ambos
local config =
{
velocidadeDaSuaBike = 6000, -- Velocidade da bike coloquei igual o do OtPokemon
outfitMale = 1951, -- Outfit MALE
outfitFemale = 1950, -- 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
local config =
{
velocidadeDaSuaBike = 6000, -- Velocidade da bike coloquei igual o do OtPokemon
outfitMale = 1951, -- Outfit MALE
outfitFemale = 1950, -- 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







info
Grupo: Visconde
Registrado: 09/05/18
Posts: 267
Reputação: +9
Gênero: Feminino
Char no Tibia: Merascylla
Boa noite, alguem poderia me dizer qual a função devo colocar nesses scripts pra que o player so possa usar o Item se ele estiver na bag (atualmente se estiver no chão mais de uma pessoa pode usar).
Obgd desde já ❤️
O primeiro é de uma bike.
function onUse(cid, item, fromPosition, itemEx, toPosition)
local sBike = 16053
local t = {
[16053] = {article='a', name='bike', s=5000, 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, 17001) == 1 or getPlayerStorageValue(cid, 63215) == 1 or getPlayerStorageValue(cid, 17000) == 1 then
return doPlayerSendCancel(cid, "Voce nao pode montar na (BIKE) se estiver no ride/fly/surf.")
end
if getPlayerStorageValue(cid, s) <= 0 then
setPlayerStorageValue(cid, s, 1)
BikeSpeedOn(cid,1000)
if getPlayerSex(cid) == 1 then
doSetCreatureOutfit(cid, {lookType = 2566, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1)
else
doSetCreatureOutfit(cid, {lookType = 2565, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1)
end
elseif getPlayerStorageValue(cid, s) == 1 then
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
O segundo Outfit por item.
function onUse(cid, item, frompos, fromPosition, topos, itemEx, toPosition)
if getPlayerLevel(cid) >= 30 then
questOut = getPlayerStorageValue(cid, 31503)
if questOut == -1 then
setPlayerStorageValue(cid, 1816, 1)
doPlayerSendTextMessage(cid, 22, "Você Ganhou Um Novo Outfit.")
doPlayerRemoveItem(cid, 20981, 1)
setPlayerStorageValue(cid, 31503, 1)
else
doPlayerSendCancel(cid, "Você já possui essa outfit.")
end
else
doPlayerSendTextMessage(cid, 22, "Você Não tem Level suficiente para Pegar a Recompesa 30+.")
end
end