Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- key toucher;
- string toucherS;
- integer in_use;
- integer have_permissions = FALSE;
- integer armed = TRUE;
- string gBullet = "[FI] MTA.Bullet.Damage";
- float gVelocity = 75.0;
- fire()
- {
- rotation Rot = llGetRot() * llEuler2Rot(<0,0,0>*DEG_TO_RAD);
- llRezObject(gBullet, llGetPos() + <2.6, 0.0, 0.57>*Rot, gVelocity*llRot2Fwd(Rot), Rot, 10);
- }
- default
- {
- state_entry()
- {
- in_use = FALSE;
- }
- touch_start(integer total_number)
- {
- if(in_use == FALSE)
- {
- toucher = llDetectedKey(0);
- llRequestPermissions(toucher, PERMISSION_TAKE_CONTROLS|PERMISSION_TRIGGER_ANIMATION);
- llSetText("Requesting Permissions", <1,1,1>, 1);
- }
- if(in_use == TRUE)
- {
- if(llDetectedKey(0) == toucher)
- {
- llReleaseControls();
- llSensorRemove();
- llSetRot(<-0.00000, -0.00000, 0.70711, 0.70711>*llEuler2Rot(<0.0,0.0,90.0>*DEG_TO_RAD));
- llSetText("", <1,1,1>, 1);
- in_use = FALSE;
- }
- }
- }
- sensor(integer sense)
- {
- rotation k = llDetectedRot(0);
- llRotLookAt(k, .1, .1);
- }
- no_sensor()
- {
- llReleaseControls();
- llSensorRemove();
- llSetRot(<-0.00000, -0.00000, 0.70711, 0.70711>*llEuler2Rot(<0.0,0.0,90.0>*DEG_TO_RAD));
- llSetText("", <1,1,1>, 1);
- in_use = FALSE;
- }
- run_time_permissions(integer perm)
- {
- if(perm)
- {
- llSetText("", <1,1,1>, 1);
- llTakeControls(CONTROL_ML_LBUTTON, TRUE, FALSE);
- llSensorRepeat("", toucher, AGENT, 20, TWO_PI, .1);
- llSetText("Current User: "+llKey2Name(toucher), <1,1,1>, 1);
- in_use = TRUE;
- }
- else
- {
- in_use = FALSE;
- llSetText("", <1,3,1>, 1);
- }
- }
- control(key name, integer levels, integer edges)
- {
- if ((levels & CONTROL_ML_LBUTTON) == CONTROL_ML_LBUTTON)
- {
- fire();
- }
- if (levels & CONTROL_ML_LBUTTON)
- {
- llLoopSound("a24c1234-678d-3909-b1e5-2bc354160f65", 1.0);
- }
- if (edges & CONTROL_ML_LBUTTON)
- {
- llStopSound();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement