6331
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Damn it fawkes, you stole the 2000th reply.YOU GET:
And no, I can't.
2001st reply get.
I believe it actually works now.Code: [Select]package AmmoReserve
{
function ItemData::onCollision(%this, %obj, %col, %a, %b, %c, %d, %e, %f)
{
if(%obj.weaponReserveLoaded >= 1 && (%col.getType() & $TypeMasks::PlayerObjectType))
{
echo("ONCOLLISION");
%col.pickup(%obj);
}
else
Parent::onCollision(%this, %obj, %col, %a, %b, %c, %d, %e, %f);
}
function ItemData::onPickup(%this,%obj,%user,%amt)
{
echo("hi");
%data = %obj.dataBlock;
%dropReserve = %obj.weaponReserveLoaded;
%p = %dropReserve / 100;
%addslot0 = %user.maxReserve[0] * %p;
%addslot1 = %user.maxReserve[1] * %p;
%addslot2 = %user.maxReserve[2] * %p;
%addslot3 = %user.maxReserve[3] * %p;
%addslot4 = %user.maxReserve[4] * %p;
if(%dropReserve >= 1)
{
//if(%user.tool[0].getID() !$= "" && %user.toolReserve[%user.tool[0]] !$= "")
//if(%user.getID[%user.tool[0]] !$= "" && %user.toolReserve[%user.tool[0]] !$= "")
if(%user.toolReserve[0] !$= "")
%user.toolReserve[0] += %addslot0;
if(%user.toolReserve[1] !$= "")
%user.toolReserve[1] += %addslot1;
if(%user.toolReserve[2] !$= "")
%user.toolReserve[2] += %addslot2;
if(%user.toolReserve[3] !$= "")
%user.toolReserve[3] += %addslot3;
if(%user.toolReserve[4] !$= "")
%user.toolReserve[4] += %addslot4;
echo("err");
%user.playAudio(0,ErrorSound);
%obj.delete();
schedule(10,0,ResetReserve,%user);
schedule(10,0,DisplayAmmo,%user);
return;
}
else
Parent::OnPickup(%this,%obj,%user,%amt);
}
function ItemData::onAdd(%this,%obj)
{
if($weaponReserveLoaded !$= "")
{
%obj.weaponReserveLoaded = $weaponReserveLoaded;
$weaponReserveLoaded = "";
echo("lol");
}
Parent::onAdd(%this,%obj);
}
function WeaponImage::onMount(%this, %obj, %slot)
{
if(%obj.currTool == -1 || %obj.toolReserve[%obj.currTool] $= "")
{
%obj.maxReserve[%obj.currTool] = %this.item.maxReserve;
%obj.dropReserve[%obj.currTool] = %this.item.dropReserve;
%obj.toolReserve[%obj.currTool] = %this.item.spawnReserve;
echo("onmount");
}
Parent::onMount(%this, %obj, %slot);
}
function servercmdDropTool(%client,%slot)
{
if(!isObject(%client.player))
return Parent::servercmdDropTool(%client,%slot);
//if(!isObject(%client.player.tool[%slot]) || %client.player.tool[%slot].maxReserve <= 0)
// return Parent::servercmdDropTool(%client,%slot);
//$weaponAmmoLoaded = %client.player.dropReserve[%client.player.currTool];
//if(%client.player.tool[%slot].dropReserve >= 0)
//if(%client.player.maxReserve[%client.player.currTool] == 800)
//$WeaponReserveLoaded = 1;
if(%client.player.dropReserve[%client.player.currTool] !$= "")
$WeaponReserveLoaded = %client.player.dropReserve[%client.player.currTool];
%client.player.maxReserve[%client.player.currTool] = "";
%client.player.dropReserve[%client.player.currTool] = "";
%client.player.toolReserve[%client.player.currTool] = "";
return Parent::servercmdDropTool(%client,%slot);
}
function ResetReserve(%this)
{
if(%this.toolReserve[0] > %this.maxReserve[0])
%this.toolReserve[0] = %this.MaxReserve[0];
if(%this.toolReserve[1] > %this.maxReserve[1])
%this.toolReserve[1] = %this.MaxReserve[1];
if(%this.toolReserve[2] > %this.maxReserve[2])
%this.toolReserve[2] = %this.MaxReserve[2];
if(%this.toolReserve[3] > %this.maxReserve[3])
%this.toolReserve[3] = %this.MaxReserve[3];
if(%this.toolReserve[4] > %this.maxReserve[4])
%this.toolReserve[4] = %this.MaxReserve[4];
if(%this.toolReserve[0] < 0)
%this.toolReserve[0] = 0;
if(%this.toolReserve[1] < 0)
%this.toolReserve[1] = 0;
if(%this.toolReserve[2] < 0)
%this.toolReserve[2] = 0;
if(%this.toolReserve[3] < 0)
%this.toolReserve[3] = 0;
if(%this.toolReserve[4] < 0)
%this.toolReserve[4] = 0;
}
function DisplayAmmo(%this)
{
%this.client.bottomprint("<just:right><color:FFFF00>Ammo <color:FFFFFF>:<color:FF0000>" SPC %this.toolReserve[%this.currTool], 3);
}
};activatePackage(AmmoReserve);
Like The JVS Doors Restriction Settings but with weapons.I think thats a pretty bad brown townogy but okay.