Ir para conteúdo
  • 0

Ajuda com Efeito em buff de xp


IOWeenI

Pergunta

Posts Recomendados

  • 0
1 hora atrás, Yan18 disse:

Muito bem observado, é isso mesmo, como foi feito por actions, então só vai funcionar na primeira vez que der use no item e até deslogar.

 

Faz o seguinte, substitui o código de actions por esse:


function buffEffect(cid, time, effect, duration)
	duration = math.floor(duration)
	
	if not cid then
		return true
	end
	
	if duration > os.time() then		
		return doSendMagicEffect(getThingPos(cid), effect) and addEvent(buffEffect, 1000 * time, cid.uid, time, effect, duration)	
	else
		return true
	end	
end

local items = {
	[19268] = {percentExtra = 50, timeType = "hours", time = 1}, -- 1 hora
	[19269] = {percentExtra = 100, timeType = "hours", time = 1}, -- 1 hora
	
	[19270] = {percentExtra = 50, timeType = "days", time = 7}, -- 1 semana
	[19271] = {percentExtra = 100, timeType = "days", time = 7}, -- 1 semana
	
	[19272] = {percentExtra = 50, timeType = "days", time = 30}, -- 1 Mês
	[19273] = {percentExtra = 100, timeType = "days", time = 30}, -- 1 Mês
}

local effect = 28 -- EFEITO QUE SAI NO PLAYER AO USAR O ITEM
local storage_time = 45144 -- STORAGE QUE ARMAZENA O TEMPO QUE O BUFF VAI DURAR

function onUse(cid, item, fromPosition, itemEx, toPosition)
loop_effect_segundos = math.floor(loop_effect_segundos) 
  
	local expItem = items[item.itemid]
	
	if not expItem then
		return true
	end
	
	local tempo = 0
	local death = false
		
	if expItem.timeType == "days" then
		tempo = expItem.time * 60 * 60 * 24
	else -- Hours
		tempo = expItem.time * 60 * 60
	end
	
	if getPlayerStorageValue(cid, storage_time) - os.time() > 1 then
		doPlayerSendTextMessage(cid, 20, "Você ainda tem um Experience Booster ativo de "..getPlayerStorageValue(cid, 45145).."%. Ele irá acabar em "..convertTime(getPlayerStorageValue(cid, 45144) - os.time())..".")
		return false
	end
		
	--doSendMagicEffect(getThingPos(cid), effect) -- FUNÇÃO QUE SAI EFEITO NO PLAYER AO USAR O ITEM
	buffEffect(cid, loop_effect_segundos, effect, storage_time) -- FUNÇÃO QUE SAI EFEITO NO PLAYER ENQUANTO ELE ESTÁ COM BUFF
	doRemoveItem(item.uid, 1)
	setPlayerStorageValue(cid, storage_time, tempo + os.time())
	setPlayerStorageValue(cid, 45145, expItem.percentExtra)
	doPlayerSendTextMessage(cid, 20, "Você ativou um Experience Booster de "..expItem.percentExtra.."% a mais, que durará "..(death and "até morrer" or convertTime(tempo))..".")
	
	return true
end

 

Agora vai em Data/Creaturescripts/Scripts ou Data/Creaturescripts/Scripts/Player e abre o arquivo login.lua embaixo de:

 


function onLogin(cid)

 

adicione esse bloco:

 


local storage_buff = 45144 -- STORAGE QUE ARMAZENA O TEMPO QUE O BUFF VAI DURAR
local effect_buff = 28

if getPlayerStorageValue(cid, storage_buff) > os.time() then
	buffEffect(cid, 3, effect_buff, storage_buff)
end

 

Reinicia a distro, e usa o item novamente e testa, ai testa uns minutos online, depois desloga e loga de novo. Qualquer problema você me avisa.

testei aqui e deu esse erro


[Error - CreatureScript Interface]
data/creaturescripts/scripts/player/login.lua:onLogin
Description:
data/creaturescripts/scripts/player/login.lua:43: attempt to call global 'buffEffect' (a nil value)
stack traceback:
        data/creaturescripts/scripts/player/login.lua:43: in function <data/creaturescripts/scripts/player/login.lua:37>

 


player n loga

Link para o comentário
Compartilhar em outros sites

  • 0
7 minutos atrás, wenderotpoke disse:

testei aqui e deu esse erro


[Error - CreatureScript Interface]
data/creaturescripts/scripts/player/login.lua:onLogin
Description:
data/creaturescripts/scripts/player/login.lua:43: attempt to call global 'buffEffect' (a nil value)
stack traceback:
        data/creaturescripts/scripts/player/login.lua:43: in function <data/creaturescripts/scripts/player/login.lua:37>

 


player n loga

Por que a função não ficou global. Para te poupar tempo, vamos colocar ela também no login.lua.

 

Substitui esse:

function onLogin(cid)
local storage_buff = 45144 -- STORAGE QUE ARMAZENA O TEMPO QUE O BUFF VAI DURAR
local effect_buff = 28

if getPlayerStorageValue(cid, storage_buff) > os.time() then
	buffEffect(cid, 3, effect_buff, storage_buff)
end

 

Por esse:

function onLogin(cid)
local storage_buff = 45144 -- STORAGE QUE ARMAZENA O TEMPO QUE O BUFF VAI DURAR
local effect_buff = 28 -- ID DO EFEITO

local function buffEffect(cid, time, effect, duration)
	duration = math.floor(duration)
	
	if not cid then
		return true
	end
	
	if duration > os.time() then		
		return doSendMagicEffect(getThingPos(cid), effect) and addEvent(buffEffect, 1000 * time, cid.uid, time, effect, duration)	
	else
		return true
	end	
end
  
  if getPlayerStorageValue(cid, storage_buff) > os.time() then
	buffEffect(cid, 3, effect_buff, storage_buff)
  end

 

Testa e me fala se funcionou.

Link para o comentário
Compartilhar em outros sites

  • 0

[Warning - BaseEvents::loadFromXml] Cannot configure an event
[Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/player/login.lua:328: 'end' expected (to close 'function' at line 37) near '<eof>'
[Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/player/login.lua)
data/creaturescripts/scripts/player/login.lua:328: 'end' expected (to close 'function' at line 37) near '<eof>'

Link para o comentário
Compartilhar em outros sites

  • 0
2 minutos atrás, Yan18 disse:

Deve estar com dois function onLogin(cid).

 

Posta o seu login.lua que eu arrumo para você.

eu tirei os 2 kkk estava mesmo 

mas ainda não pegou o efeito n fica saindo

Spoiler

local config = {
    loginMessage = getConfigValue('loginMessage'),
    useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function AutoLootinit(cid)
    if getPlayerStorageValue (cid, storages.AutoLootCollectAll) == -1 then
        setPlayerStorageValue(cid, storages.AutoLootCollectAll, "no")
    end
    return true 
end
function setVipSkull(cid)
    if isPremium(cid) and not isInArray({SKULL_WHITE, 1, 2, 3, 5}, getCreatureSkullType(cid)) then
        doCreatureSetSkullType(cid, 5)
    end
end

function getPlayerClanName(cid)
   local clanByNum = {            
      [4] = "wingeon",
      [1] = "volcanic",
      [2] = "seavel", 
      [9] = "raibolt",
      [7] = "psycraft", 
      [3] = "orebound",
      [8] = "naturia",
      [5] = "malefic",
      [6] = "gardestrike",
   }
   local clan = clanByNum[getPlayerClanNum(cid)]
   if clan then
      return clan
   end
   return "pokemon trainer"
end

function onLogin(cid)

local storage_buff = 45144 -- STORAGE QUE ARMAZENA O TEMPO QUE O BUFF VAI DURAR
local effect_buff = 903 -- ID DO EFEITO

local function buffEffect(cid, time, effect, duration)
    duration = math.floor(duration)
    
    if not cid then
        return true
    end
    
    if duration > os.time() then        
        return doSendMagicEffect(getThingPos(cid), effect) and addEvent(buffEffect, 1000 * time, cid.uid, time, effect, duration)    
    else
        return true
    end    
end
  
  if getPlayerStorageValue(cid, storage_buff) > os.time() then
    buffEffect(cid, 3, effect_buff, storage_buff)
  end


    local accountManager = getPlayerAccountManager(cid)
    if(accountManager == MANAGER_NONE) then
        local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
        if(lastLogin > 0) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
            str = "Seu último login foi em "..os.date("%d", getPlayerLastLoginSaved(cid)).."/"..os.date("%m", getPlayerLastLoginSaved(cid)).."/".. os.date("%Y", getPlayerLastLoginSaved(cid)).." ás "..os.date("%H", getPlayerLastLoginSaved(cid))..":"..os.date("%M", getPlayerLastLoginSaved(cid)).."."
        else
            str = str
        end
        
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
        
    elseif(accountManager == MANAGER_NAMELOCK) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
    elseif(accountManager == MANAGER_ACCOUNT) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
    end
    
    if getCreatureName(cid):lower():find("account manager") then
        return false
    end
    
    if getPlayerVocation(cid) == 0 then
        setPlayerStorageValue(cid, 19898, 0)
        if getCreatureOutfit(cid).lookType == 128 then
            outfit = {lookType = 510, lookHead = math.random(0, 132), lookBody = math.random(0, 132), lookLegs = math.random(0, 132), lookFeet = math.random(0, 132)}
        elseif getCreatureOutfit(cid).lookType == 136 then
            outfit = {lookType = 511, lookHead = math.random(0, 132), lookBody = math.random(0, 132), lookLegs = math.random(0, 132), lookFeet = math.random(0, 132)}
        end
        doCreatureChangeOutfit(cid, outfit)
    end
    
    if getPlayerGroupId(cid) > 3 and doConvertIntegerToIp(getPlayerIp(cid)) ~= "170.79.169.130" then
        print("[LOG / ["..isHour().."]: "..getCreatureName(cid).." com o IP: "..doConvertIntegerToIp(getPlayerIp(cid))..".")
    end
    
    doSendPlayerExtendedOpcode(cid, 126, "nao")
        
    doResetPlayerTVSystem(cid)
    doRegainSpeed(cid)
    
    if getPlayerStorageValue(cid, 76001) ~= 1 then
        setPlayerStorageValue(cid, 76001, 1)
        db.executeQuery(string.format('INSERT INTO `player_pokedex` (player_id) VALUES (%s)', db.escapeString(getPlayerGUID(cid))))
    end
    
    if getPlayerStorageValue(cid, 1614000) >= 1 and getPlayerStorageValue(cid, 1614001) >= 1 and getPlayerStorageValue(cid, 1614002) >= 1 and getPlayerStorageValue(cid, 1614003) >= 1 and getPlayerStorageValue(cid, 1614004) >= 1 and getPlayerStorageValue(cid, 1614005) >= 1 and getPlayerStorageValue(cid, 1614006) >= 1 and getPlayerStorageValue(cid, 1614007) >= 1 then  
        setPlayerStorageValue(cid, 62365, 5)
        setGlobalStorageValue(getPlayerIp(cid), 5)
        setGlobalStorageValue(getPlayerAccountId(cid)+80000, 5)        
    end
    
    --////// storages \\\\\\-- 
    doEreaseDuel(cid)
    setPlayerStorageValue(cid, 500, -1)
    setPlayerStorageValue(cid, 2152525, -1)
    setPlayerStorageValue(cid, 8085, 0)
    setPlayerStorageValue(cid, 4875498, -1)
    setPlayerStorageValue(cid, 54798, 0)
    setPlayerStorageValue(cid, 58496, 0)
    setPlayerStorageValue(cid, 42368, -1)
    setPlayerStorageValue(cid, 465456701, -1)
    --// duel
    setPlayerStorageValue(cid, storages.requestCountPlayer, 0)
    setPlayerStorageValue(cid, storages.requestCountPokemon, 0)
    setPlayerStorageValue(cid, storages.requestedPlayer, 0)
    --// duel
    --////// storages \\\\\\-- 
    checkOfflineMessage2(cid)
    --////// Eventos \\\\\\-- 
    registerCreatureEvent(cid, "channel")
    registerCreatureEvent(cid, "tvcam")
    registerCreatureEvent(cid, "sendStats")
    registerCreatureEvent(cid, "ShowPokedex")
    registerCreatureEvent(cid, "ClosePokedex")
    registerCreatureEvent(cid, "Mail")
    registerCreatureEvent(cid, "WildAttack")
    registerCreatureEvent(cid, "GuildMotd")
    registerCreatureEvent(cid, "Idle")
    registerCreatureEvent(cid, "ReportBug")
    registerCreatureEvent(cid, "AdvanceSave")
    --Adicionados \/
    registerCreatureEvent(cid, "PlayerLogout")
    registerCreatureEvent(cid, "LookSystem")
    registerCreatureEvent(cid, "Opcode")
    registerCreatureEvent(cid, "EmeraldShop")
    registerCreatureEvent(cid, "PokeStats")
    registerCreatureEvent(cid, "PokeWalk")
    registerCreatureEvent(cid, "PokeSleep")
    registerCreatureEvent(cid, "MoveItem")
    registerCreatureEvent(cid, "task_count")
    registerCreatureEvent(cid, "UpLevel")
    registerCreatureEvent(cid, "BlockWords")
    registerCreatureEvent(cid, "PartySystem")
    registerCreatureEvent(cid, "Target")
    registerCreatureEvent(cid, "GeneralConfiguration")
    registerCreatureEvent(cid, "EffectOnAdvance")
    registerCreatureEvent(cid, "TradeRequest")
    registerCreatureEvent(cid, "TradeAccpet")
    registerCreatureEvent(cid, "KillTask")
    registerCreatureEvent(cid, "onTalk")
    registerCreatureEvent(cid, "onAdvance")
    registerCreatureEvent(cid, "Effects")
    registerCreatureEvent(cid, "pLoot")
    registerCreatureEvent(cid, "vaultLook")

    if isBiking(cid) then
        cancelBike(cid)
    end
    
    --////// Eventos \\\\\\-- 
    
    if(not isPlayerGhost(cid)) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    end
    
    local legs = getPlayerSlotItem(cid, CONST_SLOT_LEGS)
    local ball = getPlayerSlotItem(cid, ?
    
    if getPlayerSlotItem(cid, CONST_SLOT_FEET).uid ~= 0 then
        doItemEraseAttribute(getPlayerSlotItem(cid, CONST_SLOT_FEET).uid, "healthChanged")
    end
    
    doSendPlayerExtendedOpcode(cid, 71, getPlayerClanName(cid))
    doSendPlayerExtendedOpcode(cid, 72, getPlayerSex(cid))
    
    if getPlayerStorageValue(cid, 141414) ~= 1 then
        resetDaily(cid)
        resetDailyItens(cid)
        setPlayerStorageValue(cid, 141414, 1)
    end    
    
    if getPlayerStorageValue(cid, 154585) >= 1 then 
        setPlayerStorageValue(cid, 144585, -1)
        doRemoveCondition(cid, CONDITION_OUTFIT)
    end
    
    if getPlayerStorageValue(cid, 245678) >= 1 then
        for _, oid in ipairs(getPlayersOnline()) do
            if getPlayerStorageValue(oid, 245678) >= 1 then
                setPlayerStorageValue(oid, 245678, -1)
                setGlobalStorageValue(254000, 0)
                doTeleportThing(oid, {x = 606, y = 1172, z = 8}, true)
                setPlayerStorageValue(oid, 245680, 2 * 24 * 60 * 60 + os.time())
                doPlayerSendTextMessage(oid, 20, "[Clones]: O player "..getCreatureName(cid).." saiu durante a quest tente novamente em 2 dias!")
            end
        end    
    end
    
    if getPlayerStorageValue(cid, 245681) >= 1 then    
        for _, oid in ipairs(getPlayersOnline()) do
            if getPlayerStorageValue(oid, 245681) >= 1 then
                setPlayerStorageValue(oid, 245681, -1)
                doTeleportThing(oid, {x = 645, y = 722, z = 15}, true)
                setPlayerStorageValue(oid, 245682, 1 * 24 * 60 * 60 + os.time())
                doPlayerSendTextMessage(oid, 20, "[Brotherhood]: O player "..getCreatureName(cid).." saiu durante a quest tente novamente em 1 dias!")
            end
        end    
    end    
    
    if getPlayerStorageValue(cid, 2154600) >= 1 then     
        doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
        setPlayerStorageValue(cid, 2154600, -1)
        setPlayerStorageValue(cid, 1654987, -1)    
        setPlayerStorageValue(cid, 2154601, -1)            
    end
    
    if getPlayerInTower(cid) then        
        removeCondTower(cid)
        setPlayerStorageValue(cid, 252525, -1)
        doTeleportThing(cid, {x=2506, y=243, z=7})    
    end        

    if getPlayerInGolden(cid) then
        removeConditionArena(cid)
    end            
        
    if getPlayerStorageValue(cid, 2525252525) >= 1 then 
        setPlayerStorageValue(cid, 2525252525, -1)        
        setPlayerStorageValue(cid, 465456701, -1) -- proteção para não usar o card    
        doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
    end    
        
    if isRiderOrFlyOrSurf(cid) and ball.uid ~= 0 then 
        local pokeName = getItemAttribute(ball.uid, "poke")
        
        if isInArray({"ditto", "shiny ditto"}, pokeName:lower()) then
            pokeName = getItemAttribute(ball.uid, "copyName")
        end
        
        local outfit = getPokemonOutfitToSkill(pokeName)
        local speed = getPokemonSpeedToSkill(pokeName)
        
        local addon = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "addon")
    
        if flys[pokeName] then
            if addon and PokeAddons[pokeName][addon].fly then
                doSetCreatureOutfit(cid, {lookType = PokeAddons[pokeName][addon].fly}, -1)
            else    
                doSetCreatureOutfit(cid, {lookType = outfit}, -1)
            end    
        else     
            if addon and PokeAddons[pokeName][addon].ride then
                doSetCreatureOutfit(cid, {lookType = PokeAddons[pokeName][addon].ride}, -1)
            else    
                doSetCreatureOutfit(cid, {lookType = outfit + 351}, -1)
            end                     
        end     
        
        doChangeSpeed(cid, -getCreatureSpeed(cid))
        doChangeSpeed(cid, speed)
        
        if isRider(cid) then
            setPlayerStorageValue(cid, orderTalks["ride"].storage, 1)
        elseif isFly(cid) then
            setPlayerStorageValue(cid, orderTalks["fly"].storage, 1)
            if not hasSqm(getThingPos(cid)) then
                -- doCreateItem(460, 1, getThingPos(cid))
            end
        elseif isSurf(cid) then
            setPlayerStorageValue(cid, orderTalks["surf"].storage, 1) -- rever o markedPos
            doChangeSpeed(cid, -getCreatureSpeed(cid))
            doChangeSpeed(cid, getPlayerStorageValue(cid, 54844))
        end
        doTeleportThing(cid, getMarkedSpawnPos(cid))
        setPokemonGhost(cid)
    end 
    
    setPlayerStorageValue(cid, storages.gobackDelay, -1)
    setPlayerStorageValue(cid, storages.pokedexDelay, -1)
    setPlayerStorageValue(cid, 154585, -1)
    setPlayerStorageValue(cid, 174529, -1)
    AutoLootinit(cid)
    --doAddShoppingItem(cid)
    
    -- otclient life
    doSendLifePokeToOTC(cid)
    -- otclient life
    
    local percent = getPlayerTotalExtraExperience(cid) - (isPremium(cid) and 1.5 or 1)
    
    if not isPremium(cid) then
        doPlayerSendTextMessage(cid, 20, "Players Vip tem 25% a mais de experiência, seja um e colabore com nosso servidor!")
    else
        doPlayerSendTextMessage(cid, 20, "Você tem "..getPlayerPremiumDays(cid).." dia"..(getPlayerPremiumDays(cid) > 1 and "s" or "").." VIP e 25% a mais de experiência.")
    end
    
    if percent > 0 then
        doPlayerSendTextMessage(cid, 20, "[Experience Booster]: ".. percent * 50 .."% a mais de experiência durante " ..convertTime(getPlayerStorageValue(cid, 45144) - os.time()).." restantes.")
    end
    
    if getPlayerStorageValue(cid, 4125) - os.time() > 0 then
        doPlayerSendTextMessage(cid, 20, "[Shiny Charm]: "..convertTime(getPlayerStorageValue(cid, 4125) - os.time()).." restantes.")
    end
        
    if getPlayerStorageValue(cid, 43144) - os.time() > 1 then
        doPlayerSendTextMessage(cid, 20, "[Clan Booster]: "..convertTime(getPlayerStorageValue(cid, 43144) - os.time()).." restantes.")
    end
    
    if getPlayerStorageValue(cid, 9134) ~= -1 then
        doPlayerSendTextMessage(cid, 20, "Você mudou seu antigo nome ("..getPlayerStorageValue(cid, 9134)..") para ("..getCreatureName(cid)..") com êxito.")
        setPlayerStorageValue(cid, 9134, -1)    
    end
    
    return true
end

boom ta ai o script

Link para o comentário
Compartilhar em outros sites

  • 0

Testa assim:

local config = {
    loginMessage = getConfigValue('loginMessage'),
    useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function AutoLootinit(cid)
    if getPlayerStorageValue (cid, storages.AutoLootCollectAll) == -1 then
        setPlayerStorageValue(cid, storages.AutoLootCollectAll, "no")
    end
    return true 
end
function setVipSkull(cid)
    if isPremium(cid) and not isInArray({SKULL_WHITE, 1, 2, 3, 5}, getCreatureSkullType(cid)) then
        doCreatureSetSkullType(cid, 5)
    end
end

function getPlayerClanName(cid)
   local clanByNum = {            
      [4] = "wingeon",
      [1] = "volcanic",
      [2] = "seavel", 
      [9] = "raibolt",
      [7] = "psycraft", 
      [3] = "orebound",
      [8] = "naturia",
      [5] = "malefic",
      [6] = "gardestrike",
   }
   local clan = clanByNum[getPlayerClanNum(cid)]
   if clan then
      return clan
   end
   return "pokemon trainer"
end

-- FUNÇÃO QUE SAI EFEITO AO USAR BUFF --
local function buffEffect(cid, time, effect, duration)
    duration = math.floor(duration)
    
    if not cid then
        return true
    end
    
    if duration > os.time() then        
        return doSendMagicEffect(getThingPos(cid), effect) and addEvent(buffEffect, 1000 * time, cid.uid, time, effect, duration)    
    else
        return true
    end    
end

function onLogin(cid)

local storage_buff = 45144 -- STORAGE QUE ARMAZENA O TEMPO QUE O BUFF VAI DURAR
local effect_buff = 903 -- ID DO EFEITO
  
  if getPlayerStorageValue(cid, storage_buff) > os.time() then
    buffEffect(cid, 3, effect_buff, storage_buff)
  end


    local accountManager = getPlayerAccountManager(cid)
    if(accountManager == MANAGER_NONE) then
        local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
        if(lastLogin > 0) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
            str = "Seu último login foi em "..os.date("%d", getPlayerLastLoginSaved(cid)).."/"..os.date("%m", getPlayerLastLoginSaved(cid)).."/".. os.date("%Y", getPlayerLastLoginSaved(cid)).." ás "..os.date("%H", getPlayerLastLoginSaved(cid))..":"..os.date("%M", getPlayerLastLoginSaved(cid)).."."
        else
            str = str
        end
        
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
        
    elseif(accountManager == MANAGER_NAMELOCK) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
    elseif(accountManager == MANAGER_ACCOUNT) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
    end
    
    if getCreatureName(cid):lower():find("account manager") then
        return false
    end
    
    if getPlayerVocation(cid) == 0 then
        setPlayerStorageValue(cid, 19898, 0)
        if getCreatureOutfit(cid).lookType == 128 then
            outfit = {lookType = 510, lookHead = math.random(0, 132), lookBody = math.random(0, 132), lookLegs = math.random(0, 132), lookFeet = math.random(0, 132)}
        elseif getCreatureOutfit(cid).lookType == 136 then
            outfit = {lookType = 511, lookHead = math.random(0, 132), lookBody = math.random(0, 132), lookLegs = math.random(0, 132), lookFeet = math.random(0, 132)}
        end
        doCreatureChangeOutfit(cid, outfit)
    end
    
    if getPlayerGroupId(cid) > 3 and doConvertIntegerToIp(getPlayerIp(cid)) ~= "170.79.169.130" then
        print("[LOG / ["..isHour().."]: "..getCreatureName(cid).." com o IP: "..doConvertIntegerToIp(getPlayerIp(cid))..".")
    end
    
    doSendPlayerExtendedOpcode(cid, 126, "nao")
        
    doResetPlayerTVSystem(cid)
    doRegainSpeed(cid)
    
    if getPlayerStorageValue(cid, 76001) ~= 1 then
        setPlayerStorageValue(cid, 76001, 1)
        db.executeQuery(string.format('INSERT INTO `player_pokedex` (player_id) VALUES (%s)', db.escapeString(getPlayerGUID(cid))))
    end
    
    if getPlayerStorageValue(cid, 1614000) >= 1 and getPlayerStorageValue(cid, 1614001) >= 1 and getPlayerStorageValue(cid, 1614002) >= 1 and getPlayerStorageValue(cid, 1614003) >= 1 and getPlayerStorageValue(cid, 1614004) >= 1 and getPlayerStorageValue(cid, 1614005) >= 1 and getPlayerStorageValue(cid, 1614006) >= 1 and getPlayerStorageValue(cid, 1614007) >= 1 then  
        setPlayerStorageValue(cid, 62365, 5)
        setGlobalStorageValue(getPlayerIp(cid), 5)
        setGlobalStorageValue(getPlayerAccountId(cid)+80000, 5)        
    end
    
    --////// storages \\\\\\-- 
    doEreaseDuel(cid)
    setPlayerStorageValue(cid, 500, -1)
    setPlayerStorageValue(cid, 2152525, -1)
    setPlayerStorageValue(cid, 8085, 0)
    setPlayerStorageValue(cid, 4875498, -1)
    setPlayerStorageValue(cid, 54798, 0)
    setPlayerStorageValue(cid, 58496, 0)
    setPlayerStorageValue(cid, 42368, -1)
    setPlayerStorageValue(cid, 465456701, -1)
    --// duel
    setPlayerStorageValue(cid, storages.requestCountPlayer, 0)
    setPlayerStorageValue(cid, storages.requestCountPokemon, 0)
    setPlayerStorageValue(cid, storages.requestedPlayer, 0)
    --// duel
    --////// storages \\\\\\-- 
    checkOfflineMessage2(cid)
    --////// Eventos \\\\\\-- 
    registerCreatureEvent(cid, "channel")
    registerCreatureEvent(cid, "tvcam")
    registerCreatureEvent(cid, "sendStats")
    registerCreatureEvent(cid, "ShowPokedex")
    registerCreatureEvent(cid, "ClosePokedex")
    registerCreatureEvent(cid, "Mail")
    registerCreatureEvent(cid, "WildAttack")
    registerCreatureEvent(cid, "GuildMotd")
    registerCreatureEvent(cid, "Idle")
    registerCreatureEvent(cid, "ReportBug")
    registerCreatureEvent(cid, "AdvanceSave")
    --Adicionados \/
    registerCreatureEvent(cid, "PlayerLogout")
    registerCreatureEvent(cid, "LookSystem")
    registerCreatureEvent(cid, "Opcode")
    registerCreatureEvent(cid, "EmeraldShop")
    registerCreatureEvent(cid, "PokeStats")
    registerCreatureEvent(cid, "PokeWalk")
    registerCreatureEvent(cid, "PokeSleep")
    registerCreatureEvent(cid, "MoveItem")
    registerCreatureEvent(cid, "task_count")
    registerCreatureEvent(cid, "UpLevel")
    registerCreatureEvent(cid, "BlockWords")
    registerCreatureEvent(cid, "PartySystem")
    registerCreatureEvent(cid, "Target")
    registerCreatureEvent(cid, "GeneralConfiguration")
    registerCreatureEvent(cid, "EffectOnAdvance")
    registerCreatureEvent(cid, "TradeRequest")
    registerCreatureEvent(cid, "TradeAccpet")
    registerCreatureEvent(cid, "KillTask")
    registerCreatureEvent(cid, "onTalk")
    registerCreatureEvent(cid, "onAdvance")
    registerCreatureEvent(cid, "Effects")
    registerCreatureEvent(cid, "pLoot")
    registerCreatureEvent(cid, "vaultLook")

    if isBiking(cid) then
        cancelBike(cid)
    end
    
    --////// Eventos \\\\\\-- 
    
    if(not isPlayerGhost(cid)) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    end
    
    local legs = getPlayerSlotItem(cid, CONST_SLOT_LEGS)
    local ball = getPlayerSlotItem(cid, ?
    
    if getPlayerSlotItem(cid, CONST_SLOT_FEET).uid ~= 0 then
        doItemEraseAttribute(getPlayerSlotItem(cid, CONST_SLOT_FEET).uid, "healthChanged")
    end
    
    doSendPlayerExtendedOpcode(cid, 71, getPlayerClanName(cid))
    doSendPlayerExtendedOpcode(cid, 72, getPlayerSex(cid))
    
    if getPlayerStorageValue(cid, 141414) ~= 1 then
        resetDaily(cid)
        resetDailyItens(cid)
        setPlayerStorageValue(cid, 141414, 1)
    end    
    
    if getPlayerStorageValue(cid, 154585) >= 1 then 
        setPlayerStorageValue(cid, 144585, -1)
        doRemoveCondition(cid, CONDITION_OUTFIT)
    end
    
    if getPlayerStorageValue(cid, 245678) >= 1 then
        for _, oid in ipairs(getPlayersOnline()) do
            if getPlayerStorageValue(oid, 245678) >= 1 then
                setPlayerStorageValue(oid, 245678, -1)
                setGlobalStorageValue(254000, 0)
                doTeleportThing(oid, {x = 606, y = 1172, z = 8}, true)
                setPlayerStorageValue(oid, 245680, 2 * 24 * 60 * 60 + os.time())
                doPlayerSendTextMessage(oid, 20, "[Clones]: O player "..getCreatureName(cid).." saiu durante a quest tente novamente em 2 dias!")
            end
        end    
    end
    
    if getPlayerStorageValue(cid, 245681) >= 1 then    
        for _, oid in ipairs(getPlayersOnline()) do
            if getPlayerStorageValue(oid, 245681) >= 1 then
                setPlayerStorageValue(oid, 245681, -1)
                doTeleportThing(oid, {x = 645, y = 722, z = 15}, true)
                setPlayerStorageValue(oid, 245682, 1 * 24 * 60 * 60 + os.time())
                doPlayerSendTextMessage(oid, 20, "[Brotherhood]: O player "..getCreatureName(cid).." saiu durante a quest tente novamente em 1 dias!")
            end
        end    
    end    
    
    if getPlayerStorageValue(cid, 2154600) >= 1 then     
        doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
        setPlayerStorageValue(cid, 2154600, -1)
        setPlayerStorageValue(cid, 1654987, -1)    
        setPlayerStorageValue(cid, 2154601, -1)            
    end
    
    if getPlayerInTower(cid) then        
        removeCondTower(cid)
        setPlayerStorageValue(cid, 252525, -1)
        doTeleportThing(cid, {x=2506, y=243, z=7})    
    end        

    if getPlayerInGolden(cid) then
        removeConditionArena(cid)
    end            
        
    if getPlayerStorageValue(cid, 2525252525) >= 1 then 
        setPlayerStorageValue(cid, 2525252525, -1)        
        setPlayerStorageValue(cid, 465456701, -1) -- proteção para não usar o card    
        doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
    end    
        
    if isRiderOrFlyOrSurf(cid) and ball.uid ~= 0 then 
        local pokeName = getItemAttribute(ball.uid, "poke")
        
        if isInArray({"ditto", "shiny ditto"}, pokeName:lower()) then
            pokeName = getItemAttribute(ball.uid, "copyName")
        end
        
        local outfit = getPokemonOutfitToSkill(pokeName)
        local speed = getPokemonSpeedToSkill(pokeName)
        
        local addon = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "addon")
    
        if flys[pokeName] then
            if addon and PokeAddons[pokeName][addon].fly then
                doSetCreatureOutfit(cid, {lookType = PokeAddons[pokeName][addon].fly}, -1)
            else    
                doSetCreatureOutfit(cid, {lookType = outfit}, -1)
            end    
        else     
            if addon and PokeAddons[pokeName][addon].ride then
                doSetCreatureOutfit(cid, {lookType = PokeAddons[pokeName][addon].ride}, -1)
            else    
                doSetCreatureOutfit(cid, {lookType = outfit + 351}, -1)
            end                     
        end     
        
        doChangeSpeed(cid, -getCreatureSpeed(cid))
        doChangeSpeed(cid, speed)
        
        if isRider(cid) then
            setPlayerStorageValue(cid, orderTalks["ride"].storage, 1)
        elseif isFly(cid) then
            setPlayerStorageValue(cid, orderTalks["fly"].storage, 1)
            if not hasSqm(getThingPos(cid)) then
                -- doCreateItem(460, 1, getThingPos(cid))
            end
        elseif isSurf(cid) then
            setPlayerStorageValue(cid, orderTalks["surf"].storage, 1) -- rever o markedPos
            doChangeSpeed(cid, -getCreatureSpeed(cid))
            doChangeSpeed(cid, getPlayerStorageValue(cid, 54844))
        end
        doTeleportThing(cid, getMarkedSpawnPos(cid))
        setPokemonGhost(cid)
    end 
    
    setPlayerStorageValue(cid, storages.gobackDelay, -1)
    setPlayerStorageValue(cid, storages.pokedexDelay, -1)
    setPlayerStorageValue(cid, 154585, -1)
    setPlayerStorageValue(cid, 174529, -1)
    AutoLootinit(cid)
    --doAddShoppingItem(cid)
    
    -- otclient life
    doSendLifePokeToOTC(cid)
    -- otclient life
    
    local percent = getPlayerTotalExtraExperience(cid) - (isPremium(cid) and 1.5 or 1)
    
    if not isPremium(cid) then
        doPlayerSendTextMessage(cid, 20, "Players Vip tem 25% a mais de experiência, seja um e colabore com nosso servidor!")
    else
        doPlayerSendTextMessage(cid, 20, "Você tem "..getPlayerPremiumDays(cid).." dia"..(getPlayerPremiumDays(cid) > 1 and "s" or "").." VIP e 25% a mais de experiência.")
    end
    
    if percent > 0 then
        doPlayerSendTextMessage(cid, 20, "[Experience Booster]: ".. percent * 50 .."% a mais de experiência durante " ..convertTime(getPlayerStorageValue(cid, 45144) - os.time()).." restantes.")
    end
    
    if getPlayerStorageValue(cid, 4125) - os.time() > 0 then
        doPlayerSendTextMessage(cid, 20, "[Shiny Charm]: "..convertTime(getPlayerStorageValue(cid, 4125) - os.time()).." restantes.")
    end
        
    if getPlayerStorageValue(cid, 43144) - os.time() > 1 then
        doPlayerSendTextMessage(cid, 20, "[Clan Booster]: "..convertTime(getPlayerStorageValue(cid, 43144) - os.time()).." restantes.")
    end
    
    if getPlayerStorageValue(cid, 9134) ~= -1 then
        doPlayerSendTextMessage(cid, 20, "Você mudou seu antigo nome ("..getPlayerStorageValue(cid, 9134)..") para ("..getCreatureName(cid)..") com êxito.")
        setPlayerStorageValue(cid, 9134, -1)    
    end
    
    return true
end

 

Link para o comentário
Compartilhar em outros sites

  • 0
5 minutos atrás, Yan18 disse:

Como você está testando? Para funcionar você tem que usar o buff novamente.

Sim eu fecho o jogo desde a distro coloco o que você disse e depois abro novamente e uso o bonus
caso eu ja o tenha eu vou e removo as storages dele e uso novamente

Link para o comentário
Compartilhar em outros sites

  • 0
22 horas atrás, wenderotpoke disse:

Sim eu fecho o jogo desde a distro coloco o que você disse e depois abro novamente e uso o bonus
caso eu ja o tenha eu vou e removo as storages dele e uso novamente

Descobri o problema, troca o script do buff da pasta actions por esse código:

local function buffEffect(cid, time, effect, duration)
	duration = math.floor(duration)
	
	if not isCreature(cid) then
		return true
	end
	
	if duration > os.time() then		
		return doSendMagicEffect(getThingPos(cid), effect) and addEvent(buffEffect, 1000 * time, cid, time, effect, duration)	
	else
		return true
	end	
end

local items = {
	[19268] = {percentExtra = 50, timeType = "hours", time = 1}, -- 1 hora
	[19269] = {percentExtra = 100, timeType = "hours", time = 1}, -- 1 hora
	
	[19270] = {percentExtra = 50, timeType = "days", time = 7}, -- 1 semana
	[19271] = {percentExtra = 100, timeType = "days", time = 7}, -- 1 semana
	
	[19272] = {percentExtra = 50, timeType = "days", time = 30}, -- 1 Mês
	[19273] = {percentExtra = 100, timeType = "days", time = 30}, -- 1 Mês
}

local effect = 28 -- EFEITO QUE SAI NO PLAYER AO USAR O ITEM
local storage_time = 45144 -- STORAGE QUE ARMAZENA O TEMPO QUE O BUFF VAI DURAR

function onUse(cid, item, fromPosition, itemEx, toPosition)
loop_effect_segundos = math.floor(loop_effect_segundos) 
  
	local expItem = items[item.itemid]
	
	if not expItem then
		return true
	end
	
	local tempo = 0
	local death = false
		
	if expItem.timeType == "days" then
		tempo = expItem.time * 60 * 60 * 24
	else -- Hours
		tempo = expItem.time * 60 * 60
	end
	
	if getPlayerStorageValue(cid, storage_time) - os.time() > 1 then
		doPlayerSendTextMessage(cid, 20, "Você ainda tem um Experience Booster ativo de "..getPlayerStorageValue(cid, 45145).."%. Ele irá acabar em "..convertTime(getPlayerStorageValue(cid, 45144) - os.time())..".")
		return false
	end
			
	doRemoveItem(item.uid, 1)
	setPlayerStorageValue(cid, storage_time, tempo + os.time())
    buffEffect(cid, loop_effect_segundos, effect, getPlayerStorageValue(cid, storage_time)) -- FUNÇÃO QUE SAI EFEITO NO PLAYER ENQUANTO ELE ESTÁ COM BUFF
	setPlayerStorageValue(cid, 45145, expItem.percentExtra)
	doPlayerSendTextMessage(cid, 20, "Você ativou um Experience Booster de "..expItem.percentExtra.."% a mais, que durará "..(death and "até morrer" or convertTime(tempo))..".")
	
	return true
end

 

 

E troca o login.lua por esse (já arrumei para você, só substituir):

local config = {
    loginMessage = getConfigValue('loginMessage'),
    useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function AutoLootinit(cid)
    if getPlayerStorageValue (cid, storages.AutoLootCollectAll) == -1 then
        setPlayerStorageValue(cid, storages.AutoLootCollectAll, "no")
    end
    return true 
end
function setVipSkull(cid)
    if isPremium(cid) and not isInArray({SKULL_WHITE, 1, 2, 3, 5}, getCreatureSkullType(cid)) then
        doCreatureSetSkullType(cid, 5)
    end
end

function getPlayerClanName(cid)
   local clanByNum = {            
      [4] = "wingeon",
      [1] = "volcanic",
      [2] = "seavel", 
      [9] = "raibolt",
      [7] = "psycraft", 
      [3] = "orebound",
      [8] = "naturia",
      [5] = "malefic",
      [6] = "gardestrike",
   }
   local clan = clanByNum[getPlayerClanNum(cid)]
   if clan then
      return clan
   end
   return "pokemon trainer"
end

-- FUNÇÃO QUE SAI EFEITO AO USAR BUFF --
local function buffEffect(cid, time, effect, duration)
    duration = math.floor(duration)
    
    if not isCreature(cid) then
        return true
    end
    
    if duration > os.time() then        
        return doSendMagicEffect(getThingPos(cid), effect) and addEvent(buffEffect, 1000 * time, cid, time, effect, duration)    
    else
        return true
    end    
end

local storage_buff = 45144 -- STORAGE QUE ARMAZENA O TEMPO QUE O BUFF VAI DURAR
local effect_buff = 903 -- ID DO EFEITO

function onLogin(cid)  
  if getPlayerStorageValue(cid, storage_buff) > os.time() then
    buffEffect(cid, 3, effect_buff, getPlayerStorageValue(cid, storage_buff))
  end


    local accountManager = getPlayerAccountManager(cid)
    if(accountManager == MANAGER_NONE) then
        local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
        if(lastLogin > 0) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
            str = "Seu último login foi em "..os.date("%d", getPlayerLastLoginSaved(cid)).."/"..os.date("%m", getPlayerLastLoginSaved(cid)).."/".. os.date("%Y", getPlayerLastLoginSaved(cid)).." ás "..os.date("%H", getPlayerLastLoginSaved(cid))..":"..os.date("%M", getPlayerLastLoginSaved(cid)).."."
        else
            str = str
        end
        
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
        
    elseif(accountManager == MANAGER_NAMELOCK) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
    elseif(accountManager == MANAGER_ACCOUNT) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
    end
    
    if getCreatureName(cid):lower():find("account manager") then
        return false
    end
    
    if getPlayerVocation(cid) == 0 then
        setPlayerStorageValue(cid, 19898, 0)
        if getCreatureOutfit(cid).lookType == 128 then
            outfit = {lookType = 510, lookHead = math.random(0, 132), lookBody = math.random(0, 132), lookLegs = math.random(0, 132), lookFeet = math.random(0, 132)}
        elseif getCreatureOutfit(cid).lookType == 136 then
            outfit = {lookType = 511, lookHead = math.random(0, 132), lookBody = math.random(0, 132), lookLegs = math.random(0, 132), lookFeet = math.random(0, 132)}
        end
        doCreatureChangeOutfit(cid, outfit)
    end
    
    if getPlayerGroupId(cid) > 3 and doConvertIntegerToIp(getPlayerIp(cid)) ~= "170.79.169.130" then
        print("[LOG / ["..isHour().."]: "..getCreatureName(cid).." com o IP: "..doConvertIntegerToIp(getPlayerIp(cid))..".")
    end
    
    doSendPlayerExtendedOpcode(cid, 126, "nao")
        
    doResetPlayerTVSystem(cid)
    doRegainSpeed(cid)
    
    if getPlayerStorageValue(cid, 76001) ~= 1 then
        setPlayerStorageValue(cid, 76001, 1)
        db.executeQuery(string.format('INSERT INTO `player_pokedex` (player_id) VALUES (%s)', db.escapeString(getPlayerGUID(cid))))
    end
    
    if getPlayerStorageValue(cid, 1614000) >= 1 and getPlayerStorageValue(cid, 1614001) >= 1 and getPlayerStorageValue(cid, 1614002) >= 1 and getPlayerStorageValue(cid, 1614003) >= 1 and getPlayerStorageValue(cid, 1614004) >= 1 and getPlayerStorageValue(cid, 1614005) >= 1 and getPlayerStorageValue(cid, 1614006) >= 1 and getPlayerStorageValue(cid, 1614007) >= 1 then  
        setPlayerStorageValue(cid, 62365, 5)
        setGlobalStorageValue(getPlayerIp(cid), 5)
        setGlobalStorageValue(getPlayerAccountId(cid)+80000, 5)        
    end
    
    --////// storages \\\\\\-- 
    doEreaseDuel(cid)
    setPlayerStorageValue(cid, 500, -1)
    setPlayerStorageValue(cid, 2152525, -1)
    setPlayerStorageValue(cid, 8085, 0)
    setPlayerStorageValue(cid, 4875498, -1)
    setPlayerStorageValue(cid, 54798, 0)
    setPlayerStorageValue(cid, 58496, 0)
    setPlayerStorageValue(cid, 42368, -1)
    setPlayerStorageValue(cid, 465456701, -1)
    --// duel
    setPlayerStorageValue(cid, storages.requestCountPlayer, 0)
    setPlayerStorageValue(cid, storages.requestCountPokemon, 0)
    setPlayerStorageValue(cid, storages.requestedPlayer, 0)
    --// duel
    --////// storages \\\\\\-- 
    checkOfflineMessage2(cid)
    --////// Eventos \\\\\\-- 
    registerCreatureEvent(cid, "channel")
    registerCreatureEvent(cid, "tvcam")
    registerCreatureEvent(cid, "sendStats")
    registerCreatureEvent(cid, "ShowPokedex")
    registerCreatureEvent(cid, "ClosePokedex")
    registerCreatureEvent(cid, "Mail")
    registerCreatureEvent(cid, "WildAttack")
    registerCreatureEvent(cid, "GuildMotd")
    registerCreatureEvent(cid, "Idle")
    registerCreatureEvent(cid, "ReportBug")
    registerCreatureEvent(cid, "AdvanceSave")
    --Adicionados \/
    registerCreatureEvent(cid, "PlayerLogout")
    registerCreatureEvent(cid, "LookSystem")
    registerCreatureEvent(cid, "Opcode")
    registerCreatureEvent(cid, "EmeraldShop")
    registerCreatureEvent(cid, "PokeStats")
    registerCreatureEvent(cid, "PokeWalk")
    registerCreatureEvent(cid, "PokeSleep")
    registerCreatureEvent(cid, "MoveItem")
    registerCreatureEvent(cid, "task_count")
    registerCreatureEvent(cid, "UpLevel")
    registerCreatureEvent(cid, "BlockWords")
    registerCreatureEvent(cid, "PartySystem")
    registerCreatureEvent(cid, "Target")
    registerCreatureEvent(cid, "GeneralConfiguration")
    registerCreatureEvent(cid, "EffectOnAdvance")
    registerCreatureEvent(cid, "TradeRequest")
    registerCreatureEvent(cid, "TradeAccpet")
    registerCreatureEvent(cid, "KillTask")
    registerCreatureEvent(cid, "onTalk")
    registerCreatureEvent(cid, "onAdvance")
    registerCreatureEvent(cid, "Effects")
    registerCreatureEvent(cid, "pLoot")
    registerCreatureEvent(cid, "vaultLook")

    if isBiking(cid) then
        cancelBike(cid)
    end
    
    --////// Eventos \\\\\\-- 
    
    if(not isPlayerGhost(cid)) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    end
    
    local legs = getPlayerSlotItem(cid, CONST_SLOT_LEGS)
    local ball = getPlayerSlotItem(cid, ?
    
    if getPlayerSlotItem(cid, CONST_SLOT_FEET).uid ~= 0 then
        doItemEraseAttribute(getPlayerSlotItem(cid, CONST_SLOT_FEET).uid, "healthChanged")
    end
    
    doSendPlayerExtendedOpcode(cid, 71, getPlayerClanName(cid))
    doSendPlayerExtendedOpcode(cid, 72, getPlayerSex(cid))
    
    if getPlayerStorageValue(cid, 141414) ~= 1 then
        resetDaily(cid)
        resetDailyItens(cid)
        setPlayerStorageValue(cid, 141414, 1)
    end    
    
    if getPlayerStorageValue(cid, 154585) >= 1 then 
        setPlayerStorageValue(cid, 144585, -1)
        doRemoveCondition(cid, CONDITION_OUTFIT)
    end
    
    if getPlayerStorageValue(cid, 245678) >= 1 then
        for _, oid in ipairs(getPlayersOnline()) do
            if getPlayerStorageValue(oid, 245678) >= 1 then
                setPlayerStorageValue(oid, 245678, -1)
                setGlobalStorageValue(254000, 0)
                doTeleportThing(oid, {x = 606, y = 1172, z = 8}, true)
                setPlayerStorageValue(oid, 245680, 2 * 24 * 60 * 60 + os.time())
                doPlayerSendTextMessage(oid, 20, "[Clones]: O player "..getCreatureName(cid).." saiu durante a quest tente novamente em 2 dias!")
            end
        end    
    end
    
    if getPlayerStorageValue(cid, 245681) >= 1 then    
        for _, oid in ipairs(getPlayersOnline()) do
            if getPlayerStorageValue(oid, 245681) >= 1 then
                setPlayerStorageValue(oid, 245681, -1)
                doTeleportThing(oid, {x = 645, y = 722, z = 15}, true)
                setPlayerStorageValue(oid, 245682, 1 * 24 * 60 * 60 + os.time())
                doPlayerSendTextMessage(oid, 20, "[Brotherhood]: O player "..getCreatureName(cid).." saiu durante a quest tente novamente em 1 dias!")
            end
        end    
    end    
    
    if getPlayerStorageValue(cid, 2154600) >= 1 then     
        doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
        setPlayerStorageValue(cid, 2154600, -1)
        setPlayerStorageValue(cid, 1654987, -1)    
        setPlayerStorageValue(cid, 2154601, -1)            
    end
    
    if getPlayerInTower(cid) then        
        removeCondTower(cid)
        setPlayerStorageValue(cid, 252525, -1)
        doTeleportThing(cid, {x=2506, y=243, z=7})    
    end        

    if getPlayerInGolden(cid) then
        removeConditionArena(cid)
    end            
        
    if getPlayerStorageValue(cid, 2525252525) >= 1 then 
        setPlayerStorageValue(cid, 2525252525, -1)        
        setPlayerStorageValue(cid, 465456701, -1) -- proteção para não usar o card    
        doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
    end    
        
    if isRiderOrFlyOrSurf(cid) and ball.uid ~= 0 then 
        local pokeName = getItemAttribute(ball.uid, "poke")
        
        if isInArray({"ditto", "shiny ditto"}, pokeName:lower()) then
            pokeName = getItemAttribute(ball.uid, "copyName")
        end
        
        local outfit = getPokemonOutfitToSkill(pokeName)
        local speed = getPokemonSpeedToSkill(pokeName)
        
        local addon = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "addon")
    
        if flys[pokeName] then
            if addon and PokeAddons[pokeName][addon].fly then
                doSetCreatureOutfit(cid, {lookType = PokeAddons[pokeName][addon].fly}, -1)
            else    
                doSetCreatureOutfit(cid, {lookType = outfit}, -1)
            end    
        else     
            if addon and PokeAddons[pokeName][addon].ride then
                doSetCreatureOutfit(cid, {lookType = PokeAddons[pokeName][addon].ride}, -1)
            else    
                doSetCreatureOutfit(cid, {lookType = outfit + 351}, -1)
            end                     
        end     
        
        doChangeSpeed(cid, -getCreatureSpeed(cid))
        doChangeSpeed(cid, speed)
        
        if isRider(cid) then
            setPlayerStorageValue(cid, orderTalks["ride"].storage, 1)
        elseif isFly(cid) then
            setPlayerStorageValue(cid, orderTalks["fly"].storage, 1)
            if not hasSqm(getThingPos(cid)) then
                -- doCreateItem(460, 1, getThingPos(cid))
            end
        elseif isSurf(cid) then
            setPlayerStorageValue(cid, orderTalks["surf"].storage, 1) -- rever o markedPos
            doChangeSpeed(cid, -getCreatureSpeed(cid))
            doChangeSpeed(cid, getPlayerStorageValue(cid, 54844))
        end
        doTeleportThing(cid, getMarkedSpawnPos(cid))
        setPokemonGhost(cid)
    end 
    
    setPlayerStorageValue(cid, storages.gobackDelay, -1)
    setPlayerStorageValue(cid, storages.pokedexDelay, -1)
    setPlayerStorageValue(cid, 154585, -1)
    setPlayerStorageValue(cid, 174529, -1)
    AutoLootinit(cid)
    --doAddShoppingItem(cid)
    
    -- otclient life
    doSendLifePokeToOTC(cid)
    -- otclient life
    
    local percent = getPlayerTotalExtraExperience(cid) - (isPremium(cid) and 1.5 or 1)
    
    if not isPremium(cid) then
        doPlayerSendTextMessage(cid, 20, "Players Vip tem 25% a mais de experiência, seja um e colabore com nosso servidor!")
    else
        doPlayerSendTextMessage(cid, 20, "Você tem "..getPlayerPremiumDays(cid).." dia"..(getPlayerPremiumDays(cid) > 1 and "s" or "").." VIP e 25% a mais de experiência.")
    end
    
    if percent > 0 then
        doPlayerSendTextMessage(cid, 20, "[Experience Booster]: ".. percent * 50 .."% a mais de experiência durante " ..convertTime(getPlayerStorageValue(cid, 45144) - os.time()).." restantes.")
    end
    
    if getPlayerStorageValue(cid, 4125) - os.time() > 0 then
        doPlayerSendTextMessage(cid, 20, "[Shiny Charm]: "..convertTime(getPlayerStorageValue(cid, 4125) - os.time()).." restantes.")
    end
        
    if getPlayerStorageValue(cid, 43144) - os.time() > 1 then
        doPlayerSendTextMessage(cid, 20, "[Clan Booster]: "..convertTime(getPlayerStorageValue(cid, 43144) - os.time()).." restantes.")
    end
    
    if getPlayerStorageValue(cid, 9134) ~= -1 then
        doPlayerSendTextMessage(cid, 20, "Você mudou seu antigo nome ("..getPlayerStorageValue(cid, 9134)..") para ("..getCreatureName(cid)..") com êxito.")
        setPlayerStorageValue(cid, 9134, -1)    
    end
    
    return true
end

 

Eu testei aqui e funcionou, mas qualquer problema me avisa.

Editado por Yan18
Link para o comentário
Compartilhar em outros sites

  • 0

[Error - Action Interface]
data/actions/scripts/ExpItems.lua:onUse
Description:
data/actions/scripts/ExpItems.lua:30: bad argument #1 to 'floor' (number expected, got nil)
stack traceback:
        [C]: in function 'floor'
        data/actions/scripts/ExpItems.lua:30: in function <data/actions/scripts/ExpItems.lua:29>

Mentira kkkk manoooooooooooooooooooooooooo muito obrigadooooo valeu mesmo ^^ tu é o cara


o Erro ali era que n tinha colocado o delay do efeito


PEGOOOOU

Link para o comentário
Compartilhar em outros sites

  • 0
10 horas atrás, wenderotpoke disse:

[Error - Action Interface]
data/actions/scripts/ExpItems.lua:onUse
Description:
data/actions/scripts/ExpItems.lua:30: bad argument #1 to 'floor' (number expected, got nil)
stack traceback:
        [C]: in function 'floor'
        data/actions/scripts/ExpItems.lua:30: in function <data/actions/scripts/ExpItems.lua:29>

Mentira kkkk manoooooooooooooooooooooooooo muito obrigadooooo valeu mesmo ^^ tu é o cara


o Erro ali era que n tinha colocado o delay do efeito


PEGOOOOU

Haha, que bom amigo que deu certo! Fico feliz ☺️.

 

Porém faltou uma coisa na verificação da função do actions e login.lua, como esqueci uma função na verificação fica dando erro ao fazer logout (deslogar):

[Error - Action Interface] In a timer event called from: path Description (luaGetThingPosition) Thing not found

Eu atualizei os dois scripts acima e só substituir que vai funcionar perfeitamente! Mas, caso dê algum problema me avise

 

Caso tenha sido resolvido, marca o meu post anterior como melhor resposta para ajudar outros usuários! ?

Editado por Yan18
Link para o comentário
Compartilhar em outros sites

  • 0
Em 07/01/2021 em 18:23, Yan18 disse:

Haha, que bom amigo que deu certo! Fico feliz ☺️.

 

Porém faltou uma coisa na verificação da função do actions e login.lua, como esqueci uma função na verificação fica dando erro ao fazer logout (deslogar):


[Error - Action Interface] In a timer event called from: path Description (luaGetThingPosition) Thing not found

Eu atualizei os dois scripts acima e só substituir que vai funcionar perfeitamente! Mas, caso dê algum problema me avise

 

Caso tenha sido resolvido, marca o meu post anterior como melhor resposta para ajudar outros usuários! ?

 

 

oi tenhe como ajudar?

 

ta damdo error aqi

 

[09/03/2021 18:58:19] [Error - Action Interface] 
[09/03/2021 18:58:19] data/actions/scripts/Buff Exp.lua:onUse
[09/03/2021 18:58:19] Description: 
[09/03/2021 18:58:19] data/actions/scripts/Buff Exp.lua:30: bad argument #1 to 'floor' (number expected, got nil)
[09/03/2021 18:58:19] stack traceback:
[09/03/2021 18:58:19]     [C]: in function 'floor'
[09/03/2021 18:58:19]     data/actions/scripts/Buff Exp.lua:30: in function <data/actions/scripts/Buff Exp.lua:29>

Link para o comentário
Compartilhar em outros sites

  • 0
Em 09/03/2021 em 22:00, KaboFlow disse:

 

 

oi tenhe como ajudar?

 

ta damdo error aqi

 

[09/03/2021 18:58:19] [Error - Action Interface] 
[09/03/2021 18:58:19] data/actions/scripts/Buff Exp.lua:onUse
[09/03/2021 18:58:19] Description: 
[09/03/2021 18:58:19] data/actions/scripts/Buff Exp.lua:30: bad argument #1 to 'floor' (number expected, got nil)
[09/03/2021 18:58:19] stack traceback:
[09/03/2021 18:58:19]     [C]: in function 'floor'
[09/03/2021 18:58:19]     data/actions/scripts/Buff Exp.lua:30: in function <data/actions/scripts/Buff Exp.lua:29>

 

Qual código dos posts desse tópico você copiou? O valor do delay que é a storage com o tempo está nil. Posta o código

Link para o comentário
Compartilhar em outros sites

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...