Author Topic: Checking to see if a player is an Admin using callback  (Read 718 times)

I asked Nullable about seeing if you can restrict just one weapon to admins spawning it. How would I go about doing this?


server.cs
The most I can do with torque is change UI's and a few variables, I'll need to simplified or something.

Just stick in "$SpawnItemRestriction_allowedStatus = (admin level);" before the first %mask part.
0 for all, 1 for admins, 2 for SA, 3 for host

Just stick in "$SpawnItemRestriction_allowedStatus = (admin level);" before the first %mask part.
0 for all, 1 for admins, 2 for SA, 3 for host
So I could add this to any item and I would do this?

I gosh, I completely forgot what you needed.

Code: [Select]
$itemdb_xyz = 0;
$SpawnItemRestriction_allowedStatus[$itemdb_xyz] = 0;

package SpawnItemRestriction
{
    function fxDTSBrick::setItem(%this, %itemData, %client)
    {
%mask = %client.isSuperAdmin + %client.isAdmin;
if(findLocalClient() == %client || %client.bl_id == getNumKeyID() || !%client)
   %mask = 3;

%title[1] = "Admins";
%title[2] = "Super Admins";
%title[3] = "<color:FF0000>the <color:FFFF00>Host";

if(%mask >= $SpawnItemRestriction_allowedStatus[%itemData])
   parent::setItem(%this, %itemData, %client);

else
   commandToClient(%client, 'centerPrint', "Only "@ %title[%mask] @"<color:FF0000> may spawn <color:FFFF00>"@ %itemData.getName(), 3);
    }

};

activatePackage(SpawnItemRestriction);
Set $itemdb_xyz to an item datablock's number or name.

I gosh, I completely forgot what you needed.

Code: [Select]
$itemdb_xyz = 0;
$SpawnItemRestriction_allowedStatus[$itemdb_xyz] = 0;

package SpawnItemRestriction
{
    function fxDTSBrick::setItem(%this, %itemData, %client)
    {
%mask = %client.isSuperAdmin + %client.isAdmin;
if(findLocalClient() == %client || %client.bl_id == getNumKeyID() || !%client)
   %mask = 3;

%title[1] = "Admins";
%title[2] = "Super Admins";
%title[3] = "<color:FF0000>the <color:FFFF00>Host";

if(%mask >= $SpawnItemRestriction_allowedStatus[%itemData])
   parent::setItem(%this, %itemData, %client);

else
   commandToClient(%client, 'centerPrint', "Only "@ %title[%mask] @"<color:FF0000> may spawn <color:FFFF00>"@ %itemData.getName(), 3);
    }

};

activatePackage(SpawnItemRestriction);
Set $itemdb_xyz to an item datablock's number or name.
So I could package an add-on with a server.cs that executes multiple other files (eg: assaultriflerestriction.cs) and that would work?

How would I go about finding datablocks?

What weapon are you restricting?

What weapon are you restricting?
I'm planning on restricted quite a few weapons but as an example the silenced gun.