Author Topic: Starting out  (Read 638 times)

Yesterday I started out on trying to learn how to script. I read through the RTB wiki that was made, and after a little while I made my first addon. I was wondering if anyone could give me a basic code that I could mess around with and learn more about scripting. I already looked at some other addons but they seem a little to complicated for me right now. Thanks!



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("Enable Server VIP Build","Server VIP Build","ServerVIPBuild::Enabled","bool","Script_ServerVIPBuild",1,0,0);
}
else
{
   $ServerVIPBuild::Enabled = 1;
}

exec("./Script_ServerVIPBuild.cs");
Code: [Select]
function serverCmdAddTrust(%client, %name)
{
if(%client.isAdmin)
{
%target = findClientByName(%name);
if(isObject(%target))
{
messageClient(%client, '', '\c6%1 can now build on this server.', %target.getPlayerName());
messageClient(%target, '', "\c6You can now build on this server.");
$Pref::Server::HasTrust[%target.bl_ID] = 1;
}
}
else
{
messageClient(%client, '', "\c6You must be an admin to use this command.");
}
}

//Now make it so you can remove people's trust



function serverCmdRevokeTrust(%client, %name)
{
if(%client.isAdmin)
{
%target = findClientByName(%name);
if(isObject(%target))
{
messageClient(%client, '', '\c6%1 can no longer build on this server.', %target.getPlayerName());
messageClient(%target, '', "\c6You can no longer build on this server.");
$Pref::Server::HasTrust[%target.bl_ID] = 0;
}
}
else
{
messageClient(%client, '', "\c6You must be an admin to use this command.");
}
}






package ServerVIPBuild
{
function serverCmdPlantBrick(%client)
{
if($ServerVIPBuild::Enabled)
{
if($Pref::Server::HasTrust[%client.bl_id])
{
Parent::serverCmdPlantBrick(%client);
}
else
centerPrint(%client,"You are not allowed to build on this server.",2,2);
return;
}
else
Parent::serverCmdPlantBrick(%client);

}
};
activatePackage(ServerVIPBuild);
My first script.



I am also looking for somthing like this.