11-21-2007 15:27
// Elite Spanker v2.0 By BigJohn Jade

// You cant resale this script code in any object at all.

// Spam chat free Spanker that also tracks how many times person has been spanked, the counter will reset when you take it off and put it back on.

// The spanker will rename to your first name then Spanker-v2.0-hovertext (Wear Me!) when attach the object.

// You can download the Avatar Animations from this url: http://secondlife.com/community/avatar.php

// Just upload the animation called avatar_express_embarrased and make sure that you don't loop it, you can make your own animation as well cause the script can read any animation from the content.

// Sound UUID file.
string SoundFile ="475a3e83-6801-49c6-e7ad-d6386b2ecc29";

// End name of the spanker
string ObjectName="Spanker-v2.0-hovertext (Wear Me!)";

// Text color white.
vector Vector_Color = <1.00000, 1.00000, 1.00000>;

// Don't edit under this line.
integer IHavePermission = FALSE;
integer GetAttach = FALSE;
integer lT;
list UserName;
string FirstName;
float TimeIt = 3.0;
integer Count;
integer TotalA;
list lA;
integer WHICH;

integer CheckForAnimations()
{
integer i;
TotalA = llGetInventoryNumber(INVENTORY_ANIMATION);

// clear and rebuild the animation list
lA = llDeleteSubList(lA,0,-1);
for ( i = 0; i < TotalA; i++ )
{
lA += llGetInventoryName(INVENTORY_ANIMATION,i);
}
if (TotalA < 1)
{
llInstantMessage(llGetOwner(),"Sorry no animations was found, you must add 1 animation to the content of this object.";);

return TRUE;
}
return FALSE;
}
integer CheckForMaxAnimations()
{
integer i;
TotalA = llGetInventoryNumber(INVENTORY_ANIMATION);

// clear and rebuild the animation list
lA = llDeleteSubList(lA,0,-1);
for ( i = 0; i < TotalA; i++ )
{
lA += llGetInventoryName(INVENTORY_ANIMATION,i);
}
if (TotalA > 1)
{
llInstantMessage(llGetOwner(),"Sorry max animations are 1, you must remove some animations from the content of this object.";);

return TRUE;
}
return FALSE;
}
LetsTimeIt()
{
lT = (integer)llGetTime() + (integer)TimeIt;
llSetTimerEvent(1);
}


PlaySoundFile()
{
float volume = 0.8;
llPlaySound(SoundFile, volume);
}

default
{
state_entry()
{
UserName = llParseString2List(llKey2Name(llGetOwner()),[" ","| "," |"," | "],[]);
FirstName = llList2String(UserName,0);
llSetObjectName((string)FirstName+"'s "+ObjectName);
llSetText("",Vector_Color, 1);
}
changed(integer change)
{
if (change & CHANGED_INVENTORY)
{
if(CheckForMaxAnimations())
{
GetAttach = FALSE;
return;
}
else
if(CheckForAnimations())
{
GetAttach = FALSE;
return;
}
}
}
attach(key id)
{
if(id == NULL_KEY)
{
GetAttach = FALSE;
llSetObjectName((string)FirstName+"'s "+ObjectName);
return;
}
else
if(CheckForMaxAnimations())
{
return;
}
else
if(CheckForAnimations())
{
return;
}
else
GetAttach = TRUE;
Count = 0;
llRequestPermissions(id,PERMISSION_TRIGGER_ANIMATION);
UserName = llParseString2List(llKey2Name(llGetOwner()),[" ","| "," |"," | "],[]);
FirstName = llList2String(UserName,0);
llSetObjectName((string)FirstName+"'s "+ObjectName);
llInstantMessage(llGetOwner(),"Ready (bytes free"+" "+(string)llGetFreeMemory()+";)";);
}

touch_start(integer total_number)
{
integer TouchTrack;
key person = llDetectedKey(TouchTrack);
string user;
if(!GetAttach)
{
llInstantMessage(person,"I must be attach before you can use me!";);
return;
}
else
LetsTimeIt();
PlaySoundFile();
integer i;
TotalA = llGetInventoryNumber(INVENTORY_ANIMATION);

// clear and rebuild the animation list
lA = llDeleteSubList(lA,0,-1);
for ( i = 0; i < TotalA; i++ )
{
lA += llGetInventoryName(INVENTORY_ANIMATION,i);
}
llStartAnimation(llList2String(lA, WHICH));
WHICH++;
if (WHICH >= TotalA)
{
WHICH = 0;
}
if (person == llGetOwner())
{
llSetText("\n\n"+(string)FirstName+" has spanked their own ass!\n\n"+(string)FirstName+"'s ass has been spanked "+(string)Count+" times.",Vector_Color, 1);
return;
}
else
Count++;
user+="\n"+llKey2Name(person)+" has spanked that ass!\n\n"+(string)FirstName+"'s ass has been spanked "+(string)Count+" times.";
llSetText("\n"+user,Vector_Color, 1);
}
run_time_permissions(integer permissions)
{
if (permissions == PERMISSION_TRIGGER_ANIMATION)
{
IHavePermission = TRUE;
}
}
timer()
{
if(llGetTime() > lT)
{
llSetText("",Vector_Color, 1);
llSetTimerEvent(0.0);
}
}
}