2671
Modification Help / Re: re-load inventory menu
« on: August 06, 2009, 02:29:53 PM »
You may not need the ::changeDatablock one with that either. Untested, though.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
function Armor::onNewDatablock(%this,%data)
{
Parent::onNewDatablock(%this,%data);
if(isObject(%this.client))
commandToClient(%this.client,'PlayGui_CreateToolHud',%data.maxTools);
}
Pref Manager
RTB will be including a preference manager which will be accessible to Super Admins on the server. Any add-on can register prefs to be managed by this using the following function:
RTB_registerPref("Pref Name","Category","Pref","Var Type","Your Mod Name","Default Pref Value","Requires Server Restart","Host Only");
Pref Name - The display name of your Pref.
Category - This will usually be the name of your Add-on.
Pref - The actual variable name without the $.
Var Type - The field type, much like the events system it supports list, string (max length), bool and int (minval) (maxval).
Your Mod Name - The name of your mod, simply for error reporting.
Default Pref Value - Enter a default value for the pref if it has not been changed or set before.
Requires Server Restart - Puts a * in the gui to show that changing it will require a server restart.
Host Only - This will prevent non-hosts from changing that setting.
Here is an example:Code: [Select]This would register a pref called "Duplicator Timeout" in the Duplicator category which would change the $Duplicator::Timeout pref. The user would be allowed to enter an integer between 0 and 60 inclusive. The pref is registered by the Tool_Duplicator add-on. The default timeout is 40 seconds. It does not require a restart to begin working and both the host AND super admins can change it. If RTB is not installed, it will set the $Duplicator::Timeout value to 40 anyway so the add-on still works.if(isFile("Add-Ons/System_ReturnToBlockland/server.cs"))
{
if(!$RTB::RTBR_ServerControl_Hook)
exec("Add-Ons/System_ReturnToBlockland/RTBR_ServerControl_Hook.cs");
RTB_registerPref("Duplicator Timeout","Duplicator","Duplicator::Timeout","int 0 60","Tool_Duplicator",40,0,0);
}
else
{
$Duplicator::Timeout = 40;
}
This code should be placed in the server.cs of your Add-On