I'm working on the second version of the banhammer, which should have 3 modes: destructo, kick, and ban. However, no matter what mode it's in, it will never kill bricks and always tries to ban and then kick players. Here's the script. There are other scripts which set up the prefs, so I know it's not that the prefs aren't being registered. They are executing before this too, in fact, this is the last script to execute.
Also, the centerprint stuff isn't working. Not as big as an issue and I'm going to take care of that myself later.
function serverCmdbhmode(%client, %arg) //Server command "/bhmode modename"
{
switch$(%arg) //For argument is "" perform action
{
case "": %client.centerPrint('5', '<color:ff0000>You need to enter a mode (destructo, kick, ban).', '');
case "destructo":$Pref::BanHammer::Mode = 0;
case "destroy":$Pref::BanHammer::Mode = 0; //I thought a lot of people would just type "destroy"
case "kick":$Pref::BanHammer::Mode = 1;
case "ban":$Pref::BanHammer::Mode = 2;
}
}
function serverCmdbanhammer(%client) //Command /banhammer
{
%client.player.mountImage("BanHammerImage",0); //Gives them a banhammer. They will be checked for admin next.
}
function BanHammerImage::OnMount(%this, %obj) //When you switch to the hammer
{
%client = %obj.client; //This lets me reference the mounter's client more easily
if($Pref::BanHammer::SuperAdminOnly && !%client.isSuperAdmin) //If super admin only and client is not super admin..
{
%client.player.unMountImage("BanHammerImage"); //Unmount the hammer,
%client.centerPrint('5', '<color:ff0000>This tool is for super admins only.', ''); //And tell them why
}
else if(!%client.isAdmin) //Otherwise, check if they aren't an admin
{
%client.player.unMountImage("BanHammerImage"); //If they aren't, unmount
%client.centerPrint('5', '<color:ff0000>This tool is for admins only.', ''); //Tell them it's admin only.
}
else //Neither of the above happened, so take no action.
Parent::OnMount(%this, %obj);
}
function BanHammerProjectile::onCollision(%this, %obj, %col, %fade, %pos, %normal) //When the projectile hits something.
{
if($Pref::BanHammer::Mode = 0 && %col.getClassName() $="fxDTSBrick") //If it's a brick and you're in destructo mode...
{
%col.killBrick(); //Destroy it.
}
else if($Pref::BanHammer::Mode = 0 && %col.getClassName() $="WheeledVehicle" || %col.getClassName() $="AIplayer") //If it's a vehicle or a bot, and you're in destructo mode..
{
%col.kill(); //Destroy it.
}
else if($Pref::BanHammer::Mode = 1 && %col.getClassName() $="Player") //If it's a player and you're in kick mode
{
%client = %col.Client;
%victimClientID = %client.getID();
servercmdkick(%obj.client,%client,%victimBLID);
}
else if($Pref::BanHammer::Mode = 2 && %col.getClassName() $="Player") //If it's a player and you're in ban mode...
{
%client = %col.Client; //Again, easier reference of client
%BLID = %client.BL_ID; //Get their Blockland ID, needed to ban
%BanLength = $Pref::BanHammer::BanLength; //Use the ban length preference for the ban length
%reason = $Pref::BanHammer::Reason; //Use the reason pref for the ban reason
servercmdban(%obj.client,%client,%BLID,%BanLength,%reason); //Ban them, using the above variables
}
}