I'm surprised no one ever made an Add-On like this. It took me more time to write this thread than it did the Add-On.
Basically, you can set certain items to be
VIP only.
Here's how it works:
You have 6 different Server Preferences
(Integrated via RTB Prefs):
- Enabled - Toggles the Add-On
- Item List - A Space Delimited list of Item Datablock Names.
- Example: "wrenchItem swordItem hammerItem"
- VIP List - A Space Delimited list of Blockland IDs that are VIPs.
- Auto VIPs - Determine what types of Players are automatically VIPs.
- Options: Admins, Super-Admins, None
- Message - The Message to display (Center Print) when a Player needs VIP to pick up an Item.
- Example: "<color:FFFFFF>This is a <color:FCD116>VIP Only<color:FFFFFF> Item"
- Displays As: "This is a VIP Only Item"
- Message Time - Controls how long to display the Message.
This Add-On should be pretty straight forward. However, I did my best to make this Add-On easy to extend and change. For those wanting to do so, just intercept the
GameConnection::isVIP(%client) function found in the
utilities.cs file:
// Returns whether or not the Calling Client is a VIP
function GameConnection::isVIP(%client)
{
// Check if the Client is in the List of VIPs
if(containsWord($Pref::Support::VIP_Items::VIPs, %client.getBLID()))
return true;
// Check for Admin Auto-VIP
if(%client.isAdmin && $Pref::Support::VIP_Items::Auto == 1)
return true;
// Check for Super-Admin Auto-VIP
if(%client.isSuperAdmin && $Pref::Support::VIP_Items::Auto == 2)
return true;
// Check for LAN Game
if(%client.getBLID() == 999999)
return true;
// Client is not VIP
return false;
}
You may also want to alter the
ItemData::isVIP(%item) function in
utilities.cs as well. This function basically determines whether or not an Item is a VIP Item.
// Returns whether or not the Calling Item is a VIP Item
function ItemData::isVIP(%item)
{
// Check if the Item is in the List of VIPs
if(containsWord($Pref::Support::VIP_Items::Items, %item.getName()))
return true;
// Item is not VIP
return false;
}
If you change these, you can alter how the entire VIP system works.
Let me know if you have any questions, comments, concerns, etc. on this. This Add-On is pretty straight forward, and there's not a lot of code to it.
Also, for the most up to date version of this Add-On and this Thread, please go to:
http://scatteredspace.com/forum/index.php?topic=2889.0. I'm not trying to advertise or anything. I'm just more active there than I am here.
For some reason the forums won't let me upload my add-on, so you'll have to go vist the thread I've linked, or download it off of my Dropbox
(Link).