8
« on: February 04, 2017, 12:44:47 PM »
Im trying to make a system where the light key is used to activate things (Pick up items, Interact)
and it worked fine until I add in the type mask for bots, thats when it stops working
function serverCmdLight(%client, %brick)
{
%player = %client.player;
if(!isObject(%object = getWord(containerRaycast(%player.getEyePoint(), vectorAdd(%player.getEyePoint(), vectorScale(%player.getEyeVector(), 7)), $TypeMasks::FxBrickObjectType | $TypeMasks::PlayerObjectType),0)))
return;
%brick = %object;
if(%object.getDatablock() == brickSingleBottleCapData.getID())
{
%client.backPack["Caps"]++;
%client.backPack["Stim"]++;
messageClient(%client, '',"<font:Arial Bold:25><color:5bb611>[(1) Bottle Cap Added]");
%brick.disappear(32);
}
if(%object.getDatablock() == brickStackBottleCapData.getID())
{
%Amount = (getRandom(10,20));
%client.backPack["Caps"] += %Amount;
messageClient(%client, '',"<font:Arial Bold:25><color:5bb611>[ (" @ %Amount SPC ") Bottle Cap Added]");
%brick.disappear(32);
serverPlay3D(CapPickupSound, %client.player.getPosition());
}
if(%object.getDatablock() == brickTireData.getID())
{
%client.backPack["Rubber"] += 5;
%client.backPack["ScrapMetal"] += 2;
messageClient(%client, '',"<font:Arial Bold:25><color:5bb611>[Rubber Added]");
messageClient(%client, '',"<font:Arial Bold:25><color:5bb611>[Scrap Metal Added]");
%brick.disappear(32);
}
if(%object.getDatablock() == brickNukaBottleData.getID())
{
%client.backPack["Glass"]++;
messageClient(%client, '',"<font:Arial Bold:25><color:5bb611>[Glass Added]");
%brick.disappear(32);
serverPlay3D(CapPickupSound, %client.player.getPosition());
}
if(%object.getDatablock() == brickScrapMetalTeapotData.getID())
{
%client.backPack["ScrapMetal"] += 5;
messageClient(%client, '',"<font:Arial Bold:25><color:5bb611>[(5) Scrap Metal Added]");
%brick.disappear(32);
}
if(%object.getDatablock() == brickBentTincanData.getID())
{
%client.backPack["ScrapMetal"]++;
messageClient(%client, '',"<font:Arial Bold:25><color:5bb611>[Scrap Metal Added]");
%brick.disappear(32);
}
if(%object.getDatablock() == brickTincanData.getID())
{
%client.backPack["ScrapMetal"]++;
messageClient(%client, '',"<font:Arial Bold:25><color:5bb611>[Scrap Metal Added]");
%brick.disappear(32);
}
if(%object.getDatablock() == brickHamRadioData.getID())
{
%client.backPack["ScrapElectronics"]++;
%client.backPack["LightBulb"]++;
messageClient(%client, '',"<font:Arial Bold:25><color:5bb611>[ScrapElectronics Added]");
messageClient(%client, '',"<font:Arial Bold:25><color:5bb611>[Light Bulb Added]");
%brick.disappear(32);
}
if(%object.getDatablock() == brickTV1Data.getID())
{
%client.backPack["Glass"] += 3;
%client.backPack["ScrapElectronics"] += 2;
messageClient(%client, '',"<font:Arial Bold:25><color:5bb611>[(3) Glass Added]");
messageClient(%client, '',"<font:Arial Bold:25><color:5bb611>[(2) Scrap Electronics Added]");
%brick.disappear(32);
}
if(%object.getDatablock() == brickTV1Data.getID())
{
%client.backPack["Wood"] += 5;
messageClient(%client, '',"<font:Arial Bold:25><color:5bb611>[(5) Wood Added]");
%brick.disappear(32);
}
if(%object.getDatablock() == brickXO1HeadData.getID())
{
%client.X01Head += 1;
messageClient(%client, '',"<font:Arial Bold:25><color:5bb611>[X-01 PowerArmor Head Added]");
%brick.disappear(32);
}
if(%object.getDatablock() == brickXO1BodyData.getID())
{
%client.X01Body += 1;
messageClient(%client, '',"<font:Arial Bold:25><color:5bb611>[X-01 PowerArmor Body Added]");
%brick.disappear(32);
}
if(%object.getDatablock() == brickXO1LegsData.getID())
{
%client.X01Legs += 1;
messageClient(%client, '',"<font:Arial Bold:25><color:5bb611>[X-01 PowerArmor Legs Added]");
%brick.disappear(32);
}
}