//A suprisingly effective piece of code which will tell you who is attacking you if they are nearby and using basic methods
//Script by Deevyde Maelstrom of the Brainiacs//Feel free to do whatever you want with it, but keep this header please :)
// Retrieved from from Free SL Scripts on http://www.freeSLscripts.com or www.freeslscripts.gendersquare.org
key attacker = NULL_KEY;
string objname;
default
{
state_entry()
{
objname = llGetObjectName();
}
collision_start(integer num)
{
if(llDetectedVel(0) != ZERO_VECTOR && llDetectedType(0) & SCRIPTED && llDetectedType(0) & ACTIVE)
{
if(attacker != llDetectedOwner(0))
{
if(llSubStringIndex(llKey2Name(llDetectedOwner(0)), " ") != -1)
{
llSetObjectName(llKey2Name(llDetectedOwner(0)));
llOwnerSay("/me (" + (string)llDetectedOwner(0) + ") attacked you!");
llSetObjectName(objname);
}
else
{
llSensor(llDetectedOwner(0), "", AGENT, 100, PI);
}
}
attacker = llDetectedOwner(0);
}
}
sensor(integer num)
{
llSetObjectName(llKey2Name(llDetectedOwner(0)));
llOwnerSay("/me (" + (string)llDetectedOwner(0) + ") attacked you!");
llSetObjectName(objname);
}
no_sensor()
{
llSetObjectName(llKey2Name(attacker));
llOwnerSay("/me attacked you!");
llSetObjectName(objname);
}
}
| Comments |
|








