this is where most of the setup is done, im sorry i didn't post it earlier but i didn't
think that i would need to post it.
i hope this helps now.
thanks in advance.
//SETUP:
string firesound = "fire";
integer customanimation = FALSE;
string customname = "";
integer handgun = TRUE;
integer multibullet = TRUE;
integer fullauto = FALSE;
integer burst = TRUE;
integer reload = TRUE;
integer clipsize = 20;
float reloadtime = 1.0;
integer reloadanimation = TRUE;
string rcustomname = "Reload";
integer reloadsound = FALSE;
string rsound = "";
integer holster = TRUE;
integer loader = FALSE;
list exceptions = ["Loader"];
//DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU'RE DOING!
integer attached = FALSE;
integer permissions = FALSE;
vector eye = <0.0, 0.0, 0.84>;
list bullets;
string bulletname = "Bullet";
string firemode = "Single";
integer rbullets = clipsize;
integer reloading = FALSE;
integer holstered = FALSE;
integer listen1;
integer listen2;
integer listen3;
integer randomc;
integer listen1c = 2657;
//This is the channel for dialogs. If you change this, you must also change it in the main holster script and menu click script if you are using them.
init()
{
vector size = llGetAgentSize(llGetOwner());
eye.z = eye.z * (size.z / 2.0);
llListenRemove(listen1);
llListenRemove(listen2);
llListenRemove(listen3);
listen1 = llListen(listen1c, "", NULL_KEY, ""

;
listen2 = llListen(0, "", llGetOwner(), ""

;
randomc = (integer)llFrand(1000) + 1000;
//This creates a random number to use as a channel for the loader to talk to the gun.
listen3 = llListen(randomc, "", NULL_KEY, ""

;
}
fire()
{
if (!holstered)
{
if (((!reload) || (!reloading)) && ((!reload) || (rbullets > 0)))
{
rbullets --;
rotation rot = llGetRot();
vector fwd = llRot2Fwd(rot);
vector pos = llGetPos() + eye+fwd*1.5;
fwd *= 100;
llTriggerSound(firesound, 1.0);
if (multibullet)
{
if (llGetInventoryType(bulletname) == -1)
{
llOwnerSay(bulletname + " could not be found. Please select a new bullet"

;
}
else
{
//NOTE: New versions of LoLSBS bullets will be using the start parameter to controll bullet speed. 100 = %100 of the base bullet speed.
llRezObject(bulletname, pos, fwd, rot, 200);
}
}
else
{
llRezObject("Bullet", pos, fwd, rot, 200);
}
}
else
{
if (!reloading)
{
if (reloadanimation)
{
llStartAnimation(rcustomname);
}
if (reloadsound)
{
llTriggerSound(rsound, 1.0);
}
reloading = TRUE;
rbullets = clipsize;
llSetTimerEvent(reloadtime);
}
}
}
}