Idea: Make a version that uses an RTB preference (requiring server restart) to give a number of slots between 1 and 9. If they don't have RTB installed (or default value), set it to 8, otherwise make the player-type according to their set value.
Space Guy, I'm not that good at scripting. I need help for that, because I have no idea how the rtb preferences are scripted.Maybe you can help with that
Pref ManagerRTB 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]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 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.This code should be placed in the server.cs of your Add-On
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;}
You don't need to PM me and post in the topic.
//Setting the preferenceif(isFile("Add-Ons/System_ReturnToBlockland/server.cs")){ if(!$RTB::RTBR_ServerControl_Hook) exec("Add-Ons/System_ReturnToBlockland/RTBR_ServerControl_Hook.cs"); RTB_registerPref("Maximum Weapons","Multi Slots Player","MultiSlotPlayer::Slots","int 1 9","Player_MultiSlot",5,1,1);}else{ $MultiSlotPlayer::Slots = 8;}//Player with multiple slotsdatablock PlayerData(PlayerMultiSlotArmor : PlayerStandardArmor){ maxTools = $MultiSlotPlayer::Slots; maxWeapons = $MultiSlotPlayer::Slots; uiName = $MultiSlotPlayer::Slots @ "-Slot Player";};//Player with multiple slots, that can't jetdatablock PlayerData(PlayerMultiSlotNoJetArmor : PlayerStandardArmor){ maxTools = $MultiSlotPlayer::Slots; maxWeapons = $MultiSlotPlayer::Slots; uiName = $MultiSlotPlayer::Slots @ "-Slot No Jet Player"; canjet = 0};//Setting the support so we can see all Slotspackage InventorySlotAdjustment{ function GameConnection::setControlObject(%this,%obj) { Parent::setControlObject(%this,%obj); if(%obj == %this.player) commandToClient(%this,'PlayGui_CreateToolHud',%obj.getDatablock().maxTools); } function Player::changeDatablock(%this,%data,%client) { if(%data != %this.getDatablock()) commandToClient(%this.client,'PlayGui_CreateToolHud',%data.maxTools); Parent::changeDatablock(%this,%data,%client); }};activatePackage(InventorySlotAdjustment);