Anti-Hammer Script

Author Topic: Anti-Hammer Script  (Read 947 times)

I've played on a server that has it but I can't find it anywhere.
This addon just pulls up a gui that tells the player not to hit others and cancels their hit.

those are common on crpg servers to prevent rdm

those are common on crpg servers to prevent rdm
I know, that's why I am looking for it.

Code: [Select]
package swol_noHammerPlayers
{
function hammerImage::onHitObject(%db,%pl,%slot,%hit,%hitPos,%normal)
{
if(%pl.getClassName() !$= "Player")
return parent::onHitObject(%db,%pl,%slot,%hit,%hitPos,%normal);
if(%hit.getClassName() $= "Player")
{
if(isObject(%cl = %pl.client))
commandToClient(%cl,'MessageBoxOK',"Don't be rude","Please refrain from being annoying");
%pl.unMountImage(!%pl.playThread(1,root));
return;
}
parent::onHitObject(%db,%pl,%slot,%hit,%hitPos,%normal);
}
};
activatePackage(swol_noHammerPlayers);
You'd want to do something along these lines
« Last Edit: March 25, 2018, 03:47:34 PM by Swollow »

Sorry, I am not good with coding, do I just put this into a server.cs file?

You want to create a new folder in your Add-ons directory, then add a description.txt file inside that folder (there doesnt have to be anything in it. also namecheck.txt isn't required), then make a new file called server.cs and paste Swollow's code in. To make a new cs file, you open any text editor and save it like you normally would with any text file but before you save it, name it "server.cs".