Faaala, pessoar.
Há um tempo vi em uma comunidade gringa um script super criativo que se baseava no anime Death Note. Através da função onTextEdit(cid, item, newText), o scripter criou um livro que matava jogadores cujo nome fosse escrito.
Mas era um código simples e limitado, você só podia matar um jogador por vez e o livro se tornava inútil depois disso.
Então resolvi criar meu próprio Death Note com alguns bônus.
- Você pode matar um número de jogadores configurável por vez, ou ilimitados se for CM ou mais.
- Existe um delay entre a escrita do nome e a morte do alvo de 40 segundos. (Igual o anime)
- Depois de escritos os nomes, o jogador que usou o Death Note, fica impossibilitado de usar denovo por 30 minutos. (Sem exhaust para CMs ou mais)
- Jogadores com red skull ou black skull não podem ser mortos pelo Death Note.
- O livro não se inutiliza.
Bom, vamos começar?
1 - Vá em seus items.xml e troque os atributos dos seguintes itens:
<item id="1972" article="a" name="death note"> <attribute key="weight" value="1000"> <attribute key="writeable" value="1"> <attribute key="maxTextLen" value="512"> <attribute key="writeOnceItemId" value="1955"> </item>
<item id="1955" article="a" name="death note"> <attribute key="weight" value="1000"> </item>
2 - Vá em creaturescripts/scripts, crie um arquivo chamado deathnote.lua e cole o seguinte script abaixo:
local deathnote = { max = 3, delay = 40, interval = 30 * 60 } local function DeathNote(param) if isCreature(param.target) then local position, damage = getThingPosition(param.target), getCreatureMaxHealth(param.target) return doAreaCombatHealth(0, COMBAT_DEATHDAMAGE, getThingPosition(param.target), 0, -(damage * 10), -(damage * 10), CONST_ME_MORTAREA) end end function onTextEdit(cid, item, newText) if item.itemid == 1972 then newText = string.explode(newText, "\n") if #newText > deathnote.max and getPlayerGroupId(cid) == 1 then doPlayerSendCancel(cid, "Sorry, but you cannot kill more than ".. deathnote.max .." players.") else if os.time() > getPlayerStorageValue(cid, 101011) or getPlayerGroupId(cid) > 3 then for _, name in ipairs(newText) do local target = getPlayerByNameWildcard(name) if target then if getCreatureSkullType(cid) >= 4 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, but ".. name .." cannot die by the power of Death Note.") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, name .." will die in ".. deathnote.delay .." seconds.") setPlayerStorageValue(cid, 101011, os.time() + deathnote.interval) addEvent(DeathNote, deathnote.delay * 1000, {target = target}) end else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, but ".. name .." isn't in this world.") end end else doPlayerSendCancel(cid, "You are exhausted to use Death Note.") end end return false end return true end
3 - Ainda em creaturescripts/scripts, abra o arquivo login.lua e adicione a seguinte linha:
registerCreatureEvent(cid, "DeathNote")
Antes de:
return true
4 - Abra o arquivo creaturescripts.xml e adicione a seguinte chave.
<event type="textedit" name="DeathNote" event="script" value="deathnote.lua"/>
Para usar o Death Note depois de instalado o script, basta dar Use no livro e escrever um nome em cada linha dando Enter depois. Por exemplo:
pess0a
Lordfire
Vodkart
Beeki
E por aí vai.