Author Topic: Players not being able to spawn items/weapons  (Read 534 times)

Is there an addon that allows a player to use a wrench for things such as events, emitters, and lights however the player cannot spawn weapons?
Much would be appreciated if someone could link something like this, that is if its been made before.

Iban's cityRPG does this.  I'll paste that code here in a sec.

There, one broken setItem event.
setItem will only work on an Admin's bricks.

Code: [Select]
if(isPackage(adminonlyitemspackage))
{
deactivatepackage(adminonlyitemspackage);
}

package adminonlyitemspackage
{
function fxDTSBrick::setItem(%brick, %datablock, %client)
{
if(%datablock==0)
{
return parent::setItem(%brick, %datablock, %client);
}

%ownerBG = getBrickGroupFromObject(%brick);
if(%ownerBG.client.isAdmin)
{
parent::setItem(%brick, %datablock, %client);
}
else
{
return 0;
}
}
};

activatepackage(adminonlyitemspackage);

I removed all of the cityRPG stuff in that.  Heres the original function in case I screwed something up:
Code: (package.cs) [Select]
function fxDTSBrick::setItem(%brick, %datablock, %client)
{
if(%datablock==0)
{
parent::setItem(%brick, %datablock, %client);
}
if(!%brick.getDatablock().CityRPGPermaspawn && %brick != $LastLoadedBrick)
{
if(!isObject(%brick.item) || %brick.item.getDatablock() != %datablock)
{
%ownerBG = getBrickGroupFromObject(%brick);

if(%ownerBG.client.isAdmin)
parent::setItem(%brick, %datablock, %client);
}
else
parent::setItem(%brick, %datablock, %client);
}
else
parent::setItem(%brick, %datablock, %client);
}