Author Topic: Making an RTB Pref  (Read 1262 times)

How would I make an RTB pref? I've looked at others and they're confusing and don't work when I edit them to what I want to be done. I've already done the if statements
Code: [Select]
if(%client.IsAdmin && $Pref::Jets::Enabled)

I want it as a checkbox and could someone explain it?
Pretty please.



thankool kids klubss
For some reason this doesn't work

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("Enabled", "NoJets", "$Pref::Jets::Enabled", "bool", "Server_NoJet", 1, 0, 0);
}
else
    $Pref::Jets::Enabled = true;

RTB is automatically executed before any other add-ons. You should just use something like this:

Code: [Select]
if($RTB::RTBR_ServerControl_Hook)
    RTB_RegisterPref("Enabled", "NoJets", "Pref::Jets::Enabled", "bool", "Server_NoJet", 1, 0, 0);

However, the reason your code didn't work was because you're not supposed to list the $ in the third argument.

However, the reason your code didn't work was because you're not supposed to list the $ in the third argument.

Literally the first line in the function strips the $ from the variable name.


function RTB_registerPref(%name,%cat,%pref,%vartype,%mod,%default,%requiresRestart,%hostOnly,%callback)
{
   %pref = strReplace(%pref,"$","");
   ...
}

Odd, then. I see nothing else wrong with his code.

Odd, then. I see nothing else wrong with his code.
It works your way, I just removed $ and it worked and added Pref:: because I was missing it lol.