Author Topic: Leave invantory  (Read 1110 times)

Hi is how do I make it so a weapon leaves you invantory when you throw it I used this but it didn't work.

Quote
function pillImage::onFire(%this,%obj,%slot)
{
   if(!isObject(%obj.client.minigame))
      return;

   for(%i=0;%i<5;%i++)
   {
      %toolDB = %obj.tool[%i];
      if(%toolDB $= %this.item.getID())
      {
         %obj.setDamageLevel(0);
         %obj.emote(HealImage);
         %obj.tool[%i] = 0;
         %obj.weaponCount--;
         messageClient(%obj.client,'MsgItemPickup','',%i,0);
         serverCmdUnUseTool(%obj.client);
         break;
      }
   }
}

Try changing pillImage to the actual name of your weapon. Honestly...

Ya I did that Honestly....

and I tried in a minigame but nothing.

Yeah, could you post the code snippet you actually used instead of where you ripped it from?

Here

Code: [Select]
function SgrenadeImage::onFire(%this,%obj,%slot)
{
   if(!isObject(%obj.client.minigame))
      return;

   for(%i=0;%i<5;%i++)
   {
      %toolDB = %obj.tool[%i];
      if(%toolDB $= %this.item.getID())
      {
         %obj.setDamageLevel(0);
         %obj.emote(HealImage);
         %obj.tool[%i] = 0;
         %obj.weaponCount--;
         messageClient(%obj.client,'MsgItemPickup','',%i,0);
         serverCmdUnUseTool(%obj.client);
         break;
      }
   }
}

function SgrenadeImage::onFire(%this,%obj,%slot)
{
echo(1);
   if(!isObject(%obj.client.minigame))
      return;
echo(2);
   for(%i=0;%i<5;%i++)
   {
echo(3);
      %toolDB = %obj.tool[%i];
      if(%toolDB $= %this.item.getID())
      {
echo(4);
         %obj.setDamageLevel(0);
         %obj.emote(HealImage);
         %obj.tool[%i] = 0;
         %obj.weaponCount--;
         messageClient(%obj.client,'MsgItemPickup','',%i,0);
         serverCmdUnUseTool(%obj.client);
         break;
      }
   }
}




Do that and tell what it echos.

Ok I put that in and when im not in a minigame it does the animation and then gets stuck when its about to throw and when im in minigame when im about to throw it dissapears.

f
Quote
unction SgrenadeImage::onFire(%this,%obj,%slot)

{
echo(1);
   if(!isObject(%obj.client.minigame))
      return;
echo(2);
   for(%i=0;%i<5;%i++)
   {
echo(3);
      %toolDB = %obj.tool[%i];
      if(%toolDB $= %this.item.getID())
      {
echo(4);
         %obj.setDamageLevel(0);
         %obj.emote(HealImage);
         %obj.tool[%i] = 0;
         %obj.weaponCount--;
         messageClient(%obj.client,'MsgItemPickup','',%i,0);
         serverCmdUnUseTool(%obj.client);
         break;
      }
   }
}



...What does it say in the console?

it keeps saying 1 in consol.

and when in a minigame?

It say
Code: [Select]
1
2
3
4
Base/server/scripts/allgamescripts.cs (24378) : unable to find object 'healimage'
attempting to call function 'getclassname'

It does the animation but when its about to throw it dissapears.

K I found out how to do it ty.