Keep on death

Author Topic: Keep on death  (Read 868 times)

Whats the code to keep an item on death? If anybody can tell me I will give them COOKIES  :cookie::cookie: :cookie: :cookie: :cookie:

I don't know, but I don't believe there is one.

I bet you could make a checkpoint type thing where, if you collect the item, that information is recorded, and after you die, it appears in your inventory again.

Some code, from the Script_DropWeapon.cs, made by Zor. Copy and pasted straight from my server script. You'll need to replace most of the 6s with 5s (my players have 6 inventory slots). Also, if you don't want equipped weapon to drop, you'll need to mod the script some.

Code: [Select]
//a little script that makes the player drop their current weapon when they die
//made by zor

package dropweapon{
 function GameConnection::onDeath(%client,%a,%b,%c,%d,%e,%f){
  if(%client.minigame)
   servercmddroptool(%client,%client.player.currtool);
for(%k=0;%k<=6;%k++){
if(%k == 6)
{
%client.hastoolnotes = 1;
  Parent::onDeath(%client,%a,%b,%c,%d,%e,%f);
}
if(%client.player.tool[%k])
{
%client.toolnotes[%k] = %client.player.tool[%k];
}
}
  Parent::onDeath(%client,%a,%b,%c,%d,%e,%f);
}

function GameConnection::spawnPlayer(%this)
{
  Parent::spawnPlayer(%this);
  if(%this.minigame){
if(%this.hastoolnotes == 1)
{
for(%k=0;%k<=6;%k++){
if(%k == 6)
{
%this.hastoolnotes = 0;
}
if(%this.toolnotes[%k])
{
%this.player.tool[%k] = %this.toolnotes[%k];
messageClient(%this, 'MsgItemPickup', '', %k, %this.toolnotes[%k]);
%this.toolnotes[%k] = 0;
}
}}
}
}
};
ActivatePackage(dropweapon);

Thanks dilt Cookies for you  :cookie:  :cookieMonster:  :cookie: