Sign in to follow this  
Followers 0
ka0s

scarCODE/PVE Port

7 posts in this topic

Ok, what I'm trying to get to work is: 

fn_initPVE.sqf

////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
////// SCRIPT NAME: scarCODE PVE Script                   \\\\\\
///// VERSION: v0.1342b BETA                               \\\\\
//// AUTHOR: IT07                                            \\\\
/// GITHUB: https://github.com/IT07/A3_ScarCode_ScriptBundle \\\
// EMAIL: it07@scarcode.com                                   \\
////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

/////// Config ///////
_PvPZone = true; // Requires a trigger on the map with name PvP_Zone
_PvEbyDefault = true; // Sets default mode to PvE if true
_debug = false; // If true, will display data in hintSilent
/////// End of config ///////

if not(hasInterface) exitWith {};
[_PvPZone, _PvEbyDefault, _debug] spawn
{
    _PvPZone = _this select 0;
    _PvEbyDefault = _this select 1;
    _debug = _this select 2;

    if (hasInterface) then
    {
        if (_PvEbyDefault) then
        {
            SC_PvE = true;
        } else { SC_PvE = false; };

        if (_PvPZone) then
        {
            _pvpZoneLoop = [_debug] spawn
            {
                _debug = _this select 0;
                while { true } do
                {
                    call
                    {
                        if (triggerActivated PvP_Zone) exitWith
                        {
                            if (SC_PvE) then
                            {
                                SC_PvE = false;
                            };
                        };
                        if not(triggerActivated PvP_Zone) exitWith
                        {
                            if (not SC_PvE) then
                            {
                                SC_PvE = true;
                            };
                        };
                    };

                    if (_debug) then
                    {
                        hintSilent parseText format["<t size='2'>DEBUG</t><br /><br />isPlayer? %1<br />in PvP zone? %2<br />PvE mode? %3<br />cursorTarget in PvP zone? %4<br />PvP zone active? %5<br />", isPlayer cursorTarget, player in (list PvP_Zone), SC_PvE, cursorTarget in (list PvP_Zone), triggerActivated PvP_Zone];
                    };
                uiSleep 0.2;
                };
            };
        };

        "SC_PVBkillMessage" addPublicVariableEventHandler
        {
            if(isPlayer(_this select 1 select 0) and isPlayer(_this select 1 select 0)) then
            {
                systemChat format ["ALERT! %1 was murdered in PvE zone by %2", name (_this select 1 select 0), name (_this select 1 select 1)];
            };
        };

        waitUntil { uiSleep 0.5; !isNull(findDisplay 46); !isNil"EPOCH_loadingScreenDone" };
        uiSleep 2;
        _PvEplayerEH = player addEventHandler ["Fired", "if(SC_PvE)then{if (isPlayer cursorTarget)then {deleteVehicle(_this select 6)};}"];
        systemChat format ["#%1 | {ScarCode} Anti-PvP framework loaded...", _PvEplayerEH];

        waitUntil { uiSleep 0.5; (vehicle player != player); };
        _PvEvehicleEH = vehicle player addEventHandler ["Fired", "if(SC_PvE)then{if (isPlayer cursorTarget)then {deleteVehicle(_this select 6)};}"];
        systemChat format ["#%1 | {ScarCode} Anti-PvP vehicle mode loaded...", _PvEvehicleEH];
    };
};

fn_handleKilled.sqf

/*
    Author: IT07
    Description:
    fnc called by onPlayerKilled.sqf
    Params:
    _this select 0: victim
    _this select 1: killer
*/

if !(count _this != 4 or typeName (_this select 2) == "SCALAR" or typeName (_this select 3) == "SCALAR") exitWith { };
if (isPlayer(_this select 0) and isPlayer(_this select 1)) then
{
    SC_PvEkilled = [(_this select 0),(_this select 1)]; publicVariableServer "SC_PvEkilled";
};

onPlayerkilled.sqf

//////////////////////////////////
///////  Anti-PvP by IT07  ///////
///  v00264_BETA  ////////////////
// If player not in trigger and if victim + killer are not equal
if (SC_PvE and (_this select 0) != (_this select 1) and isPlayer(_this select 1)) then
{
    _this call SC_fnc_handleKilled;
};
//////////////////////////////////

I've tried to make this work the entire night, but doesn't seem like it wants to work.

I do get all outputs in systemChat upon some of the events, however I'm still able to shoot other players outside PvP Zone, which I shouldn't be able to.. 

Any advice would be appreciated! 

EDIT: I did follow the basic installation instructions on Github, of course they're not actual for Exile (Some of it is). 

Edited by ka0s
Added notes that I've followed installation guide on Github.

Share this post


Link to post
Share on other sites
Advertisement

Nope, but I figured to share the whole thing, I know a lot of people are looking for the functionality this exact script gives. 

@IT07 - Have a look here :)

Share this post


Link to post
Share on other sites

bump, anyone having ideas why the handlers doesn't work? 

_PvEplayerEH = player addEventHandler ["Fired", "if(SC_PvE)then{if (isPlayer cursorTarget)then {deleteVehicle(_this select 6)};}"];

_PvEvehicleEH = vehicle player addEventHandler ["Fired", "if(SC_PvE)then{if (isPlayer cursorTarget)then {deleteVehicle(_this select 6)};}"];

Both handlers should delete bullet / set damage to 0 upon trigger "Fired". 

Share this post


Link to post
Share on other sites

I spoke to IT07 about this a few weeks ago, he said he will be porting it when he gets some time. I'll just wait till then :)

Share this post


Link to post
Share on other sites

I spoke to IT07 about this a few weeks ago, he said he will be porting it when he gets some time. I'll just wait till then :)

Thanks m8, for letting me know, would be great, although it shouldn't be too hard, but as I don't know half of the commands in Arma 3, was crackin' on it all night last night, made some progress, but also backtracked a lot, since I cannot get the actual Eventhandlers to work :-( 

Share this post


Link to post
Share on other sites

change Line 71 fn_initPVE.sqf

 waitUntil { uiSleep 0.5; !isNull(findDisplay 46); !isNil"EPOCH_loadingScreenDone" };

to

waitUntil { uiSleep 0.5; !isNull(findDisplay 46); !isNil"ExileClientLoadedIn" };

 

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
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.