this did happen
registerOutputEvent(Player, "addRandomItemBlacklisted", "");
$Pref::Server::AddRandomItemBlacklist = "Hammer " TAB "Wrench" TAB "Printer" TAB "Duplorcator" TAB "Fill Can" TAB "Fill Printer" TAB "Fist" TAB "Self Delete Gun" TAB "Gun" TAB "Sword" TAB "Key Red" TAB "Key Blue" TAB "Key Yellow" TAB "Key Green" TAB "Pill" TAB "Wand" TAB "WaterFX Can" TAB "Rocket Launcher";
function checkIfToolBlacklisted(%uiname)
{
for( %i = 0 ; %i < getFieldCount( %bl = $Pref::Server::AddRandomItemBlacklist ) ; %i++ )
if( %uiName $= getField( %bl , %i ) ) { return 0; }
return 1;
}
function Player::addRandomItemBlacklisted(%player,%client)
{
for(%i = 0; %i < DataBlockGroup.getCount(); %i++)
{
%obj = DataBlockGroup.getObject(%i);
if(%obj.getClassName() $= "ItemData" && (%uiname = %obj.uiName) !$= "" && checkIfToolBlacklisted(%uiname)) //parser rape
%item[%itemCount++] = %obj;
}
%randomitem = getRandom(0,%itemCount);
if(%player.tool[0] $= %item[%randomitem] || %player.tool[1] $= %item[%randomitem] || %player.tool[2] $= %item[%randomitem] || %player.tool[3] $= %item[%randomitem] || %player.tool[4] $= %item[%randomitem])
{
return;
}
for(%i=0;%i<5;%i++)
{
%tool = %player.tool[%i];
if(%tool == 0)
{
%player.tool[%i] = %item[%randomitem];
%player.weaponCount++;
messageClient(%client,'MsgItemPickup','',%i,%item[%randomitem]);
break;
}
}
}