Ir para conteúdo

Muvuka

Campones
  • Total de itens

    80
  • Registro em

  • Última visita

Histórico de Reputação

  1. Upvote
    Muvuka deu reputação a Holograma em -=[TFS - 0.3.6 - 8.60]=- ERRO NPC REVIVE   
    1. Corrigir o erro do gsub:
    O erro de gsub ocorre quando o tipo de dado passado para ele não é válido. No caso do erro que você está recebendo, parece que o sistema está esperando uma string, mas recebeu outro tipo de valor.
    2. Verificar o erro Creature not found:
    Esse erro sugere que o NPC está tentando interagir com uma criatura (cid) que não existe ou foi removida do jogo. Pode ser resolvido verificando se o cid é uma criatura válida antes de tentar interagir com ele.
    Sugestões de ajustes no código:
    Função teleportPlayerToPositionReborn:
     
    function teleportPlayerToPositionReborn(cid) if not isCreature(cid) then selfSay('Player not found.', cid) return false end local playerRebornPositionX = getPlayerStorageValue(cid, PLAYER_REBORN_POSITION_X) local playerRebornPositionY = getPlayerStorageValue(cid, PLAYER_REBORN_POSITION_Y) local playerRebornPositionZ = getPlayerStorageValue(cid, PLAYER_REBORN_POSITION_Z) if playerRebornPositionX == -1 or playerRebornPositionY == -1 or playerRebornPositionZ == -1 then selfSay('You have not died yet.', cid) return false end doTeleportThing(cid, {x = playerRebornPositionX, y = playerRebornPositionY, z = playerRebornPositionZ}) return true end isCreature(cid): Verifica se o cid ainda é uma criatura válida antes de tentar acessá-la. Isso ajuda a evitar o erro Creature not found. Função onThink:
    Certifique-se de que o onThink está bem implementado no NPC:
     
    function onThink() if not npcHandler:isFocused() then return false end npcHandler:onThink() return true end  
  2. Upvote
    Muvuka deu reputação a Holograma em -=[TFS]=- - 0.3.6 - 8.60 - EU QUERIA QUE QUANDO MATASSE PLAYER APARECESSE HEADSHOT! FICA APARECENDO HEADSHOT! TODA HORA QUE ATACA PLAYER   
    local chance_percent = 100 -- Chance percentual para headshot local extra_damage_percent = 1000 -- Percentual de dano extra function onLogin(cid) registerCreatureEvent(cid, "HeadshotCritical") return true end function onStatsChange(cid, attacker, type, combat, value) if type ~= STATSCHANGE_HEALTHLOSS then return true end if isPlayer(attacker) and getPlayerStorageValue(cid, 71257) < 1 then if math.random(100) <= chance_percent then local dmg = value * (extra_damage_percent / 100) setPlayerStorageValue(cid, 71257, 1) doTargetCombatHealth(attacker, cid, combat, -dmg, -dmg, 255) setPlayerStorageValue(cid, 71257, -1) -- Verifica se o dano causado é letal if getCreatureHealth(cid) <= dmg then doCreatureSay(cid, "HEADSHOT!", TALKTYPE_MONSTER) end return false end end return true end
     
    Como o script funciona:
    Chance de Headshot: O código mantém a chance de "headshot" e o dano adicional, como no script original.
    Verificação de Morte: Antes de exibir a mensagem "HEADSHOT!", o script verifica se o dano causado é suficiente para matar o alvo (getCreatureHealth(cid) <= dmg). Se for letal, a mensagem é exibida.
    Mensagem de "HEADSHOT!": A mensagem só aparecerá se o jogador morrer pelo ataque que causou o dano crítico.
    Como usar:
    Adicione o script ao seu servidor.
    Registre o evento no creaturescripts.xml:
     
    <event type="statschange" name="HeadshotCritical" script="headshot.lua"/>  
    Reinicie o servidor para que as alterações entrem em vigor.
    Com essas alterações, o efeito "HEADSHOT!" só aparecerá quando um jogador matar outro jogador com um ataque crítico. Isso evita que a mensagem apareça a cada ataque, melhorando a experiência de jogo.
     
  3. Upvote
    Muvuka deu reputação a Holograma em Site [WONRS] não seleciona vocação para criação   
    1. Verifique o Código JavaScript
    O botão de seleção de vocação e o valor do campo pdt_id são definidos pelo JavaScript. Certifique-se de que o JavaScript está funcionando corretamente e que o valor está sendo corretamente atribuído ao campo pdt_id.
    Aqui está um exemplo de função JavaScript que deve estar presente para selecionar a vocação:
     
    function selectpdt(id) { document.getElementById('pdt_id').value = id; var buttons = document.getElementsByClassName('pdt_blc'); for (var i = 0; i < buttons.length; i++) { buttons[i].style.border = 'none'; } document.getElementById('b' + id).style.border = '2px solid #f00'; // Ajuste a borda para indicar seleção }
     
    2. Verifique o HTML do Formulário
    Assegure-se de que o formulário HTML está configurado corretamente para enviar os dados:
    O campo oculto para vocação (pdt_id) deve estar presente e ser atualizado pelo JavaScript quando uma vocação é selecionada. O botão de submit (Criar Personagem) deve estar habilitado quando todos os campos forem preenchidos. No seu código, o botão de submit está desabilitado (disabled), o que pode ser a causa do problema. Verifique se o JavaScript está habilitando o botão após a seleção da vocação e o preenchimento dos campos obrigatórios.
    3. Verifique a Função selectpdt
    Verifique se a função JavaScript selectpdt está sendo chamada corretamente ao clicar em uma vocação. Você pode adicionar um console.log para depuração:
     
    function selectpdt(id) { console.log('Vocation selected:', id); // Adicione isso para verificar se a função é chamada document.getElementById('pdt_id').value = id; // Resto do código }
     
    4. Verifique o Código PHP para Processamento de Dados
    Certifique-se de que o valor de $_POST['pdt_id'] está sendo corretamente verificado e validado no código PHP. Aqui está uma parte relevante do seu código:
     
    // Validate vocation id if (!in_array((int)$_POST['pdt_id'], $config['available_vocations'])) { $errors[] = 'Permissão negada. Vocação errada.'; } Certifique-se de que o $_POST['pdt_id'] está sendo enviado corretamente e contém um ID válido.


    atualizando seu código deve ficar mais ou menos assim:
     
    <?php require_once 'engine/init.php'; protect_page(); include 'layout/overall/header.php'; $imagem = 'http://' . $_SERVER['HTTP_HOST'] . '/layout/images/vocstatus'; $statusid = 1; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $required_fields = array('name', 'selected_town', 'pdt_id'); $errors = array(); foreach ($required_fields as $field) { if (empty($_POST[$field])) { $errors[] = 'You need to fill in all fields.'; break; } } if (empty($errors)) { if (!Token::isValid($_POST['token'])) { $errors[] = 'O token é inválido.'; } $_POST['name'] = validate_name($_POST['name']); if ($_POST['name'] === false) { $errors[] = 'Seu nome não pode conter mais de 2 palavras.'; } else { if (user_character_exist($_POST['name']) !== false) { $errors[] = 'Desculpe, esse nome de personagem já existe.'; } if (!preg_match("/^[a-zA-Z_ ]+$/", $_POST['name'])) { $errors[] = 'Seu nome pode conter apenas a-z, A-Z e espaços.'; } if (strlen($_POST['name']) < $config['minL'] || strlen($_POST['name']) > $config['maxL']) { $errors[] = 'O nome do seu personagem deve estar entre ' . $config['minL'] . ' - ' . $config['maxL'] . ' caracteres longos.'; } if (in_array(strtolower($_POST['name']), $config['invalidNames'])) { $errors[] = 'Este nome de usuario esta bloqueado.'; } $resname = explode(" ", $_POST['name']); foreach ($resname as $res) { if (in_array(strtolower($res), $config['invalidNameTags'])) { $errors[] = 'Seu nome de usuário contém uma palavra restrita.'; } else if (strlen($res) == 1) { $errors[] = 'Palavras muito curtas em seu nome.'; } } if (!in_array((int)$_POST['pdt_id'], $config['available_vocations'])) { $errors[] = 'Permissão negada. Vocação errada.'; } $char_count = user_character_list_count($session_user_id); if ($char_count >= $config['max_characters']) { $errors[] = 'Sua conta não tem permissão para ter mais de ' . $config['max_characters'] . ' personagens.'; } if (validate_ip(getIP()) === false && $config['validate_IP'] === true) { $errors[] = 'Falha ao reconhecer o seu endereço IP. (Não é um endereço IPv4 válido).'; } } } } ?> <div id="title"> <div class="name">Criar novo personagem</div> </div> <br> <?php if (isset($_GET['success']) && empty($_GET['success'])) { echo 'Parabéns! Seu personagem foi criado. Te vejo no jogo!'; } else { if ($_SERVER['REQUEST_METHOD'] === 'POST' && empty($errors)) { if ($config['log_ip']) { znote_visitor_insert_detailed_data(2); } // Register $character_data = array( 'name' => format_character_name($_POST['name']), 'elo_points' => 0, 'account_id' => $session_user_id, 'vocation' => $_POST['pdt_id'], 'lastip' => getIPLong(), 'created' => time() ); user_create_character($character_data); header('Location: createcharacter.php?success'); exit(); } else if (!empty($errors)) { echo '<font color="red"><b>'; echo output_errors($errors); echo '</b></font>'; } ?> <br> <link rel="stylesheet" type="text/css" href="layout/css/style.css"> <script type="text/javascript" src="/layout/js/selection.js"></script> <center> <div class="Text"> <br>Selecione o personagem desejado:</div> <div class="caixa" style="width: 600px;height: 300px;overflow: auto;"> <table border="0" cellspacing="10" cellpadding="0"> <?php $y = 0; $i = 0; foreach ($config['available_vocations'] as $id) { if ($i == 0) { echo '<tr>'; } $i++; $y++; ?> <td> <table style="width:115px;" border="0" cellspacing="0" cellpadding="0"> <tr style="height:75px;"> <td> <div id="i<?php echo $id; ?>" class="pdt_cls" style="background-image:url('<?php echo $config['images']['selectVocation']; ?>/<?php echo $id; ?>.png'), url(/layout/images/donate/back.png);"> <div id="b<?php echo $id; ?>" class="pdt_blc" value="<?php echo $id; ?>" onclick="selectpdt(<?php echo $id; ?>);"></div> </div> </td> </tr> <tr> <td> <center> <div class="pdt_nme"><?php echo vocation_id_to_name($id); ?></div> </center> </td> </tr> </table> </td> <td> <div style="width:20px;"></div> </td> <?php if ($i == 3) { echo '</tr>'; $i = 0; } } ?> </table> </div> <br> <form action="" method="post"> <li> <font color="white">Digite o nome para seu personagem:</font> <br> <input type="text" name="name"> </li> <input id="pdt_id" name="pdt_id" type="hidden" value="0" /> <table> <tr> <td> <input id="ckb_obs" name="ckb_obs" onclick="chkbox();" type="checkbox" /> </td> <td> <label class="Text" style="width:100%;" for="ckb_obs"> <center>Estou ciente das <a href="/termos.php" style="font-family:monospace; font-size:13px; font-weight:bold;">observações referentes a criação do personagem.</a></center> </label> </td> </tr> </table> <input type="hidden" name="token" value="<?php echo Token::generate(); ?>" /> <div style="height:20px;"></div> <input id="Button" type="submit" value="Criar Personagem" /> </form> </center> <?php } include 'layout/overall/footer.php'; ?>
     
  4. Upvote
    Muvuka deu reputação a Holograma em Players ficam "imortal" nao toma dano de outro player ou monstro   
    pode ser privilegio de GM / ADM
  5. Upvote
    Muvuka deu reputação a Holograma em -=[TFS]=- 0.3.6 - 8.60 - ERRO NA HORA DE USAR UM COMANDO !guildrank   
    function onSay(cid, words, param) local guilds = {} local guild_rank = {} -- Seleciona o level e a guild de cada jogador com guild e com level maior que 10, ordenados pelo level local query = db.getResult("SELECT level, guild_id FROM players WHERE guild_id > 0 AND level > 10 ORDER BY level DESC") -- Caso nenhum jogador seja selecionado, retorna verdadeiro if query:getID() == -1 then return true end repeat local level = query:getDataInt("level") local guild_id = query:getDataInt("guild_id") -- Cria uma tabela dentro da tabela guilds para cada guilda if not guilds[guild_id] then guilds[guild_id] = {level = level, members = 1} -- Se a tabela já existir e o número de membros for menor que 10, soma o level e +1 ao número de membros elseif guilds[guild_id].members < 10 then guilds[guild_id].level = guilds[guild_id].level + level guilds[guild_id].members = guilds[guild_id].members + 1 end -- Termina se não existirem mais resultados until not query:next() query:free() -- Passa os resultados obtidos para a tabela guild_rank, para ordená-la com table.sort for i, k in pairs(guilds) do table.insert(guild_rank, {id = i, level = k.level}) end -- Ordena a tabela guild_rank de acordo com a soma dos levels table.sort(guild_rank, function(a, b) return a.level > b.level end) local i = 0 local str = ' Guild Rank\n' -- Crie uma string com o nome das guildas em um ranking for _, info in pairs(guild_rank) do i = i + 1 str = str .. i .. ' - '.. getGuildNameById(info.id) .. ' - ' .. info.level .. '\n' if i == 10 then break end end -- Se algum erro ocorrer e o ranking não tiver informações, manda a mensagem "No Guild Information..." local ret = str ~= ' Guild Rank\n' and str or "No guild information to be displayed." doPlayerPopupFYI(cid, ret) return true end

    O erro que você está encontrando, SQLITE ERROR: no such column: guild_id, indica que a coluna guild_id não existe na tabela players.
    adicione no seu banco de dados:
    ALTER TABLE players ADD COLUMN guild_id INTEGER DEFAULT 0;
     
  6. Upvote
    Muvuka deu reputação a Holograma em -=[TFS]=- 0.3.6 - 8.60 CRITICAL STONE and BOOSTER ATTACK STONE DANDO ERRO [AJUDA]   
    boa noite

     
    local lvlcrit = 48913 -- armazenamento para críticos normais local lvlcritDanger = 48904 -- armazenamento para críticos perigosos local multiplier = 1.5 -- multiplicador de dano function onCombat(cid, target) print("onCombat chamado com cid: " .. tostring(cid) .. " target: " .. tostring(target)) if isPlayer(cid) and isCreature(target) then local criticalChance = getPlayerStorageValue(cid, lvlcrit) or 0 local criticalDangerChance = getPlayerStorageValue(cid, lvlcritDanger) or 0 local chance = math.random(1, 1000) -- Mantém um intervalo razoável print("Chances de crítico: normal=" .. criticalChance .. " perigo=" .. criticalDangerChance .. " sorteio=" .. chance) -- Verifica se a chance de crítico BOOSTER é atingida if chance <= (criticalChance * 3) then print("Crítico BOOSTER atingido!") local damage = 100 -- Valor do dano crítico BOOSTER (ajuste conforme necessário) doTargetCombatHealth(cid, target, COMBAT_PHYSICALDAMAGE, -damage, -damage, 255) doSendAnimatedText(getCreaturePosition(target), "+BOOSTER!", 31) doSendMagicEffect(getCreaturePosition(cid), 54) return true end -- Verifica se a chance de crítico DANGER é atingida if chance <= (criticalDangerChance * 3) then print("Crítico DANGER atingido!") local damage = 100 -- Valor do dano crítico DANGER (ajuste conforme necessário) doTargetCombatHealth(cid, target, COMBAT_PHYSICALDAMAGE, -damage, -damage, 255) doSendAnimatedText(getCreaturePosition(target), "DANGER!", 190) doSendMagicEffect(getCreaturePosition(cid), 52) return true end end return true end  
  7. Upvote
    Muvuka deu reputação a Holograma em -=[TFS]=- 0.3.6 - 8.60 - [GLOBALEVENTS] - Proibido jogar item em cima do tile   
    se era pra ser uma imagem esta com erro meu amigo
  8. Upvote
    Muvuka deu reputação a Holograma em -=[TFS]=- 0.3.6 - 8.60 - NPC Reviver Dando erro no console   
    local MONEY_AMOUNT = 1000000 -- Quantidade de dinheiro (em gold coins) que o player necessitará para reviver local MAGIC_EFFECT_TELEPORT = 65 -- Efeito que aparecerá quando o player for teleportado local PLAYER_REBORN_POSITION_X = 66541 local PLAYER_REBORN_POSITION_Y = 66542 local PLAYER_REBORN_POSITION_Z = 66543 local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msgcontains(msg, 'reviver') or msgcontains(msg, 'revive') then selfSay('Você precisa de ' .. MONEY_AMOUNT .. ' gold(s) para ressuscitar no local onde você morreu recentemente', cid) talkState[talkUser] = 1 elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then if getPlayerMoney(cid) >= MONEY_AMOUNT then doPlayerRemoveMoney(cid, MONEY_AMOUNT) if teleportPlayerToPositionReborn(cid) then doTeleportThing(cid, {x = PLAYER_REBORN_POSITION_X, y = PLAYER_REBORN_POSITION_Y, z = PLAYER_REBORN_POSITION_Z}) doSendMagicEffect(getCreaturePosition(cid), MAGIC_EFFECT_TELEPORT) selfSay('Ok, você foi ressuscitado', cid) end else selfSay('Desculpe, mas você não possui dinheiro suficiente.', cid) end talkState[talkUser] = 0 elseif msgcontains(msg, 'no') and talkState[talkUser] == 1 then talkState[talkUser] = 0 selfSay('Ok, até mais.', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) function teleportPlayerToPositionReborn(cid) local playerRebornPositionX = getPlayerStorageValue(cid, PLAYER_REBORN_POSITION_X) local playerRebornPositionY = getPlayerStorageValue(cid, PLAYER_REBORN_POSITION_Y) local playerRebornPositionZ = getPlayerStorageValue(cid, PLAYER_REBORN_POSITION_Z) if playerRebornPositionX == -1 or playerRebornPositionY == -1 or playerRebornPositionZ == -1 then selfSay('Você não morreu nenhuma vez ainda.', cid) return false end doTeleportThing(cid, {x = playerRebornPositionX, y = playerRebornPositionY, z = playerRebornPositionZ}) return true end Correção na Função teleportPlayerToPositionReborn:
    Os valores PLAYER_REBORN_POSITION_X, PLAYER_REBORN_POSITION_Y e PLAYER_REBORN_POSITION_Z devem ser usados corretamente para obter a posição armazenada do jogador.
    Correção na Lógica de Teleporte:
    A função doTeleportThing é chamada uma vez no teleportPlayerToPositionReborn e não precisa ser chamada novamente na função principal.
    Adição de Mensage
     
  9. Upvote
    Muvuka deu reputação a Holograma em -=[TFS]=- 0.3.6 - 8.60 - Eu queria que monstro nascesse assim nesse script   
    se existe uma função no TFS pra alterar tamanho de fontes eu desconheço, entao vou usar a funçao doSendAnimatedText(position, text, color) e TEXTCOLOR_WHITE pra deixar o mais semelhante ao que parece, eu nao tenho mais computador hoje em dia devido a problemas economicos, mas por logica deve ficar +- assim:

     
    local colorMsg = "orange" local tableBoss = { ["[EXP] Statue"] = {seconds = 3600, newBoss = "[EXP] Statue"} } local function countdown(position) for i = 5, 0, -1 do addEvent(function() doSendAnimatedText(position, tostring(i), TEXTCOLOR_WHITE) end, (5 - i) * 1000) end end local function timer(position, duration) countdown(position) addEvent(function() for i = 0, (duration - 1) do addEvent(function() doSendAnimatedText(position, tostring(duration - i), TEXTCOLOR_WHITE) end, (i + 6) * 1000) end end, 6000) end local lastTarget = nil function onKill(cid, target, damage, flags) if lastTarget and lastTarget == target then return true end lastTarget = target if isPlayer(target) then return true end local boss = tableBoss[getCreatureName(target)] if not boss then return true end local position = getThingPos(target) doPlayerSendTextMessage(cid, MESSAGE_TYPES[colorMsg], "The boss will be born in " .. boss.seconds .. " seconds.") timer(position, boss.seconds) addEvent(doCreateMonster, (boss.seconds + 5) * 1000, boss.newBoss, position) return true end  
  10. Upvote
    Muvuka deu reputação a Holograma em -=[TFS]=- 0.3.6 - 8.60 - Player fica em cima do contador de tempo pro monstro nasce e mostro nasce do lado do player faiz com que ele criei varios monstros iguais ME AJUDA   
    local colorMsg = "orange" local tableBoss = { ["[EXP] Statue"] = {seconds = 3600, newBoss = "[EXP] Statue", event = nil} } local function timer(position, duration, color) for i = 0, (duration - 1) do addEvent(function() doSendAnimatedText(position, tostring(duration - i), color) end, i * 1000) end end function onKill(cid, target, damage, flags) if isPlayer(target) then return true end local bossName = getCreatureName(target) local boss = tableBoss[bossName] if not boss then return true end local position = getThingPos(target) -- Cancelar evento anterior se existir if boss.event then stopEvent(boss.event) end doPlayerSendTextMessage(cid, MESSAGE_TYPES[colorMsg], "The boss will be born in " .. boss.seconds .. " seconds.") timer(position, boss.seconds, COLOR_WHITE) boss.event = addEvent(function() boss.event = nil -- resetar evento doCreateMonster(boss.newBoss, position) end, boss.seconds * 1000) return true end
    1.Cancelamento do evento anterior: Antes de criar um novo evento de nascimento do monstro, o script cancela o evento anterior usando stopEvent(boss.event) se ele ainda estiver ativo.

    2.Reset do evento: Quando o monstro é criado, o evento é resetado para nil, permitindo que novos eventos sejam criados sem problema na próxima vez que o monstro for morto.

    Essa modificação deve evitar a criação de múltiplos monstros quando o jogador está em cima do contador de tempo.
  11. Upvote
    Muvuka deu reputação a Holograma em -=[TFS]=- 0.3.6 8.60 - PET HIT COM MAGIA NO PLAYER QUE O SUMONO OU SEJA NO DOMADOR POR CAUSA QUE PET TEM MAGIA EM AREA   
    function onUse(cid, item, fromPosition, itemEx, toPosition) local petName = "[PET] NIVEL MAXIMO" local storageValue = 83712 local playerPets = getCreatureSummons(cid) -- Verifica se o jogador já tem um pet invocado if #playerPets <= 0 then -- Se não houver pet invocado, invoca um novo local newPet = doSummonMonster(cid, petName) if newPet then setPlayerStorageValue(cid, storageValue, 1) end else -- Se houver pet invocado, verifica se é o pet correto e remove-o for _, pet in ipairs(playerPets) do if getCreatureName(pet) == petName then doRemoveCreature(pet) end end end -- Impede que o domador seja afetado pelo ataque em área registerCreatureEvent(cid, "Infriendlyfire") return true end

    alem disso, adicione: 
     
    <event type="infriendlyfire" name="Infriendlyfire" event="script" value="infriendlyfire.lua"/>
    e crie um .lua: 
     
    function onInfriendlyfire(cid, attacker, target) if isPlayer(attacker) and isPlayer(target) then return false -- Impede que jogadores causem dano uns aos outros end if isPlayer(attacker) and isSummon(target) then local master = getCreatureMaster(target) if master == attacker then return false -- Impede que o domador cause dano ao seu pet end end if isSummon(attacker) then local master = getCreatureMaster(attacker) if master == target then return false -- Impede que o pet cause dano ao seu domador end end return true end  
  12. Upvote
    Muvuka deu reputação a Holograma em -=[TFS]=- 0.3.6 8.60 - ME AJUDA POR FAVOR QUANDO PLAYER LOGA NO TEMPLO DA DEBUG POR QUE TEM OURO CHAR NA MESMA POSIÇÃO   
    acho que isso resolve:

     
    function onLogin(player) local spawnPosition = Position(100, 50, 7) -- Coordenadas do spawn local occupied = false -- Verifica se existe algum jogador na posição de spawn for _, otherPlayer in ipairs(Game.getPlayers()) do if otherPlayer:getPosition() == spawnPosition then occupied = true break end end -- Se a posição de spawn estiver ocupada, move o jogador para uma posição próxima if occupied then local newPosition = spawnPosition:getRandomTile(1) -- obtém uma posição aleatória adjacente player:teleportTo(newPosition) else player:teleportTo(spawnPosition) end end -- Registra o evento de login para chamar a função onLogin function onLoginEvent(player) onLogin(player) end  
  13. Upvote
    Muvuka deu reputação a Holograma em -=[TFS]=- 0.3.6 - 8.60 - Meu servidor não funciona Party Experience - Shared Experience   
    até aqui ta tudo ok, o erro ta vindo de outro lugar, varia um pouco de uma versao pra outra, mas alguns tebm a opçao em boolean e alguhns requisitos pra funcionar como: distância entre os jogadores], se a diferença de nível está dentro do limite e etc
  14. Upvote
    Muvuka deu reputação a Holograma em -=[TFS]=- 0.3.6 8.60 - PET ATACA O PLAYER QUE SUMONO O PROPRIO PET   
    function onUse(cid, item, fromPosition, itemEx, toPosition) local name = "[PET] NIVEL MAXIMO" local pet = getCreatureSummons(cid) local storedPet = getCreatureSummons(cid, 83712) -- Se já existe um pet armazenado, remova-o if storedPet[1] then doRemoveCreature(storedPet[1]) end -- Se não houver pet invocado, invoque um novo e armazene-o if #pet == 0 then local newPet = doSummonMonster(cid, name) setPlayerStorageValue(newPet, 83712, 1) return true end -- Se já houver um pet invocado, remova-o e invoque um novo, armazenando-o doRemoveCreature(pet[1]) local newPet = doSummonMonster(cid, name) setPlayerStorageValue(newPet, 83712, 1) return true end  
  15. Amei
    Muvuka recebeu reputação de Holograma em -=[TFS]=- 0.4 8.60 Como eu Uso a Soul System   
    FICO @Holograma VLW!
  16. Upvote
    Muvuka deu reputação a rafersiq em -=[TFS]=- 0.4 8.60 Como eu Uso a Soul System   
    coloca mais coisa no seu topico sobre a duvida que vc esta tendo 
     
  17. Upvote
    Muvuka deu reputação a Holograma em -=[TFS]=- 0.4 8.60 Como eu Uso a Soul System   
    solta o script ai que eu edito meu nobre
     
  18. Upvote
    Muvuka deu reputação a Holograma em -=[TFS]=- 0.4 8.60 - USAR SOMENTE AS AURAS Soul System   
    function checkDam(uid, AurAz, st) if (isCreature(uid)) and (os.time() - st < L_Soul.auras[AurAz].duration) then local p = getThingPos(uid) local poz = { {x = p.x, y = p.y - 2, z = p.z}, {x = p.x - 2, y = p.y, z = p.z}, {x = p.x, y = p.y + 2, z = p.z}, {x = p.x + 2, y = p.y, z = p.z} } -- Verifica se a tile está protegida if (getTileInfo(p).protection) then st = st - L_Soul.auras[AurAz].duration end local function getBest(a) local pz = poz[1] for i, v in pairs(poz) do if (getDistanceBetween(v, getThingPos(a)) < getDistanceBetween(pz, getThingPos(a))) then pz = v end end return pz end local creat = getUidsInArea({x = p.x - L_Soul.auras[AurAz].raio, y = p.y - L_Soul.auras[AurAz].raio, z = p.z}, {x = p.x + L_Soul.auras[AurAz].raio, y = p.y + L_Soul.auras[AurAz].raio, z = p.z}) local target = ((isCreature(getCreatureTarget(uid))) and getCreatureTarget(uid)) or 0 local cs = {} if (target == 0) then for _, v in pairs(creat) do -- Verifica se a criatura é um monstro ou se tem um alvo válido if ((getCreatureTarget(v) == uid) or (isMonster(v) or ((getCreatureSkullType(v) > 2) and (getCreatureTarget(v) == uid))) and (v ~= uid)) then table.insert(cs, v) end end target = (#cs > 0 and cs[math.random(#cs)]) or 0 end -- Verifica se o ataque foi feito pelo jogador if (isPlayer(uid)) then target = uid end if (target ~= 0) then doSendDistanceShoot(getBest(target), getThingPos(target), L_Soul.souls[AurAz].effects.distance) doTargetCombatHealth(uid, target, L_Soul.souls[AurAz].combat, -L_Soul.auras[AurAz].damage[1], -L_Soul.auras[AurAz].damage[2], 255) end addEvent(checkDam, L_Soul.auras[AurAz].interval, uid, AurAz, st) end end function sendEffect(uid, interval, at, st, AurAz) local at = at or 1 if (isCreature(uid)) then local p = getThingPos(uid) if (getTileInfo(p).protection) then st = st - L_Soul.auras[AurAz].duration end local poz = { {x = p.x, y = p.y - 2, z = p.z}, {x = p.x - 2, y = p.y, z = p.z}, {x = p.x, y = p.y + 2, z = p.z}, {x = p.x + 2, y = p.y, z = p.z} } if (os.time() - st > L_Soul.auras[AurAz].duration) then for i, v in ipairs(poz) do doSendDistanceShoot(v, p, L_Soul.souls[AurAz].effects.distance) end setPlayerStorageValue(uid, L_Soul.auras_sto, -1) addEvent(doSendMagicEffect, 250, p, L_Soul.souls[AurAz].effects.eff) return true end local next = poz[at + 1] and at + 1 or 1 doSendDistanceShoot(poz[at], poz[next], L_Soul.souls[AurAz].effects.distance) addEvent(sendEffect, interval, uid, interval, next, st, AurAz) end return true end function onSay(cid, words, param) domodlib("Soul System[LIB]") local lan = L_Soul.lang[L_Soul.language] local AurAz = words:explode(" ")[1] -- Verifica se a aura é válida if not (L_Soul.auras[AurAz]) then return false end -- Verifica se o jogador possui pedras de alma suficientes para ativar a aura if (#getPlayerSoulStonesByType(cid, AurAz) < L_Soul.auras[AurAz].stones_n) then return doPlayerSendCancel(cid, string.format(lan[19], AurAz, L_Soul.auras[AurAz].stones_n)) end -- Verifica se o jogador já está sob efeito de uma aura if (getPlayerStorageValue(cid, L_Soul.auras_sto) > 0) then return doPlayerSendCancel(cid, string.format(lan[20], math.floor(L_Soul.auras[AurAz].duration / 60))) end -- Verifica se o jogador está em uma área protegida if (getTileInfo(getThingPos(cid)).protection) then return doPlayerSendCancel(cid, lan[21]) end -- Define a aura que será ativada quando o jogador atacar setPlayerStorageValue(cid, "current_aura", AurAz) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, string.format("Agora você pode atacar para ativar a aura '%s'.", AurAz)) return true end function onCreatureHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin) local auraName = getPlayerStorageValue(attacker, "current_aura") -- Verifica se o ataque foi feito por um jogador e se uma aura está definida para ser ativada if isPlayer(attacker) and auraName then -- Ativa a aura quando o jogador atacar um monstro ou outro jogador sendEffect(attacker, L_Soul.auras[auraName].speed, nil, os.time(), auraName) checkDam(attacker, auraName, os.time()) setPlayerStorageValue(attacker, "current_aura", nil) -- Limpa a aura após ser ativada end end  
    --[[ System developed by MaXwEllDeN[maxwellden@hotmail.com] Version 1.0 ]] function onKill(cid, target, lastHit) if (getPlayerStorageValue(target, 7148) ~= -1) then doCreatureSetDropLoot(target, {}) end return registerCreatureEvent(target, "SoulD") end function onLogin(cid) setPlayerStorageValue(cid, 7126, -1) registerCreatureEvent(cid, "SoulATK") setPlayerStorageValue(cid, L_Soul.auras_sto, -1) return registerCreatureEvent(cid, "SoulKill") end local function TransformAMerda(cas) for a = 0, 255 do local pos = cas.pos pos.stackpos = a local item = getThingFromPos(pos) if (item.uid > 0) and (item.itemid == cas.it.itemid) and (cas.n == getItemAttribute(item.uid, "criaturaS")) and (not getItemAttribute(item.uid, "M_Time")) then return doTransformItem(item.uid, cas.nid) end end return false end function onDeath(cid, corpse, deathList) doItemSetAttribute(corpse.uid, "criaturaS", getCreatureName(cid):formal()) if (getPlayerStorageValue(cid, 7148) ~= -1) then addEvent(TransformAMerda, 1, {pos = getThingPos(cid), it = corpse, n = getCreatureName(cid), nid = getMonsterInfo(getPlayerStorageValue(cid, 7148)).lookCorpse}) return true end doItemSetAttribute(corpse.uid, "M_Time", os.clock()) return doItemSetAttribute(corpse.uid, "M_Soul", getCreatureName(cid):formal()) end local function Atacar(cid) if (not isCreature(cid)) then return false elseif (not isCreature(getCreatureTarget(cid))) then setPlayerStorageValue(cid, 7126, -1) return false end local target = getCreatureTarget(cid) local enc = isWithEnchantedW(cid) if (enc) then if (isWeapon(enc.arma.uid)) and (getDistanceBetween(getThingPos(getCreatureTarget(cid)), getThingPos(cid)) > 1) then setPlayerStorageValue(cid, 7126, -1) return false end local typ, enchant = L_Soul.souls[L_Soul.creatures[getItemAttribute(enc.arma.uid, "ES_Type")].type:lower()], L_Soul.creatures[getItemAttribute(enc.arma.uid, "ES_Type")].enchant doTargetCombatHealth(cid, target, typ.combat, -enchant.min, -enchant.max, typ.effects.eff) doSendDistanceShoot(getThingPos(cid), getThingPos(target), typ.effects.distance) if (enc.at == 1) then doPlayerSendTextMessage(cid, 27, string.format(lan[17], getItemNameById(enc.arma.itemid))) doItemSetAttribute(enc.arma.uid, "description", false) doItemSetAttribute(enc.arma.uid, "ES_Charges", false) else doItemSetAttribute(enc.arma.uid, "description", string.format(lan[16], getItemAttribute(enc.arma.uid, "ES_Type"), enc.at - 1, enchant.charges)) doItemSetAttribute(enc.arma.uid, "ES_Charges", enc.at - 1) end addEvent(Atacar, enchant.attack_speed, cid) else setPlayerStorageValue(cid, 7126, -1) end end function onAttack(cid, target) if (getPlayerStorageValue(cid, 7126) < 1) then setPlayerStorageValue(cid, 7126, 5) Atacar(cid) end return true end function isWithEnchantedW(uid) for a = 5, 6 do local item = getPlayerSlotItem(uid, a) if (item.uid > 2) and (getItemAttribute(item.uid, "ES_Charges")) then return {arma = item, at = getItemAttribute(item.uid, "ES_Charges")} end end return false end

     
    L_Soul = { souls = { ["dark"] = {effects = {distance = 31, eff = 17}, combat = COMBAT_DEATHDAMAGE}, ["flame"] = {effects = {distance = 3, eff = 15}, combat = COMBAT_FIREDAMAGE}, ["frozen"] = {effects = {distance = 36, eff = 43}, combat = COMBAT_ICEDAMAGE}, ["holy"] = {effects = {distance = 37, eff = 39}, combat = COMBAT_HOLYDAMAGE}, ["electric"] = {effects = {distance = 35, eff = 11}, combat = COMBAT_ENERGYDAMAGE}, }, creatures = { ["Necromancer"] = {chance = 50, type = "dark", summ = { hp = {hpb = 50, maxb = 700}, needSoulPoints = 50, needMana = 0, needHealth = 20, minP = 50, }, enchant = {charges = 100, min = 10, max = 60, attack_speed = 250}, }, ["Dragon Lord"] = {chance = 100, type = "flame", summ = { hp = {hpb = 50, maxb = 700}, needSoulPoints = 50, needMana = 0, needHealth = 20, minP = 50, }, enchant = {charges = 200, min = 50, max = 150, attack_speed = 1000}, }, ["Frost Dragon"] = {chance = 100, type = "frozen", summ = { hp = {hpb = 50, maxb = 700}, needSoulPoints = 50, needMana = 0, needHealth = 20, minP = 50, }, enchant = {charges = 200, min = 50, max = 160, attack_speed = 1500}, }, ["Wyrm"] = {chance = 100, type = "electric", summ = { hp = {hpb = 50, maxb = 700}, needSoulPoints = 50, needMana = 0, needHealth = 20, minP = 50, }, enchant = {charges = 200, min = 50, max = 160, attack_speed = 550}, }, ["Monk"] = {chance = 150, type = "holy", summ = { hp = {hpb = 50, maxb = 700}, needSoulPoints = 50, needMana = 0, needHealth = 20, minP = 50, }, enchant = {charges = 200, min = 50, max = 160, attack_speed = 550}, }, }, ids = {8300}, max_distance = 5, language = "en", auras_sto = 77143, soul_t = 10, -- Em Minutos } ---------------------- A U R A S ---------------------------- L_Soul.auras = { ["dark"] = {stones_n = 7, damage = {25, 250}, interval = 1200, duration = 120, raio = 4, speed = 150}, ["flame"] = {stones_n = 5, damage = {250, 650}, interval = 500, duration = 60, raio = 7, speed = 75}, ["frozen"] = {stones_n = 2, damage = {150, 350}, interval = 750, duration = 60, raio = 2, speed = 150}, ["electric"] = {stones_n = 5, damage = {150, 350}, interval = 750, duration = 60, raio = 2, speed = 150}, ["holy"] = {stones_n = 0, damage = {150, 350}, interval = 750, duration = 60, raio = 7, speed = 150}, } ------------------- E N C A N T A M E N T O ----------------- L_Soul.enchant = { weapons = { [2408] = {"dark", "flame", "frozen"}, -- Warlord Sword [2190] = {"dark", "holy"}, -- Wand of Vortex [2456] = {"dark", "holy"}, -- Bow [2400] = {"dark", "holy", "frozen", "flame", "electric"}, -- Magic Sword(SOV) }, } ------------------ L I N G U A G E M ------------------------ L_Soul.lang = { ["en"] = { "This soul stone is filled with a %s's %s soul!", "This soul stone must be near the creature's corpse.", "There's no soul!", "Your soul stone didn't supported the soul and broke! This %s's %s soul escaped!", "Congratulations, you caught a %s's soul[%s]!", "Filled with a %s's %s soul.", "This item can't be enchanted.", "To summon a %s you must have at least %d soul points.", "You can't summon a %s there.", "To summon a %s you must have at least %d mana points.", "To summon a %s you must have at least %d health points.", "The soul stone broke and the corpse was possessed by %s's %s soul!", "This corpse doesn't support this %s's powerful %s soul. The soul has escaped and is roaming the world and tormenting people.", "A body can't have two souls.", "The %s's soul was aprisioned in weapon.", "This weapon is enchanted with a %s's soul. Charges: %d/%d.", "Your %s lost charm.", "This weapon already is enchanted with a soul!", -- 18 --> AURAS <-- "You haven't enought %s souls[%d].", "You need wait %d minutes to use an aura protection again.", "You can't use an aura protection on protected zones.", { "Alive again!? How!? AH! It doesn't matter, i just want to get my revenge! MUHAUHAUHUAUA!", "OH how is sweet live!", }, } } function isWeapon(uid) -- Function by Mock the bear. local uid = uid or 0 local f = getItemWeaponType(uid) return (f == 1 or f == 2 or f == 3) or false end function string:formal() local self = self:sub(1, 1):upper() .. self:sub(2, #self) while (self:find(" (%l)")) do local a = self:find(" (%l)") self = self:sub(1, a) .. self:sub(a + 1, a + 1):upper() .. self:sub(a + 2, #self) end return self end function getUidsInArea(ext1, ext2) local uids = {} for a = 0, ext2.x-ext1.x do for b = 0, ext2.y-ext1.y do local pos = {x = ext1.x+a, y = ext1.y+b, z = ext1.z, stackpos = 255} local cid = getTopCreature(pos).uid if (isCreature(cid)) then table.insert(uids, cid) end end end return uids end function getItemsInContainerById(container, itemid) -- Function By Kydrai local items = {} if isContainer(container) and getContainerSize(container) > 0 then for slot = 0, getContainerSize(container) - 1 do local item = getContainerItem(container, slot) if isContainer(item.uid) then for i, v in ipairs (getItemsInContainerById(item.uid, itemid)) do table.insert(items, v) end elseif itemid == item.itemid then table.insert(items, item) end end end return items end function getAllPlayerItemsById(uid, itemid) local items = {} for a = CONST_SLOT_FIRST, CONST_SLOT_LAST do local item = getPlayerSlotItem(uid, a) if ((item.uid > 0) and (item.itemid == itemid)) then table.insert(items, item) end if ((isContainer(item.uid)) and (getContainerSize(item.uid) > 0)) then for i, v in ipairs(getItemsInContainerById(item.uid, itemid)) do table.insert(items, v) end end end return items end function getAllPlayerSoulStones(uid, empty) local stones = {} for _, s in ipairs(L_Soul.ids) do for _, v in pairs(getAllPlayerItemsById(uid, s)) do if not ((empty) and (not getItemAttribute(v.uid, "Soul"))) then table.insert(stones, v) end end end return stones end function getPlayerSoulStonesByType(uid, type) local stones = {} for _, v in pairs(getAllPlayerSoulStones(uid)) do if ((getItemAttribute(v.uid, "Soul")) and (L_Soul.creatures[getItemAttribute(v.uid, "Soul")].type:lower() == type:lower())) then table.insert(stones, v) end end return stones end function doPlayerRemoveSoulStoneByType(uid, type, ammount) local stones = getPlayerSoulStonesByType(uid, type) local ammount = ammount or 1 if (#stones < ammount) then return false end local a = 0 for _, v in pairs(stones) do if (a ~= ammount) then a = a + 1 doRemoveItem(v.uid, 1) else break end end return true end function getPlayerSoulStonesCount(uid, type) return #getPlayerSoulStonesByType(uid, type) end function onCreatureHealthChange(creature, attacker, attackerName, damage, damType, damMsg) if isPlayer(attacker) and isCreature(creature) and attackerName ~= creature then local auraName = getPlayerStorageValue(attacker, "current_aura") if auraName then local AuraAz = auraName:lower() if L_Soul.auras[AuraAz] and os.time() - creature:getStorageValue("last_hit_" .. AuraAz) > L_Soul.auras[AuraAz].interval then doCreatureSetStorageValue(creature, "last_hit_" .. AuraAz, os.time()) doSendDistanceShoot(creature:getPosition(), creature:getPosition(), L_Soul.souls[AuraAz].effects.distance) doTargetCombatHealth(attacker, creature, L_Soul.souls[AuraAz].combat, -L_Soul.auras[AuraAz].damage[1], -L_Soul.auras[AuraAz].damage[2], 255) end end end end function onSay(cid, words, param) domodlib("Soul System[LIB]") local lan = L_Soul.lang[L_Soul.language] local AuraAz = words:explode(" ")[1] if not (L_Soul.auras[AuraAz]) then return false end if (#getPlayerSoulStonesByType(cid, AuraAz) < L_Soul.auras[AuraAz].stones_n) then return doPlayerSendCancel(cid, string.format(lan[19], AuraAz, L_Soul.auras[AuraAz].stones_n)) end if (getPlayerStorageValue(cid, L_Soul.auras_sto) > 0) then return doPlayerSendCancel(cid, string.format(lan[20], math.floor(L_Soul.auras[AuraAz].duration/60))) end if (getTileInfo(getThingPos(cid)).protection) then return doPlayerSendCancel(cid, lan[21]) end setPlayerStorageValue(cid, L_Soul.auras_sto, os.time()) doPlayerRemoveSoulStoneByType(cid, AuraAz, L_Soul.auras[AuraAz].stones_n) setPlayerStorageValue(cid, "current_aura", AuraAz) -- Armazena a aura atual do jogador return true end  
  19. Upvote
    Muvuka deu reputação a Holograma em Error Console Morre trava Server e não mata o jogador quando mata ele com reflect stone and critical stone não reconhece o corpo do player   
    ok, vamos lá

    1.Erro no script youdead.lua:
     
    [16/04/2024 03:41:17] [Error - CreatureScript Interface] [16/04/2024 03:41:17] data/creaturescripts/scripts/youdead.lua:onPrepareDeath [16/04/2024 03:41:17] Description: [16/04/2024 03:41:18] (luaGetCreatureMaster) Creature not found [16/04/2024 03:41:18] [Error - CreatureScript Interface] [16/04/2024 03:41:18] data/creaturescripts/scripts/youdead.lua:onPrepareDeath [16/04/2024 03:41:19] Description: [16/04/2024 03:41:19] (luaGetCreatureName) Creature not found [16/04/2024 03:41:19] > Broadcasted message: "O Jogador Fogao [level: 699553] Acaba de Morrer Para false.". Parece que há uma tentativa de obter o nome da criatura que matou o jogador (lastHitKiller). No entanto, o sistema não conseguiu encontrar essa criatura. Isso pode acontecer se o jogador for morto por um evento ou condição do jogo em vez de uma criatura específica. Você pode precisar adicionar verificações adicionais para garantir que lastHitKiller seja uma criatura válida antes de tentar obter seu nome e mestre.

    2.Erro no script deathchannel.lua:
     
    [16/04/2024 03:41:23] [Error - CreatureScript Interface] [16/04/2024 03:41:23] data/creaturescripts/scripts/deathchannel.lua:onDeath [16/04/2024 03:41:23] Description: [16/04/2024 03:41:24] data/creaturescripts/scripts/deathchannel.lua:7: attempt to perform arithmetic on a boolean value [16/04/2024 03:41:24] stack traceback: [16/04/2024 03:41:24] data/creaturescripts/scripts/deathchannel.lua:7: in function <data/creaturescripts/scripts/deathchannel.lua:5> Parece que há um erro na linha 7 do script deathchannel.lua, onde uma operação aritmética está sendo tentada em um valor booleano. Isso geralmente ocorre quando você tenta realizar uma operação matemática em uma variável que não contém um valor numérico. Você precisará verificar o código na linha 7 do deathchannel.lua e garantir que todas as variáveis estejam definidas corretamente antes de tentar realizar operações matemáticas.


    3.Erro XML:
     
    XML: [16/04/2024 06:52:01] [Error - CreatureEvent::executeCombat] Call stack overflow. Parece que houve um estouro de pilha (stack overflow) em um evento de combate. Isso geralmente acontece quando há muitas chamadas recursivas ou aninhadas que excedem a capacidade da pilha de execução. Você precisará investigar o evento de combate especificado e verificar se há alguma lógica recursiva ou aninhada que precisa ser otimizada para evitar estouro de pilha.


     
    1. Para o script youdead.lua, vamos adicionar verificações adicionais para garantir que lastHitKiller seja uma criatura válida antes de tentar obter seu nome e mestre. Também vamos corrigir a mensagem de broadcast para exibir o nome do jogador que matou corretamente.
     
    function onPrepareDeath(cid, lastHitKiller, mostDamageKiller) if isPlayer(cid) then if lastHitKiller and isCreature(lastHitKiller) then local killerName = getCreatureName(lastHitKiller) if not isPlayer(lastHitKiller) and not isPlayer(getCreatureMaster(lastHitKiller)) then doBroadcastMessage("O jogador " .. getCreatureName(cid) .. " [level: " .. getPlayerLevel(cid) .. "] acabou de morrer para " .. tostring(killerName) .. ".", MESSAGE_STATUS_CONSOLE_RED) end end end return true end
    2.Para o script deathchannel.lua, vamos corrigir a operação aritmética na linha 7 para garantir que todas as variáveis estejam definidas corretamente antes de tentar realizar operações matemáticas.
     
    function onDeath(cid, corpse, deathList) local target = deathList[1] if target and isCreature(target) then local targetStorage = getCreatureStorage(target, storage) if targetStorage then doCreatureSetStorage(target, storage, targetStorage + 1) for _, pid in ipairs(getPlayersOnline()) do doPlayerSendChannelMessage(pid, '', info:format(getCreatureName(cid), getPlayerLevel(cid), getCreatureStorage(cid, storage), getPlayerSex(cid) == 1 and "o" or "a", isPlayer(target) and "player" or "monstro", getCreatureName(target), isPlayer(target) and " [Level: "..getPlayerLevel(target).."]." or "."), TALKTYPE_CHANNEL_O, 0xF) for _, frag in ipairs(frags) do if targetStorage == frag then doPlayerSendChannelMessage(pid, '', win:format(getCreatureName(target), frag, getCreatureName(cid)), TALKTYPE_CHANNEL_W, 0xF) end local cidStorage = getCreatureStorage(cid, storage) if cidStorage and cidStorage >= frag then doPlayerSendChannelMessage(pid, '', lose:format(getCreatureName(target), getCreatureName(cid), cidStorage + 1), TALKTYPE_CHANNEL_RN, 0xF) end end end doCreatureSetStorage(cid, storage, 0) return true end end return false end  
  20. Upvote
    Muvuka deu reputação a Holograma em -=[TFS]=- 0.4 8.60 - Se o player não tiver espaço no iventario ele não da pra click na chest e aparece essa memsagem em green "Voce nao tem espaço suficiente."   
    function onUse(cid, item, frompos, item2, topos) if item.uid == 1624 then if getPlayerStorageValue(cid, 1624) == -1 then if getPlayerLevel(cid) >= 0 then local espacoSuficiente = true -- Adiciona as mochilas de ID 10518 ao inventário do jogador for i = 1, 42 do if not doPlayerAddItem(cid, 10518, 1) then espacoSuficiente = false break end end -- Se houver espaço suficiente, adiciona as moedas às mochilas if espacoSuficiente then for i = 1, 42 do local backpack = doCreateItemEx(10518, 1) if backpack ~= 0 then for j = 1, 100 do doAddContainerItem(backpack, 2159, 1000) end doPlayerAddItemEx(cid, backpack, false) else espacoSuficiente = false break end end -- Se tudo ocorreu bem, informa ao jogador que ele recebeu o prêmio if espacoSuficiente then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Parabéns! Você ganhou um prêmio.") setPlayerStorageValue(cid, 1624, 1) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não tem espaço suficiente para as mochilas.") end else -- Se o jogador não tiver espaço suficiente, envia uma mensagem em green doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Voce nao tem espaço suficiente.") end else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você precisa ser level 0 para usar.") end else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você já pegou o bônus.") end end return true end  
  21. Upvote
    Muvuka deu reputação a Holograma em -=[TFS]=- 0.4 8.60 - Se Não Tiver Espaço no Inventario Slot Backpack Container Não Pega os Itens e Não da Use Chest Com Msg   
    function onUse(cid, item, fromPosition, itemEx, toPosition) if item.itemid == 1624 then if getPlayerStorageValue(cid, 1624) == -1 then if getPlayerLevel(cid) >= 717217 then local espacoSuficiente = true for i = 1, 42 do local backpack = doCreateItemEx(10518, 1) if backpack ~= 0 then for j = 1, 100 do doAddContainerItem(backpack, 2159, 1000) end if not doPlayerAddItemEx(cid, backpack, false) then espacoSuficiente = false doRemoveItem(backpack) break end else espacoSuficiente = false break end end if espacoSuficiente then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Parabéns! Você ganhou um prêmio.") setPlayerStorageValue(cid, 1624, 1) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não tem espaço suficiente para as mochilas.") end else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você precisa ser nível 717217 para usar.") end else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você já recebeu o bônus.") end end return true end  
  22. Upvote
    Muvuka deu reputação a Holograma em -=[TFS]=- 0.4 8.60 - Eu queria que bp se não tivesse espaço no iventario caisse no chão com dinheiro dentro da bp ou isse pro depot nome das town id DexSoft   
    poderia falar qual erro aparece no console?

     
    function onUse(cid, item, frompos, item2, topos) if item.uid == 1624 then if getPlayerStorageValue(cid, 1624) == -1 then if getPlayerLevel(cid) >= 0 then -- Verifica se o jogador tem espaço suficiente no inventário para as mochilas local enoughSpace = true for i = 1, 42 do if not doPlayerAddItem(cid, 10518, 1) then enoughSpace = false break end end if enoughSpace then -- Adiciona 1000 moedas (ID 2159) dentro de uma mochila (ID 10518) e repete 42 vezes for i = 1, 42 do local backpack = doCreateItemEx(10518, 1) if backpack ~= 0 then for j = 1, 100 do doAddContainerItem(backpack, 2159, 1) end doPlayerAddItemEx(cid, backpack, false) else enoughSpace = false break end end end if enoughSpace then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Parabéns! Você ganhou um prêmio.") else -- Não há espaço suficiente, então cai no chão com dinheiro dentro local townID = 1 -- Altere isso para o ID da cidade desejada (1 para DexSoft) local tile = getTownTemplePosition(townID) local container = doCreateItemEx(10518, 1) for i = 1, 100 do doAddContainerItem(container, 2159, 1) end doTeleportThing(container, tile, false) doSendMagicEffect(tile, CONST_ME_TELEPORT) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você não tinha espaço suficiente, a mochila foi enviada para o depot.") end setPlayerStorageValue(cid, 1624, 1) else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você precisa ser level 0 para usar.") end else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você já pegou o bônus.") end end return true end  
  23. Upvote
    Muvuka deu reputação a Holograma em [PEDIDO] -=[TFS]=- 0.4 8.60 - Reflect Stone Só Falta Action/Scripts   
    local lvldodge = 48903 local percent = 0.1 -- Porcentagem padrão de reflexão de dano local storageID = 10001 -- ID do storage para controlar a habilidade de reflexão function onStatsChange(cid, attacker, type, combat, value) if type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS and isCreature(attacker) then if (getPlayerStorageValue(cid, lvldodge) * 3) >= math.random(0, 1000) then local reflectValue = math.ceil(value * percent) doCreatureAddHealth(attacker, -reflectValue) doSendAnimatedText(getCreaturePos(cid), "Reflected!", 6) -- Incrementar o storage para indicar que a habilidade foi usada setPlayerStorageValue(cid, storageID, 1) return false end end return true end -- Adicionando o evento ao XML local eventXML = [=[<event type="statschange" name="ReflectStone" event="script" value="reflectStone.lua"/>]=] local file = io.open('data/creaturescripts/creaturescripts.xml', 'a') if file then file:write(eventXML) file:close() else print("Erro ao abrir o arquivo creaturescripts.xml") end -- Registro do evento no login.lua local loginScript = [=[registerCreatureEvent(cid, "ReflectStone")]=] local loginFile = io.open('data/creaturescripts/login.lua', 'a') if loginFile then loginFile:write(loginScript) loginFile:close() else print("Erro ao abrir o arquivo login.lua") end  
  24. Upvote
    Muvuka deu reputação a Holograma em -=[TFS]=- 0.4 8.60 - Eu queria que bp se não tivesse espaço no iventario caisse no chão com dinheiro dentro da bp ou isse pro depot nome das town id DexSoft   
    function onUse(cid, item, frompos, item2, topos) if item.uid == 1624 then if getPlayerStorageValue(cid, 1624) == -1 then if getPlayerLevel(cid) >= 0 then -- Verifica se o jogador tem espaço suficiente no inventário para as mochilas local enoughSpace = true for i = 1, 42 do if not doPlayerAddItem(cid, 10518, 1) then enoughSpace = false break end end if enoughSpace then -- Adiciona 1000 moedas (ID 2159) dentro de uma mochila (ID 10518) e repete 100 vezes for i = 1, 100 do local backpack = doCreateItemEx(10518, 1) if backpack ~= 0 then for j = 1, 42 do doAddContainerItem(backpack, 2159, 1000) end doPlayerAddItemEx(cid, backpack, false) else enoughSpace = false break end end end if enoughSpace then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Parabéns! Você ganhou um prêmio.") else -- Não há espaço suficiente, então cai no chão com dinheiro dentro local townID = 1 -- Altere isso para o ID da cidade desejada (1 para DexSoft) local tile = getTownTemplePosition(townID) local container = doCreateItemEx(10518, 1) for i = 1, 42 do doAddContainerItem(container, 2159, 1000) end doItemSetAttribute(container, "depot", true) doTeleportThing(container, tile, false) doSendMagicEffect(tile, CONST_ME_TELEPORT) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você não tinha espaço suficiente, a mochila foi enviada para o depot.") end setPlayerStorageValue(cid, 1624, 1) else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você precisa ser level 0 para usar.") end else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você já pegou o bônus.") end end return true end Este script verifica se o jogador tem espaço suficiente no inventário para as mochilas. Se tiver, ele adiciona as mochilas diretamente ao inventário do jogador. Caso contrário, ele cria as mochilas com dinheiro dentro e as envia para o depot da cidade especificada. 
  25. Upvote
    Muvuka deu reputação a Holograma em -=[TFS]=- 0.4 8.60 - Recovery Exp ele só recupera quem é level 1 até 100 não recupera quem é level 717217 eu quero que ele recupera level dês do level 1 até 717217 ele recupera level quando morre   
    local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if (not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid local msg = string.lower(msg) local itemid, count = 9020, 300 -- Edite o id e a quantidade do item aqui if isInArray({"recover", "recuperar", "exp", "experience"}, msg) then npcHandler:say("Você deseja recuperar a experiência perdida após a sua morte por " .. count .. " " .. getItemNameById(itemid) .. "? {yes}", cid) talkState[talkUser] = 1 elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if getPlayerStorageValue(cid, death_table.before_exp) ~= -1 and getPlayerExperience(cid) < getPlayerStorageValue(cid, death_table.before_exp) then if doPlayerRemoveItem(cid, itemid, count) == TRUE then local count = (getPlayerStorageValue(cid, death_table.before_exp) - getPlayerStorageValue(cid, death_table.after_exp)) doPlayerAddExp(cid, count) npcHandler:say("Obrigado! Aqui está sua experiência.", cid) else npcHandler:say("Desculpe, você não tem " .. getItemNameById(itemid) .. " suficientes!", cid) end else npcHandler:say("Desculpe, você não morreu ou já recuperou sua exp perdida!", cid) end talkState[talkUser] = 0 elseif msg == "no" then npcHandler:say("Then not", cid) talkState[talkUser] = 0 end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())  
  • Quem Está Navegando   0 membros estão online

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