Author Topic: /PVP command to disable fighting between players  (Read 437 times)

/title. A command that allows a specific player to be included in player vs. player fighting. /PVP once would toggle it on, allowing them to fight any other players that also have PVP on. /PVP again would disable it. From a quick skim through some search results, haven't found anything like this, but I've seen it on things like Jorgur's RPG. Maybe also give players with pvp on a different colored name? That's not really needed, but that'd be great too. Thanks for reading and helping.

Code: [Select]
function servercmdPvP(%this)
{
    if(!%this.isSuperAdmin)
          return;

    if($pvp != 1)
    {
           $pvp = 1;
           return;
     }
      $pvp = 0;
}

package pvp
{
    function Armor::onDamage(%this,%player,%dmg)
    {
         if($pvp == 1)
         {
              %dmg = 0;
          }
          parent::onDamage(%this,%player,%dmg);
    }
};
activatePackage(pvp);
This is the simplest PVP code available, and will disable damage when turned on. It can be toggled. For specific players and stuff, I would suggest replacing $pvp with %this.pvp in the serverCmd and %player.client.pvp in the onDamage package. Also run an extra check to see if the player dealing the damage also has pvp on.

If you have no clue how to go about this, ask Jes00 to make it or something
« Last Edit: January 27, 2016, 09:32:11 PM by Path »

It's always your best bet to return the parent.