LlUnsit with Animation

From Second Life Wiki
Jump to navigation Jump to search

Hi. this is a script from someone I talked to cause I really wanted a script like this and he helped ALOT thanks so much Randur Source, so here is the script :). <lsl> //////////////////////////////////////////////////////// //Randur Source's Script.////////////////////////////////////////////////////////////////// //This script has a GNU License. //The script *MUST* not be sold under any Circumstances,Not even for 1L$.. This script is Free Public Script..////////////////////////////////// //For your copy of the License//////////////////////////// // Do Not Change Anything Below..Or Above This Line.///// //////////////////////////////////////////////////////// default {

   changed(integer change)
   {
       if (change & CHANGED_LINK)
       {
           integer cnt;
           for (cnt = llGetNumberOfPrims(); cnt >= 2; cnt--) // prim 1 is root prim
           {
               key id = llGetLinkKey(cnt);
               if (llGetAgentSize(id) != ZERO_VECTOR) // it's an avatar!
                   if (id != llGetOwner())
                       llRequestPermissions(id,PERMISSION_TRIGGER_ANIMATION);
           }
       }
   }
   
   run_time_permissions(integer perm)
   {
       if (perm & PERMISSION_TRIGGER_ANIMATION)
       {
           llStopAnimation("sit"); // was already stopped when unsitting, but do this anyway, no harm
           key id = llGetPermissionsKey();
           llUnSit(id);
           string anim = llGetInventoryName(INVENTORY_ANIMATION,0); // use the first animation in inventory
           if (anim != "")
               llStartAnimation(anim); // be carefull, if the anim is looped, it will never be stopped
           llInstantMessage(id,"You are not the owner and will be animated!"); // This InstantMessage's the target and says the message given above...
       }
   }

} </lsl> This Script Does Work...