World Code:
//Timeout Code by Sulfrox
class MinQueue{constructor(i,t,e){t=e=Uint32Array,this.c=i,this.k=new t(i+1),this.p=new e(i+1),this.h=!1,this.l=0}bbu(i){let t=this.k,e=this.p,r=t[i],h=e[i];for(;i>1;){let s=i>>>1;if(e[s]<=h)break;t[i]=t[s],e[i]=e[s],i=s}t[i]=r,e[i]=h}bbd(i){let t=this.k,e=this.p,r=t[i],h=e[i],s=1+(this.l>>>1),u=this.l+1;for(;i<s;){let n=i<<1,l=e[n],m=t[n],_=n,p=n+1;if(p<u&&e[p]<l&&(l=e[p],m=t[p],_=p),l>=h)break;t[i]=m,e[i]=l,i=_}t[i]=r,e[i]=h}push(i,t){if(this.l===this.c)throw"heap full";if(this.h)this.k[1]=i,this.p[1]=t,this.l++,this.bbd(1),this.h=!1;else{let e=this.l+1;this.k[e]=i,this.p[e]=t,this.l++,this.bbu(e)}}pop(){if(0!==this.l)return this.rpe(),this.l--,this.h=!0,this.k[1]}peekPriority(){if(0!==this.l)return this.rpe(),this.p[1]}peek(){if(0!==this.l)return this.rpe(),this.k[1]}rpe(){this.h&&(this.k[1]=this.k[this.l+1],this.p[1]=this.p[this.l+1],this.bbd(1),this.h=!1)}}let currently_running_timer,TimerQueue=new MinQueue(1024),TimerDictionary=[],TimerNum=0,TickNum=0;function setTimeOut(i,t){let e=TickNum+Math.floor(t/50);TimerDictionary[TimerNum]=i,TimerQueue.push(TimerNum,e),TimerNum++}function tick(){if(TickNum++,currently_running_timer)currently_running_timer(),currently_running_timer=void 0;else if(TimerQueue.peekPriority()<=TickNum){let i=TimerQueue.peek();void 0!==i&&(currently_running_timer=TimerDictionary[i]),TimerQueue.pop(),delete TimerDictionary[i]}}
const zombiefiedPlayers = new Set();
const transformedPlayers = new Set();
function onPlayerDamagingOtherPlayer(attackerId, victimId, damageDealt, withItem, bodyPartHit, damagerDbId) => {
const held = api.getHeldItem(attackerId);
if (
!held ||
held.name !== "Iron Bow" ||
held.attributes?.customDisplayName !== "Zombiefier"
) return;
const duration = 20000;
// 🧟 Hit another player
if (attackerId !== victimId) {
if (zombiefiedPlayers.has(victimId)) return;
zombiefiedPlayers.add(victimId);
api.changePlayerIntoSkin(victimId, "body", "Zombie");
api.changePlayerIntoSkin(victimId, "legs", "Zombie");
api.changePlayerIntoSkin(victimId, "head", "Zombie");
api.applyEffect(victimId, "Slowness", duration, { inbuiltLevel: 1 });
api.applyEffect(victimId, "Weakness", duration, { inbuiltLevel: 1 });
api.setClientOption(victimId, "dealingDamageMultiplier", 0.5);
setTimeOut(() => {
api.removeAppliedSkin(victimId);
api.setClientOption(victimId, "dealingDamageMultiplier", 1);
zombiefiedPlayers.delete(victimId);
}, duration);
return;
}
// 🌀 Shot yourself
if (transformedPlayers.has(attackerId)) return;
transformedPlayers.add(attackerId);
api.changePlayerIntoSkin(attackerId, "body", "Zombie");
api.changePlayerIntoSkin(attackerId, "legs", "Zombie");
api.changePlayerIntoSkin(attackerId, "head", "Zombie");
const form = Math.random() < 0.5 ? "big" : "small";
if (form === "big") {
// Scale up
api.scalePlayerMeshNodes(attackerId, {
"TorsoNode": [1.5, 1.5, 1.5],
"HeadMesh": [1.5, 1.5, 1.5],
"ArmRightMesh": [1.5, 1.5, 1.5],
"ArmLeftMesh": [1.5, 1.5, 1.5],
"LegLeftMesh": [1.5, 1.5, 1.5],
"LegRightMesh": [1.5, 1.5, 1.5],
});
api.applyEffect(attackerId, "Damage", duration, { inbuiltLevel: 2 });
api.applyEffect(attackerId, "Damage Reduction", duration, { inbuiltLevel: 1 });
} else {
// Scale down
api.scalePlayerMeshNodes(attackerId, {
"TorsoNode": [0.3, 0.3, 0.3],
"HeadMesh": [0.3, 0.3, 0.3],
"ArmRightMesh": [1.2, 1.2, 1.2],
"ArmLeftMesh": [1.2, 1.2, 1.2],
"LegLeftMesh": [0.5, 0.7, 0.5],
"LegRightMesh": [0.5, 0.7, 0.5],
});
api.applyEffect(attackerId, "Speed", duration, { inbuiltLevel: 1 });
api.applyEffect(attackerId, "Health Regen", duration/2, { inbuiltLevel: 1 });
}
// Revert form after duration
setTimeOut(() => {
api.scalePlayerMeshNodes(attackerId, {
"TorsoNode": [1, 1, 1],
"HeadMesh": [1, 1, 1],
"ArmRightMesh": [1, 1, 1],
"ArmLeftMesh": [1, 1, 1],
"LegLeftMesh": [1, 1, 1],
"LegRightMesh": [1, 1, 1],
});
api.removeAppliedSkin(attackerId);
transformedPlayers.delete(attackerId);
}, duration);
}