Anti RAID house

፨ẴzɏϻΘķ፨

Member
Member
Apr 9, 2016
123
6
18
28
Canada
I'm trying to fix that one Foundation can't put nine pillars - and only four.I did the time - but does not remove the validation
Code:
function On_EntityDeployed(Player, Entity) {
    if (Player.SteamID != null && Entity.Name != null) {
        if (Entity.Name == "WoodPillar") {
            if (CheckWoodPillar(Player, Entity)) {
                Entity.Destroy();
            }
        }
    }
}

function CheckWoodPillar(Player, Entity) {
    var resBool = false;
    Server.Broadcast(Player.Name);
    for (var x in World.Entities)
        if ((x.Name == "WoodPillar") && (x.X != Entity.X) && (x.Y != Entity.Y))
            if ((x.X > Entity.X - 1) && (x.X < Entity.X + 1))
                if ((x.Y > Entity.Y - 1) && (x.Y < Entity.Y + 1))
                    if ((x.Z > Entity.Z - 1) && (x.Z < Entity.Z + 1)) {
                        resBool = true;
                    }
    return resBool;
}
 
Last edited:

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,093
4,784
113
At your house.
github.com
I'm trying to fix that one Foundation can't put nine pillars - and only four.I did the time - but does not remove the validation
Code:
function On_EntityDeployed(Player, Entity) {
    if (Player.SteamID != null && Entity.Name != null) {
        if (Entity.Name == "WoodPillar") {
            if (CheckWoodPillar(Player, Entity)) {
                Entity.Destroy();
            }
        }
    }
}

function CheckWoodPillar(Player, Entity) {
    var resBool = false;
    Server.Broadcast(Player.Name);
    for (var x in World.Entities)
        if ((x.Name == "WoodPillar") && (x.X != Entity.X) && (x.Y != Entity.Y))
            if ((x.X > Entity.X - 1) && (x.X < Entity.X + 1))
                if ((x.Y > Entity.Y - 1) && (x.Y < Entity.Y + 1))
                    if ((x.Z > Entity.Z - 1) && (x.Z < Entity.Z + 1)) {
                        resBool = true;
                    }
    return resBool;
}
Are you trying to check if the foundation has pillars?
 

፨ẴzɏϻΘķ፨

Member
Member
Apr 9, 2016
123
6
18
28
Canada
Hmmm.

Like check how many pillars are on a foundation?
So I created a thread to have someone help - here's an example of what the workbenches within a radius of 25 meters

function CheckWorkBench(Player, Entity) {
var resBool = false;
Server.Broadcast(Player.Name);
for (var x in World.Entities)
if ((x.Name == "Workbench") && (x.X != Entity.X) && (x.Y != Entity.Y))
if ((x.X > Entity.X - 25) && (x.X < Entity.X + 25))
if ((x.Y > Entity.Y - 25) && (x.Y < Entity.Y + 25))
if ((x.Z > Entity.Z - 25) && (x.Z < Entity.Z + 25)) {
resBool = true;
}
return resBool;
}
 

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,093
4,784
113
At your house.
github.com
So I created a thread to have someone help - here's an example of what the workbenches within a radius of 25 meters

function CheckWorkBench(Player, Entity) {
var resBool = false;
Server.Broadcast(Player.Name);
for (var x in World.Entities)
if ((x.Name == "Workbench") && (x.X != Entity.X) && (x.Y != Entity.Y))
if ((x.X > Entity.X - 25) && (x.X < Entity.X + 25))
if ((x.Y > Entity.Y - 25) && (x.Y < Entity.Y + 25))
if ((x.Z > Entity.Z - 25) && (x.Z < Entity.Z + 25)) {
resBool = true;
}
return resBool;
}
That's really not a safe way.

JavaScript:
var Physics = null;

function On_PluginInit() {
    Physics = Util.TryFindReturnType("Physics"); // <- If this doesn't work then It's: UnityEngine.Physics
}

function CheckWoodPillar(Player, Entity) {
    // Connected entities (Just an example)
    /*var connectedentities = Entity.GetLinkedStructs();
    for (var x in connectedentities) {
   
    }*/
    var entitiesinrad = Physics.OverlapSphere(Entity.Location, 1);
    for (var x in entitiesinrad) {
        Server.Broadcast(x.name);
        // todo: Check name
    }
}
 

፨ẴzɏϻΘķ፨

Member
Member
Apr 9, 2016
123
6
18
28
Canada
That's really not a safe way.

JavaScript:
var Physics = null;

function On_PluginInit() {
    Physics = Util.TryFindReturnType("Physics"); // <- If this doesn't work then It's: UnityEngine.Physics
}

function CheckWoodPillar(Player, Entity) {
    // Connected entities (Just an example)
    /*var connectedentities = Entity.GetLinkedStructs();
    for (var x in connectedentities) {
 
    }*/
    var entitiesinrad = Physics.OverlapSphere(Entity.Location, 1);
    for (var x in entitiesinrad) {
        Server.Broadcast(x.name);
        // todo: Check name
    }
}
what is it?could you easier?I don't need to check all physics - just when installing the pillar must check if a radius of 1 meter is still a pillar - if there is then delete the one that tried to install