SHARE
TWEET

Untitled

a guest Feb 21st, 2020 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. string reload_sound = "7e82e76a-5aa8-f608-1ceb-9cccc57b8aaf";
  2. string fireAuto = "8da3a6e4-246e-5ecb-edd9-159f98f1dad7";
  3. string fireOut = "b1ffa30e-d2e6-1d04-239d-dd38c06e325d";
  4. string beepDraw = "fb3caae0-6673-920d-a798-f124e55d802b";
  5. string beepSling = "91cd90d7-513f-a626-cfd7-b3e302af25ac";
  6. string beepReload = "36f501f0-69d8-8c24-77c2-ccd8acd5604c";
  7. integer soundon;
  8. integer maxammo = 45;
  9. integer underammo = 3;
  10. float reload_time = 2.25;
  11. integer ammo;
  12. integer slung=FALSE;
  13. integer reloading=FALSE;
  14.  
  15. list authedgroups = ["f32c0934-c6d0-28e1-5969-46dff14f6e11"]; //List of groups that may use the item.
  16. list authedroles = []; //List of roles that may use the item. If blank, the whole group(s) may use it.
  17. list whitelist = ["62d9c080-1f24-4cda-86a4-8233253a83c9","802ca102-ef68-4b79-98ea-5c9b389cfbbb"]; //List of people who bypass the entire auth system.
  18. list test;
  19. list tag;
  20.  
  21. integer link_mflash;
  22. integer getlink(string name) {
  23.     integer n = llGetNumberOfPrims();
  24.     while(n > 0 && llGetLinkName(n) != name) n--;
  25.     if( n == 0 ) llOwnerSay("Link \"" + name + "\" not found!");
  26.     return n;
  27. }
  28.  
  29. sling()
  30. {
  31.     slung=TRUE;
  32.     llSetScriptState("Fallout 76", FALSE);
  33.     llSetScriptState("YuGiOh Duel Links", FALSE);
  34.     llSetScriptState("Pokemon GO", FALSE);
  35.     llMessageLinked(LINK_SET, 0, "sling", NULL_KEY);
  36.     llSetLinkTextureAnim(link_mflash, ANIM_ON, ALL_SIDES, 100, 100, 100.0, 100.0, 500.0);
  37.     llPlaySound(beepSling, 1);
  38.     llSetLinkAlpha(LINK_SET, 0.0, ALL_SIDES);
  39.     llWhisper(-11,"sling");
  40. }
  41. reload()
  42. {
  43.     reloading=TRUE;
  44.     llStopSound();
  45.     llSetLinkTextureAnim(link_mflash, ANIM_ON, ALL_SIDES, 100, 100, 100.0, 100.0, 500.0);
  46.     if(soundon) llPlaySound(fireOut, 1);
  47.     soundon=0;
  48.     underammo=3;
  49.     llStartAnimation("Reload");
  50.     llPlaySound(reload_sound, 1);
  51.     llMessageLinked(LINK_SET, 0, "", NULL_KEY);
  52.     llSetTimerEvent(reload_time);
  53. }
  54.  
  55. draw()
  56. {
  57.     if(slung)
  58.     {
  59.         slung=FALSE;
  60.         llSetScriptState("Fallout 76", TRUE);
  61.         llSetScriptState("YuGiOh Duel Links", TRUE);
  62.         llSetScriptState("Pokemon GO", TRUE);
  63.         llMessageLinked(LINK_SET, maxammo, "draw", NULL_KEY);
  64.         llSetLinkTextureAnim(link_mflash, ANIM_ON, ALL_SIDES, 100, 100, 100.0, 100.0, 500.0);
  65.         llPlaySound(beepDraw, 1);
  66.         llSetLinkAlpha(LINK_SET, 1.0, ALL_SIDES);
  67.         llWhisper(-11,"draw");
  68.     }
  69.     else
  70.     {
  71.         sling();
  72.     }
  73. }
  74. default
  75. {
  76.     changed(integer c)
  77.     {
  78.         if(c&CHANGED_TELEPORT)
  79.         {
  80.             //lTriggerSound(beepReload, 1);
  81.             ammo=maxammo;
  82.             llMessageLinked(LINK_SET, ammo, "", NULL_KEY);
  83.             //llOwnerSay("Reloaded.");
  84.             llSetTimerEvent(0);
  85.             reloading=FALSE;
  86.         }
  87.         else if(c&CHANGED_OWNER)
  88.         {
  89.             llResetScript();
  90.         }
  91.     }
  92.     on_rez(integer s)
  93.     {
  94.         test = llGetObjectDetails(llList2Key( llGetAttachedList(llGetOwner()), 1), [OBJECT_GROUP]);
  95.         tag = llGetObjectDetails(llGetOwner(), [OBJECT_GROUP_TAG]);
  96.         //llOwnerSay((string)test);
  97.         //llOwnerSay((string)tag);
  98.         //llOwnerSay("oi");
  99.         llRequestPermissions(llGetOwner(), PERMISSION_TRACK_CAMERA|PERMISSION_TAKE_CONTROLS|PERMISSION_TRIGGER_ANIMATION|PERMISSION_ATTACH);
  100.         llMessageLinked(LINK_SET, 0, "reset", NULL_KEY);
  101.         llResetOtherScript("Fallout 76");
  102.         llResetOtherScript("YuGiOh Duel Links");
  103.         llResetOtherScript("Pokemon GO");
  104.         llResetScript();
  105.     }
  106.     state_entry()
  107.     {
  108.         link_mflash = getlink("muzzleflash");
  109.         ammo=maxammo;
  110.         llMessageLinked(LINK_SET, llRound(ammo), "draw", NULL_KEY);
  111.         llListen(1, "", llGetOwner(), "");
  112.         llRequestPermissions(llGetOwner(), PERMISSION_TRACK_CAMERA|PERMISSION_TAKE_CONTROLS|PERMISSION_TRIGGER_ANIMATION|PERMISSION_ATTACH);
  113.     }
  114.     listen(integer c, string n, key id, string m)
  115.     {
  116.         if(m=="d1"||m=="draw1"||m=="arm1")
  117.         {
  118.             draw();
  119.         }
  120.         else if(m=="s1"||m=="sling1")
  121.         {
  122.             sling();
  123.         }
  124.         else if(m=="r"||m=="reload")
  125.         {
  126.             if(ammo<maxammo&&!slung)
  127.             {
  128.                 reload();
  129.             }
  130.         }
  131.         else if(m=="sub"&&underammo>0&&llGetTime()>.25)
  132.         {
  133.             underammo--;
  134.             llTriggerSound("ef17c164-cfcc-fc91-2e69-f2276d559f6d",1);
  135.             llResetTime();
  136.             llRezObject("[Chaos] 20mm HEAP", llGetCameraPos()+<2.25,0,0>+.15*llGetVel()*llGetCameraRot(), <200,0,0>*llGetCameraRot(), <1,0,0,0>*llGetCameraRot(), 0);
  137.         }
  138.     }
  139.     run_time_permissions(integer p)
  140.     {
  141.         if(p&PERMISSION_TAKE_CONTROLS)
  142.         {
  143.             llTakeControls(CONTROL_ML_LBUTTON, TRUE, TRUE);
  144.         }
  145.         if(p&PERMISSION_ATTACH)
  146.         {
  147.             test = llGetObjectDetails(llList2Key( llGetAttachedList(llGetOwner()), 1), [OBJECT_GROUP]);
  148.             tag = llGetObjectDetails(llGetOwner(), [OBJECT_GROUP_TAG]);
  149.             //llOwnerSay((string)llListFindList(whitelist, (list)[(string)llGetOwner()]));
  150.             //llOwnerSay((string)whitelist);
  151.             //llOwnerSay((string)llGetOwner());
  152.             //llOwnerSay((string)llListFindList(authedgroups, (list)llList2String(test,0)));
  153.             if(~llListFindList(whitelist, (list)[(string)llGetOwner()]))
  154.             {
  155.                 llOwnerSay("Whitelisted.");
  156.                 return;
  157.             }
  158.             else if(~llListFindList(authedgroups, (list)llList2String(test,0)))
  159.             {
  160.                 //llOwnerSay((string)llGetListLength(authedroles));
  161.                 //llOwnerSay((string)llListFindList(authedroles, (list)llList2String(test,1)));
  162.                 if(llGetListLength(authedroles)&&~llListFindList(authedroles, (list)llList2String(tag,0)))
  163.                 {
  164.                     //llOwnerSay("Right tag.");
  165.                     return;
  166.                 }
  167.                 else if(!llGetListLength(authedroles))
  168.                 {
  169.                     //llOwnerSay("Whole group authed.");
  170.                     return;
  171.                 }
  172.                 else
  173.                 {
  174.                     llOwnerSay("Wrong rank detected.");
  175.                     llDetachFromAvatar();
  176.                 }
  177.             }
  178.             else
  179.             {
  180.                 llOwnerSay("Wrong group detected.");
  181.                 llDetachFromAvatar();
  182.             }
  183.         }
  184.         else
  185.         {
  186.             llOwnerSay("Permissions not accepted. Destroying.");
  187.             llSetAlpha(0, ALL_SIDES);
  188.             llSetScale(<0.01,0.01,0.01>);
  189.         }
  190.     }
  191.     control(key id, integer l, integer e)
  192.     {
  193.         if(l&CONTROL_ML_LBUTTON&&!slung&&!reloading)
  194.         {
  195.             if(!soundon)
  196.             {
  197.                 llLoopSound(fireAuto, 1);
  198.                 soundon=1;
  199.                 llSetLinkTextureAnim(link_mflash, ANIM_ON | LOOP, ALL_SIDES, 2, 1, 1.0, 2.0, 20.0);
  200.             }
  201.         }
  202.         else if(~l&e&CONTROL_ML_LBUTTON&&!slung&&!reloading)
  203.         {
  204.             if(soundon)
  205.             {
  206.                 llStopSound();
  207.                 soundon=0;
  208.                 llSetLinkTextureAnim(link_mflash, ANIM_ON, ALL_SIDES, 100, 100, 100.0, 100.0, 500.0);
  209.             }
  210.         }
  211.     }
  212.     object_rez(key id)
  213.     {
  214.         ammo--;
  215.         //llTriggerSound("4074eefa-7075-7ed1-e84d-859f9607deae", 1);
  216.         if(ammo<=1)
  217.         {
  218.            llStopSound();
  219.            llPlaySound(fireOut, 1);
  220.            reloading=TRUE;
  221.             reload();
  222.         }
  223.     }
  224.     timer()
  225.     {
  226.         llTriggerSound(beepReload, 1);
  227.         ammo=maxammo;
  228.         llMessageLinked(LINK_SET, ammo, "", NULL_KEY);
  229.         llOwnerSay("Reloaded.");
  230.         llSetTimerEvent(0);
  231.         reloading=FALSE;
  232.     }
  233. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top