-
Total de itens
2221 -
Registro em
-
Última visita
-
Dias Ganhos
60
Tudo que Yan Oliveira postou
-
[Resolvido] (erro) criature.lua console
pergunta respondeu ao Starliks de Yan Oliveira em Resolvidos
Eu editei depois, mas você pegou a primeira versão que testei kk. E isso não é erro, é uma mensagem do tratamento que eu fiz. Substitua o código pela minha correção no meu post acima. -
[Resolvido] (erro) criature.lua console
pergunta respondeu ao Starliks de Yan Oliveira em Resolvidos
Isso exatamente, e o erro que deu ali é porque alguma ou as duas storages estão sem valor, ou seja, estão como nil, o que significa que os valores estão zerados. E como estão sem valores, vai dar erro no arquivo creature.lua, que é justamente o erro que aponta, o valor da storage está nil. Tem que ver onde e qual arquivo que seta o valor dessas storages globais e ver o porque não está setando, se tem alguma condição específica para isso. Mas, vamos fazer um tratamento para caso seja valor nil. Substitua o código por esse: function Creature:onChangeOutfit(outfit) return true end function Creature:onAreaCombat(tile, isAggressive) return RETURNVALUE_NOERROR end function Creature:onTargetCombat(target) target:registerEvent("ItemSetsHealth") target:registerEvent("UpgradeSystemHealth") target:registerEvent("UpgradeSystemDeath") if (self:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == nil or self:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == nil) or (target:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == nil or target:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == nil) then --print("There was an error, please verify the value of the storage [STORAGEVALUE_WAR_GREENPLAYER_BOOL] or [STORAGEVALUE_WAR_REDPLAYER_BOOL] because it them are nil.") return false end if self:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 1 then if target:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 1 then return RETURNVALUE_NOERROR elseif target:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 0 then self:sendCancelMessage("You cannot attack someone that is on your team.") return false end elseif self:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 1 then if target:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 1 then return RETURNVALUE_NOERROR elseif target:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 0 then self:sendCancelMessage("You cannot attack someone that is on your team.") return false end end end Fiz uma verificação que se alguma dessas storages forem estiverem nil, vai retornar falso e informar o erro para você na distro. -
Talkaction para verificar a quantidade de skills
pergunta respondeu ao vitorelias de Yan Oliveira em Scripts
O problema ai é que o parâmetro de Userdata (player) está com uma nomenclatura e na linha 3 está com outra, ou seja, o parâmetro está como cid e na linha 3 está como player. Eu refiz o script para você, substitui o código por esse: function onSay(player, words, param) local total_players_online = #getOnlinePlayers() if total_players_online > 0 then if param == '' then return player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Seu Skill Club é " .. player:getSkillLevel(SKILL_CLUB) .. ".") else if player:isPremium() then if player:isInGhostMode() then return player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Não foi encontrado nenhum jogador online com esse nome.") else for _, name in pairs(getOnlinePlayers()) do if param == name then return player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Skill Club de [" .. name .. "] é " .. player:getSkillLevel(SKILL_CLUB) .. ".") else return player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Não foi encontrado nenhum jogador online com esse nome.") end end end else return player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Somente jogadores VIP podem utilizar este comando para visualizar informações de outros jogadores.") end end else return true end end Teste e fala se der algum problema. -
[Resolvido] (erro) criature.lua console
pergunta respondeu ao Starliks de Yan Oliveira em Resolvidos
Vamos fazer um teste e descobrir o valor dessa storage, pois parece ser global, então só fazendo testa para saber o valor dela. Para ficar mais rápido e simples o teste, vai em Data/Creaturescripts/Scripts e abre o arquivo login.lua, e embaixo de: function onLogin(player) Adicione a linha: print("Storage STORAGEVALUE_WAR_GREENPLAYER_BOOL = " .. Game.getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) .. "\n Storage STORAGEVALUE_WAR_REDPLAYER_BOOL = " .. Game.getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL)) Após isso, inicie o servidor e me manda print da distro assim que fizer login com o player, pois essa linha que falei para adicionar vai mostrar os valores dessas duas storages na distro. -
actions [Resolvido] Ajuda com Mensagem
pergunta respondeu ao jenison06 de Yan Oliveira em Resolvidos
Substitui o código por esse e testa: Se der algum problema ou erro me avisa. -
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! ?
-
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.
-
Como você está testando? Para funcionar você tem que usar o buff novamente.
-
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
-
Deve estar com dois function onLogin(cid). Posta o seu login.lua que eu arrumo para você.
-
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.
-
[Resolvido] [PEDIDO] Scripts de spawn no mapa
pergunta respondeu ao rafersiq de Yan Oliveira em Resolvidos
Ok, testa e me avisa! -
[Resolvido] [PEDIDO] Scripts de spawn no mapa
pergunta respondeu ao rafersiq de Yan Oliveira em Resolvidos
Saquei! Funcionou o script? Populou a tabela corretamente? Coloquei posições genéricas. -
[Resolvido] [PEDIDO] Scripts de spawn no mapa
pergunta respondeu ao rafersiq de Yan Oliveira em Resolvidos
Substitui o código por esse: local pokemon_derrotar = "Charizard" -- NOME DO POKÉMON QUE PRECISA DERROTAR NA TASK local total = 50 -- TOTAL DE POKEMON QUE PRECISA DERROTAR local random_porcentagem = 50 -- PORCENTAGEM QUE TEM DO POKEMON SPAWNAR AO TERMINAR A TASK -- TABELA COM OS POKEMONS QUE APARECERÃO AO DERROTAR A QUANTIDADE DO POKÉMON QUE COLOCOU NA VARIÁVEL pokemon_derrotar -- local pokemons_spawn = { {pokemon = "Mewtwo", position = {x= 1000, y= 1000, z= 7}}, {pokemon = "Mew", position = {x= 1000, y= 1000, z= 7}}, {pokemon = "Articuno", position = {x= 1000, y= 1000, z= 7}}, {pokemon = "Zapdos", position = {x= 1000, y= 1000, z= 7}}, {pokemon = "Moltres", position = {x= 1000, y= 1000, z= 7}}, } function onKill(cid, target) local contador = 0 local random_chance = math.random(100) if getCreatureName(target) == pokemon_derrotar then if (total - contador) > 0 then contador = contador + 1 end if contador == total then if (random_chance >= random_porcentagem) then for i = 1, #pokemons_spawn do doCreateMonster(pokemons_spawn[i].pokemon, pokemons_spawn[i].position) end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você despertou a fúria de alguns pokémons, fuja para sobreviver!") contador = 0 return true else return true end end else return true end end Lembrando que assim que matar a quantidade de pokémons que você colocou nas variáveis total e pokemon_derrotar vai ter a porcentagem de summonar todos os pokémons da tabela pokemons_spawn. Só colocar os pokémons e as posições que vão aparecer dentro da tabela. Mas se é ilimitado esse evento/task, então não faz mais sentido com que sempre aparece o boss em vez de ter uma chance? Testa o código e qualquer problema você me avisa. -
[Resolvido] [PEDIDO] Scripts de spawn no mapa
pergunta respondeu ao rafersiq de Yan Oliveira em Resolvidos
Tem sim, mas quantas vezes você quer? Da para limitar uma quantidade de vezes que o player faz. -
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.
-
Da algum erro na distro?
-
Sim, eu ia usar while, mas ai achei melhor usar de outra forma, mas esqueci de tirar. Não entendi o problema que está dando, como assim pegou mas o buff não está fazendo efeito?
-
Esqueci um while ali haha, substitui o código por esse: 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 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 Testa e veja se continua dando erro.
-
[Resolvido] [PEDIDO] Scripts de spawn no mapa
pergunta respondeu ao rafersiq de Yan Oliveira em Resolvidos
Mas a task funcionou? Somente quando spawna o boss ele fica bugado? Substitui o código por esse: local pokemon_derrotar = "Charizard" -- NOME DO POKÉMON QUE PRECISA DERROTAR NA TASK local total = 50 -- TOTAL DE POKEMON QUE PRECISA DERROTAR local pokemon_spawn = "Mewtwo" -- NOME DO POKEMON QUE VAI SPAWNAR local position_spawn = {x= 1000, y= 1000, z= 7} -- POSIÇÃO ONDE VAI SPAWNAR O POKEMON local storage = 15879 -- STORAGE PARA VER SE JÁ FEZ A TASK local random_porcentagem = 50 -- PORCENTAGEM QUE TEM DO POKEMON SPAWNAR AO TERMINAR A TASK function onKill(cid, target) local contador = 0 local random_chance = math.random(100) if getCreatureName(target) == pokemon_derrotar then if getPlayerStorageValue(cid, storage) < 1 then if (total - contador) > 0 then contador = contador + 1 end if contador == total then setPlayerStorageValue(cid, storage, 1) if (random_chance >= random_porcentagem) then doCreateMonster(pokemon_spawn, position_spawn) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você despertou a fúria de um pokémon, se prepare para o combate!") return true else return true end end else return true end else return true end end -
[Resolvido] [PEDIDO] Scripts de spawn no mapa
pergunta respondeu ao rafersiq de Yan Oliveira em Resolvidos
Cara, vamos focar primeiro no seu tópico aqui, eu fiz o script que você pediu e você não disse se funcionou ou não. Sobre sua outra dúvida, já adianto que terá que criar um outro tópico para essa dúvida porque não tem relação com a dúvida deste tópico -
[Resolvido] [PEDIDO] Scripts de spawn no mapa
pergunta respondeu ao rafersiq de Yan Oliveira em Resolvidos
Sobre a versão, então no seu caso muito provavelmente é 0.3.6, que é a versão atualmente de todos os Poketibia. Se é evento, provavelmente é um pokémon que não terá em respawn, então não precisa de storage para deixa específica a kill dele (quando não tem storage, em qualquer situação vai contar como kill nesse script que vou fazer, por exemplo matar em respawn) Vai em Data/Creaturescripts/Scripts e crie um arquivo chamado task_event.lua (ou o nome que preferir) e adicione o código dentro: local pokemon_derrotar = "Charizard" -- NOME DO POKÉMON QUE PRECISA DERROTAR NA TASK local total = 50 -- TOTAL DE POKEMON QUE PRECISA DERROTAR local pokemon_spawn = "Mewtwo" -- NOME DO POKEMON QUE VAI SPAWNAR local position_spawn = {x= 1000, y= 1000, z= 7} -- POSIÇÃO ONDE VAI SPAWNAR O POKEMON local storage = 15879 -- STORAGE PARA VER SE JÁ FEZ A TASK local random_porcentagem = 50 -- PORCENTAGEM QUE TEM DO POKEMON SPAWNAR AO TERMINAR A TASK function onKill(cid, target) local contador = 0 local random_chance = math.random(100) if getCreatureName(target) == pokemon_derrotar then if getPlayerStorageValue(cid, storage) < 1 then if (total - contador) > 0 then contador = contador + 1 end if contador == total then setPlayerStorageValue(cid, storage, 1) if (random_chance >= random_porcentagem) then doSummonCreature(pokemon_spawn, position_spawn) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você despertou a fúria de um pokémon, se prepare para o combate!") return true else return true end end else return true end else return true end end Agora vai em creaturescripts.xml e adicione a tag: <event type="kill" name="task_event" script="task_event.lua" /> OBS: Caso tenha colocado um arquivo com nome diferente do que sugeri não se esqueça de trocar na tag xml. E por fim em Data/Creaturescripts/Scripts abra o arquivo login.lua e procura seção de eventos e adiciona o evento: registerCreatureEvent(cid, "task_event") Deixei tudo comentado nas variáveis, só vai precisar trocar os valores. Lembrando que na variável random_porcentagem é a chance que vai ter de nascer o pokémon, como eu deixei 50, da tanto para verificar se vai ser maior que 50 ou menor, mas no caso deixei maior ou igual a 50, então qualquer valor acima de 50 gerado pela variável random_chance vai sumonar o pokémon. Se quer que tenha menos de 50% de chance, mude o valor da variável random_porcentagem e nessa verificação: if (random_chance >= random_porcentagem) then Mude para o valor desejado menor que 50, mas tem que mudar o if para: if (random_chance <= random_porcentagem) then Teste, e se der algum erro ou problema, me avise. -
[Resolvido] [PEDIDO] Scripts de spawn no mapa
pergunta respondeu ao rafersiq de Yan Oliveira em Resolvidos
Qual a versão da TFS? E isso é um evento ou task? -
Você só precisa colocar o tempo em segundos para o efeito sair novamente no player. Ou seja, se você colocar 3, a cada 3 segundos vai repetir o efeito. Por exemplo, eu sei que o buff tem duração de 1 dia, então dentro desse intervalo de 24 horas, quando o player está online, se eu quiser que nesse tempo o efeito do buff fique repetindo a cada 5 segundos, eu coloco 5: buffEffect(cid, 5, effect, storage_time) -- FUNÇÃO QUE SAI EFEITO NO PLAYER ENQUANTO ELE ESTÁ COM BUFF Mas, vou te facilitar a vida, já que está confuso, vou criar uma variável que repete o efeito a cada X segundos, substitui o código por esse: local loop_effect_segundos = 3 -- INTERVALO DE TEMPO EM SEGUNDOS QUE VAI SAIR EFEITO NO PLAYER ENQUANTO POSSUIR O 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 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 while --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 Pronto, agora a única coisa que você precisa se preocupar e alterar, é o valor na variável loop_effect_segundos na primeira linha do código. Altere lá o valor em segundos que quer que repita o efeito no player (loop) enquanto ele possuir buff.
-
Ah sim, tem como sim. Substitui o código por esse: 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 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) 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 while --doSendMagicEffect(getThingPos(cid), effect) -- FUNÇÃO QUE SAI EFEITO NO PLAYER AO USAR O ITEM buffEffect(cid, 3, 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 Eu alterei o código e criei uma função para ficar soltando o efeito no player enquanto ele tem buff. Na função que criei buffEffect, tem os seguintes parâmetros: cid = Player time = A cada quantos segundos vai sair o efeito no player novamente effect = Id do efeito duration = Duração do buff O que você vai precisar mudar, praticamente é o segundo e terceiro parâmetro, que é o intervalo do efeito e o id do efeito. Testa e fala se der algum erro.
-
Quem Está Navegando 0 membros estão online
- Nenhum usuário registrado visualizando esta página.