Blockland Forums > Modification Help
Checking to see if a player is an Admin using callback
Kalphiter:
I gosh, I completely forgot what you needed.
--- Code: ---$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);
--- End code ---
Set $itemdb_xyz to an item datablock's number or name.
Tango:
--- Quote from: Kalphiter on January 25, 2012, 08:23:33 PM ---I gosh, I completely forgot what you needed.
--- Code: ---$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);
--- End code ---
Set $itemdb_xyz to an item datablock's number or name.
--- End quote ---
So I could package an add-on with a server.cs that executes multiple other files (eg: assaultriflerestriction.cs) and that would work?
Tango:
How would I go about finding datablocks?
Kalphiter:
What weapon are you restricting?
Tango:
--- Quote from: Kalphiter on January 25, 2012, 08:43:27 PM ---What weapon are you restricting?
--- End quote ---
I'm planning on restricted quite a few weapons but as an example the silenced gun.