CODE
// THIS BUTTON TELLS YOU WHO HIT YOU.
default
{
touch_start(integer number)
{
llMessageLinked(LINK_SET,0,"listpvp",NULL_KEY);
}
}
CODE
// THIS BUTTON CLEARS THE LIST (CAN GET LONG, EVEN HALT THE SCRIPT AFTER A LENGTH).
default
{
touch_start(integer number)
{
llOwnerSay("Your PvP Abuse List has been cleared.");
llMessageLinked(LINK_SET,0,"clearpvp",NULL_KEY);
}
}
CODE
// THIS BUTTON TURNS THE SCRIPT ON/OFF.
default
{
touch_start(integer total_number)
{
llOwnerSay("Your PvP Abuse List has been turned on.");
llMessageLinked(LINK_SET,0,"PVPOn",NULL_KEY);
state otherway;
}
}
state otherway
{
touch_start(integer total_number)
{
llOwnerSay("Your PvP Abuse List has been turned off.");
llMessageLinked(LINK_SET,0,"PVPOff",NULL_KEY);
state default;
}
}
CODE
// THIS IS THE MAIN SCRIPT
list agent_avatar_list;
list agent_object_list;
integer toggle;
integer isNameOnAvatarList( string avatarname )
{
integer len = llGetListLength( agent_avatar_list );
integer i;
for( i = 0; i < len; i++ )
{
if( llList2String(agent_avatar_list, i) == avatarname )
{
return TRUE;
}
}
return FALSE;
}
integer isNameOnObjectList( string objectname )
{
integer len = llGetListLength( agent_object_list );
integer i;
for( i = 0; i < len; i++ )
{
if( llList2String(agent_object_list, i) == objectname )
{
return TRUE;
}
}
return FALSE;
}
default
{
state_entry()
{
toggle = TRUE;
}
collision_start(integer total_number)
{
if(toggle == TRUE)
{
if (llDetectedName(0) != llGetOwner())
{
integer type = llDetectedType(0);
if (type & AGENT)
{
string avatar_name = llDetectedName(0);
if( isNameOnAvatarList( avatar_name + " has bumped you with their avatar." ) == FALSE )
{
agent_avatar_list += avatar_name + " has bumped you with their avatar.";
llOwnerSay(avatar_name + " has bumped you with their avatar.");
}
}
else
{
if (type & ACTIVE)
{
string detected_owner = llKey2Name( llDetectedOwner(0) );
string detected_name = llDetectedName(0);
if( isNameOnObjectList( detected_owner + " has hit you with a Physical/Active Object named " + detected_name + "." ) == FALSE )
{
agent_object_list += detected_owner + " has hit you with a Physical/Active Object named " + detected_name + ".";
llMessageLinked(LINK_SET,0,"abusepvp " + (string)llDetectedOwner(0),NULL_KEY);
llOwnerSay(detected_owner + " has hit you with a Physical/Active Object named " + detected_name + ".");
}
}
}
}
}
}
link_message(integer sender_num, integer num, string message, key id)
{
if( message == "listpvp" )
{
integer i;
string origName = llGetObjectName();
llOwnerSay("These are the people who have bumped you with their avatar.");
llSetObjectName(">>");
integer len_two = llGetListLength( agent_avatar_list );
for( i = 0; i < len_two; i++ )
{
llOwnerSay( llList2String(agent_avatar_list, i) );
}
llOwnerSay("Total = " + (string)len_two );
llSetObjectName( origName );
llOwnerSay("These are the people who have hit you with a Physical/Scripted/Active Object.");
llSetObjectName(">>");
integer len_one = llGetListLength( agent_object_list );
for( i = 0; i < len_one; i++ )
{
llOwnerSay( llList2String(agent_object_list, i) );
}
llOwnerSay("Total = " + (string)len_one );
llSetObjectName( origName );
}
else if( message == "clearpvp" )
{
agent_object_list = llDeleteSubList(agent_object_list, 0, llGetListLength(agent_object_list));
agent_avatar_list = llDeleteSubList(agent_avatar_list, 0, llGetListLength(agent_avatar_list));
}
else if( message == "PVPOn" )
{
toggle = TRUE;
}
else if( message == "PVPOff" )
{
toggle = FALSE;
}
}
}