Postado Maio 24, 2015 10 anos Olá, estou com esse script de amuleto em meu servidor, ele consiste em proteger o player em x% de monstros, porém estou com um problema, testei aqui e funcionou apenas com players, funcionou perfeitamente com players, apesar de que as vezes aparece que a porcentagem protegida foi de: 1b~e. Acho que o valor é muito grande e os números bugam, porém além desse bugzinho, com monstros o amuleto não funcionou, teria como arrumar isso? Ficaria muito grato. Tipo, pode colocar só para monstros ou só para players, ou ambos, não importa, desde que funcione. Script: local porcentagem = 40 -- Porcentagem de dano que será BLO-QUE-A-DO local pt_br = true function onStatsChange(cid, attacker, type, combat, value) local lang = {"You lose %d hitpoints (damage protected by amulet: %x).","Você perdeu %d pontos de vida (proteção do amuleto: %x)."} local reset = 9235 if getPlayerSlotItem(cid,2).itemid == 2218 then if type == 1 or type == 3 then if getPlayerStorageValue(cid,reset) == 2 then setPlayerStorageValue(cid,reset,1) return true else local new_dmg = math.ceil(((100-porcentagem)/100)*value) setPlayerStorageValue(cid,reset,2) doTargetCombatHealth(attacker, cid, combat, -new_dmg, -new_dmg, -1) doPlayerSendCancel(cid,(pt_br and lang[2]:format(new_dmg, value-new_dmg) or lang[1]:format(new_dmg, value-new_dmg))) return false end end end return true end Muito Obrigado, REP+ Editado Maio 24, 2015 10 anos por ScythePhantom (veja o histórico de edições)
Postado Maio 25, 2015 10 anos local porcentagem = 40 -- Porcentagem de dano que será BLO-QUE-A-DO local pt_br = true function onStatsChange(cid, attacker, type, combat, value) local lang = {"You lose %d hitpoints (damage protected by amulet: %d).", "Você perdeu %d pontos de vida (proteção do amuleto: %d)."} local reset = 9235 if getPlayerSlotItem(cid, 2).itemid == 2218 then if type == 1 or type == 3 then if getPlayerStorageValue(cid,reset) == 2 then setPlayerStorageValue(cid,reset,1) return true else local new_dmg = math.ceil(((100-porcentagem)/100)*value) setPlayerStorageValue(cid,reset,2) doTargetCombatHealth(attacker, cid, combat, -new_dmg, -new_dmg, -1) doPlayerSendCancel(cid,(pt_br and lang[2]:format(new_dmg, value-new_dmg) or lang[1]:format(new_dmg, value-new_dmg))) return false end end end return true end _ .-'` `} _./) / } .'o \ | } '.___.'`.\ {` /`\_/ , `. } ME DA UMA NOZ! \=' .-' _`\ { `'`;/ `, } _\ @ ; } /__`;-...'--' Cluck!
Postado Maio 25, 2015 10 anos Autor local porcentagem = 40 -- Porcentagem de dano que será BLO-QUE-A-DO local pt_br = true function onStatsChange(cid, attacker, type, combat, value) local lang = {"You lose %d hitpoints (damage protected by amulet: %d).", "Você perdeu %d pontos de vida (proteção do amuleto: %d)."} local reset = 9235 if getPlayerSlotItem(cid, 2).itemid == 2218 then if type == 1 or type == 3 then if getPlayerStorageValue(cid,reset) == 2 then setPlayerStorageValue(cid,reset,1) return true else local new_dmg = math.ceil(((100-porcentagem)/100)*value) setPlayerStorageValue(cid,reset,2) doTargetCombatHealth(attacker, cid, combat, -new_dmg, -new_dmg, -1) doPlayerSendCancel(cid,(pt_br and lang[2]:format(new_dmg, value-new_dmg) or lang[1]:format(new_dmg, value-new_dmg))) return false end end end return true end O amuleto está funcionando contra players, porém contra fields e monstros não, tipo, tem como colocar para aparecer a mensagem só se for atacado por player não? Editado Maio 25, 2015 10 anos por ScythePhantom (veja o histórico de edições)
Postado Maio 25, 2015 10 anos local porcentagem = 40 -- Porcentagem de dano que será BLO-QUE-A-DO local pt_br = true function onStatsChange(cid, attacker, type, combat, value) local lang = {"You lose %d hitpoints (damage protected by amulet: %d).", "Você perdeu %d pontos de vida (proteção do amuleto: %d)."} local reset = 9235 if getPlayerSlotItem(cid, 2).itemid == 2218 and isPlayer(attacker) then if type == 1 or type == 3 then if getPlayerStorageValue(cid,reset) == 2 then setPlayerStorageValue(cid,reset,1) return true else local new_dmg = math.ceil(((100-porcentagem)/100)*value) setPlayerStorageValue(cid,reset,2) doTargetCombatHealth(attacker, cid, combat, -new_dmg, -new_dmg, -1) doPlayerSendCancel(cid,(pt_br and lang[2]:format(new_dmg, value-new_dmg) or lang[1]:format(new_dmg, value-new_dmg))) return false end end end return true end _ .-'` `} _./) / } .'o \ | } '.___.'`.\ {` /`\_/ , `. } ME DA UMA NOZ! \=' .-' _`\ { `'`;/ `, } _\ @ ; } /__`;-...'--' Cluck!
Postado Maio 25, 2015 10 anos Autor local porcentagem = 40 -- Porcentagem de dano que será BLO-QUE-A-DO local pt_br = true function onStatsChange(cid, attacker, type, combat, value) local lang = {"You lose %d hitpoints (damage protected by amulet: %d).", "Você perdeu %d pontos de vida (proteção do amuleto: %d)."} local reset = 9235 if getPlayerSlotItem(cid, 2).itemid == 2218 and isPlayer(attacker) then if type == 1 or type == 3 then if getPlayerStorageValue(cid,reset) == 2 then setPlayerStorageValue(cid,reset,1) return true else local new_dmg = math.ceil(((100-porcentagem)/100)*value) setPlayerStorageValue(cid,reset,2) doTargetCombatHealth(attacker, cid, combat, -new_dmg, -new_dmg, -1) doPlayerSendCancel(cid,(pt_br and lang[2]:format(new_dmg, value-new_dmg) or lang[1]:format(new_dmg, value-new_dmg))) return false end end end return true end Tipo, o player hita 370, daí diz que protegeu 61, porém o player hitou apenas 140, enquanto era para hitar 310...
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.