BetterDeadThanZed

Anti-PVP script

43 posts in this topic

Let's start with this: I don't care if you think Exile should only be PVP. I am running a PVE server and a lot of people like it so nyah.

Anyway, I found this Anti-PVP script on Github: https://github.com/PixelDetonator/A3-Exile-Mod-Anti-PVP

I tried to integrate it with the ExileClient_object_player_event_onHandleDamage.sqf that comes with Exile Reborn, but I can't get it to work. I get errors. 

This is the ExileClient_object_player_event_onHandleDamage.sqf from Exile Reborn:

Spoiler

/**
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_unit","_selectionName","_amountOfDamage","_sourceOfDamage","_typeOfProjectile"];
//private["_unit","_selectionName","_amountOfDamage","_sourceOfDamage","_typeOfProjectile", "_hit", "_damage", "_source", "_ammo"];
_unit             = _this select 0;
_selectionName    = _this select 1;
_amountOfDamage   = _this select 2;
_sourceOfDamage   = _this select 3;
_typeOfProjectile = _this select 4;

_chanceForKnockDown = [_typeOfProjectile] call JohnO_fnc_getBulletRating;
_duration = _chanceForKnockDown + 20;

if (_chanceForKnockDown >= random 100) then
{
	if !(ExileReborn_playerIsKnockedOut) then
	{
		if (ExileClientIsAutoRunning) then
		{
			call ExileClient_system_autoRun_stop;
		};
			
		[_duration] spawn JohnO_fnc_maintainKnockOut;
	};	
};	

if (_typeOfProjectile == "") then
{
}
else
{	
	if !(vehicle player != player) then 
	{
		player setBleedingRemaining 90;

		player setVariable ["JohnO_lastSourceOfDamage",_sourceOfDamage,true];
		
		if !(ExileReborn_playerIsWounded) then
		{	
			ExileReborn_playerIsWounded = true;
			ExileReborn_woundWasTreated = false;
			profileNamespace setVariable ["ExileReborn_playerIsWounded",ExileReborn_playerIsWounded];
			profileNamespace setVariable ["ExileReborn_woundWasTreated",ExileReborn_woundWasTreated];
		};	

 		if !(ExileRebornClient_CustomHit_soundIsPlaying) then
 		{
 			ExileRebornClient_CustomHit_soundIsPlaying = true;
 			[] spawn JohnO_fnc_playCustomHitSound;
 		};	
 
 		titleText["","WHITE OUT",0.2];
 		titleText["","WHITE IN",0.2];		
	};	
};	

 

 

I was wondering if someone could help me with merging these two files together so the anti-pvp will work with the custom stuff from Exile Reborn.

Share this post


Link to post
Share on other sites

As far as I can see it needs a few other scripts to work. 

JohnO_fnc_getBulletRating
JohnO_fnc_maintainKnockOut
ExileReborn_playerIsWounded
ExileReborn_woundWasTreated
JohnO_lastSourceOfDamage
JohnO_fnc_playCustomHitSound

That at least gives sense why it doesn't work, it uses like 4 different functions from JohnO, and 2 variables from ExileReborn. 

Share this post


Link to post
Share on other sites
Advertisement

not many like playing PvP so having a PvE server so you build bases without the hassle of people fucking shit up and so on, but for the script i think it was to stop people from shooting one another 

Share this post


Link to post
Share on other sites
8 hours ago, ka0s said:

As far as I can see it needs a few other scripts to work. 


JohnO_fnc_getBulletRating

JohnO_fnc_maintainKnockOut

ExileReborn_playerIsWounded

ExileReborn_woundWasTreated

JohnO_lastSourceOfDamage

JohnO_fnc_playCustomHitSound

That at least gives sense why it doesn't work, it uses like 4 different functions from JohnO, and 2 variables from ExileReborn. 

I'm using Exile Reborn so I have all that other stuff. I just can't get the placement of the anti-pvp code correct. I keep getting errors any time I try something different.

5 hours ago, Super Jerome said:

Lol, you crack me up @BetterDeadThanZed what is "nyah" HAHAHA. On a serious note, what does an anti-pvp script do actually? By that I mean, how does it discourage PVP.

From what I can tell, I think the script causes the attacker to receive the damage instead of the person being attacked.

Share this post


Link to post
Share on other sites

i cant work it out with just exile as i changed the code with the @Exile code of ExileClient_object_player_event_onHandleDamage.sqf and all it did was let me kill the other player, even if i used the script from the dl still not working.

What ashame as this is very useful

Share this post


Link to post
Share on other sites

As far as I can tell, that just notifies everyone in the server that a player killed another player, which is announced in the chat area already. I'm looking to either remove damage done from another player, or to reflect the damage back on the attacker.

Share this post


Link to post
Share on other sites

Something like this?

Not tested.

Spoiler

/**
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_unit","_selectionName","_amountOfDamage","_sourceOfDamage","_typeOfProjectile"];
_unit             = _this select 0;
_selectionName    = _this select 1;
_amountOfDamage   = _this select 2;
_sourceOfDamage   = _this select 3;
_typeOfProjectile = _this select 4;

if (isPlayer _sourceOfDamage && !(_sourceOfDamage isEqualTo player)) exitWith {
    _amountOfDamage = 0;
    _amountOfDamage
};

_chanceForKnockDown = [_typeOfProjectile] call JohnO_fnc_getBulletRating;
_duration = _chanceForKnockDown + 20;

if (_chanceForKnockDown >= random 100) then
{
    if !(ExileReborn_playerIsKnockedOut) then
    {
        if (ExileClientIsAutoRunning) then
        {
            call ExileClient_system_autoRun_stop;
        };
            
        [_duration] spawn JohnO_fnc_maintainKnockOut;
    };    
};    

if (_typeOfProjectile == "") then
{
}
else
{    
    if !(vehicle player != player) then
    {
        player setBleedingRemaining 90;

        player setVariable ["JohnO_lastSourceOfDamage",_sourceOfDamage,true];

        if !(ExileReborn_playerIsWounded) then
        {    
            ExileReborn_playerIsWounded = true;
            ExileReborn_woundWasTreated = false;
            profileNamespace setVariable ["ExileReborn_playerIsWounded",ExileReborn_playerIsWounded];
            profileNamespace setVariable ["ExileReborn_woundWasTreated",ExileReborn_woundWasTreated];
        };    

        if !(ExileRebornClient_CustomHit_soundIsPlaying) then
        {
            ExileRebornClient_CustomHit_soundIsPlaying = true;
            [] spawn JohnO_fnc_playCustomHitSound;
        };    

        titleText["","WHITE OUT",0.2];
        titleText["","WHITE IN",0.2];
    };    
};

 

Edited by deadeye2
made code look a little nicer
1 person likes this

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.