Monthly Target: $400 Donations: $126
 31% 

[TF2] Donator Building Colors


Post New Thread Reply   
 
Thread Tools Display Modes
Author
abrandnewday
( ͡░ ͜ʖ ͡░)
Join Date: Dec 2011
Location: FUCK
Plugin ID:
3703
Plugin Version:
0.2
Plugin Category:
General Purpose
Plugin Game:
Team Fortress 2
Plugin Dependencies:
Servers with this Plugin:
14 
Plugin Description:
Gives Donators the ability to change the color of their buildings.
Old 06-20-2013 , 16:41   [TF2] Donator Building Colors
Reply With Quote #1

Introduction
Here we are with the first of some Basic Donator Interface-required plugins that I am working on. This plugin adds in the ability for Donators to change their Sentry/Dispenser/Teleporter model colors as Engineers.

The idea for this came from the already existing Coloring Engineer Buildings plugin. The plugin I had used as a reference had a very limited amount of color options, so I went and added in all the available color options from FunCommandsX, then figured out how to get this set up to utilize the Basic Donator Interface system from scratch.

You of course can select different colors for each of your buildings. How you would do this is simple. First select a color for your first building, then build it. Before you build another building, choose a new color, then build the new building. Simple!


Required Plugins

Commands
Commands only valid when using "donatorbuildingcolors.smx", which is the non-BDI version
  • sm_buildingcolors - Opens building colors menu

Installation
If you use the Basic Donator Interface:
  1. Download donator.buildingcolor.tf2.smx
  2. Place the file in sourcemod/plugins folder.
  3. Load the plugin up ingame via RCON (rcon sm plugins load donator.buildingcolor.tf2.smx)
  4. ???
  5. Profit!

If you don't use the Basic Donator Interface
  1. Download donatorbuildingcolors.smx
  2. Place the file in sourcemod/plugins folder.
  3. Load the plugin up ingame via RCON (rcon sm plugins load donatorbuildingcolors.smx)
  4. ???
  5. Profit!


Change Log
Code:
Version 0.2 - June 21st, 2013
* Removed "<morecolors>" include in the source code that I left in accidentally (it was a remnant from a personalized version that I was working on for the UNFGaming.net servers).

Version 0.1 - June 20th, 2013
* Initial release
Bugs? Errors? Suggestions? Comments?
If you encounter any bugs, or notice any errors in your error logs stemming from this plugin, please post a reply and include as much information about the bug, or the full error listing from your logs, so I can fix this if necessary!

As for comments or suggestions, again, just post a reply! I won't bite
Attached Files
File Type: smx donator.buildingcolors.tf2.smx (6.3 KB, 336 views)
File Type: sp Get Plugin or Get Source (donator.buildingcolors.tf2.sp - 202 views - 4.9 KB)
File Type: sp Get Plugin or Get Source (donatorbuildingcolors.sp - 528 views - 5.0 KB)
__________________


Don't forget to rate a plugin thread if you like the plugin!

Last edited by abrandnewday; 09-07-2015 at 22:42. Reason: Switching status to "Ready for Review" :)
abrandnewday is offline
Send a message via Skype™ to abrandnewday
Horsedick
AlliedModders Donor
Join Date: Sep 2011
Old 06-20-2013 , 18:32   Re: [TF2] Donator Building Colors
Reply With Quote #2

Not everyone uses the basic donator interface system... so would be very helpful if you added some commands/cvars so you can apply it to systems that others have designed such as the one I created for my servers. I know I'd appreciate it
Horsedick is offline
abrandnewday
( ͡░ ͜ʖ ͡░)
Join Date: Dec 2011
Location: FUCK
Old 06-20-2013 , 18:38   Re: [TF2] Donator Building Colors
Reply With Quote #3

Quote:
Originally Posted by Horsedick View Post
Not everyone uses the basic donator interface system... so would be very helpful if you added some commands/cvars so you can apply it to systems that others have designed such as the one I created for my servers. I know I'd appreciate it
If I had some sort of outline of how your sytem works, or even the source code for your system (obviously asking for source code is a touchy subject, I understand that), so I could see how it works, and how to rework this plugin to make it compatible, I'd do so.

I was also thinking of doing a non-Basic Donator Interface version using CheckCommandAccess and such.
__________________


Don't forget to rate a plugin thread if you like the plugin!

Last edited by abrandnewday; 06-20-2013 at 18:39.
abrandnewday is offline
Send a message via Skype™ to abrandnewday
Horsedick
AlliedModders Donor
Join Date: Sep 2011
Old 06-21-2013 , 11:07   Re: [TF2] Donator Building Colors
Reply With Quote #4

Quote:
Originally Posted by abrandnewday View Post
If I had some sort of outline of how your sytem works, or even the source code for your system (obviously asking for source code is a touchy subject, I understand that), so I could see how it works, and how to rework this plugin to make it compatible, I'd do so.

I was also thinking of doing a non-Basic Donator Interface version using CheckCommandAccess and such.
Well that is the beauty of it, I don't use a full blown system. I'm basically assigning flag restrictions onto certain users but I created a plugin for assigning a menu per flagged user or two sets which define functions from each individual fun/plugin that I've added. I'm then just assigning "Admins" or the VIP's thru sourcebans per flag and I created yet another plugin to reset CCC to go along with the hash sent by SB's so everything is done on the fly and very simple.

So you can see how the need for basic CVARs or commands is essential to some that would or could use this.
Horsedick is offline
abrandnewday
( ͡░ ͜ʖ ͡░)
Join Date: Dec 2011
Location: FUCK
Old 06-21-2013 , 11:28   Re: [TF2] Donator Building Colors
Reply With Quote #5

Quote:
Originally Posted by Horsedick View Post
Well that is the beauty of it, I don't use a full blown system. I'm basically assigning flag restrictions onto certain users but I created a plugin for assigning a menu per flagged user or two sets which define functions from each individual fun/plugin that I've added. I'm then just assigning "Admins" or the VIP's thru sourcebans per flag and I created yet another plugin to reset CCC to go along with the hash sent by SB's so everything is done on the fly and very simple.

So you can see how the need for basic CVARs or commands is essential to some that would or could use this.
Ahh. Well do you give VIPs access to a certain command that not everyone else has access to? Because as I said I'm thinking of doing a non-BDI version, but I'm debating on which would be easier; "CheckCommandAccess" or "GetUserFlagBits(client) && ADMFLAG_CUSTOM1"

I just did up a quick non-Basic-Donator-Interface version that grants access to users with the "o" flag. This is very similar to the version I coded up for the UNFGaming.net servers, before the owner of the group decided to switch to Basic Donator Interface. Let me know what you think, suggest any changes, etc, and I'll see what I can do!

PHP Code:
#include <sourcemod>
#include <sdktools>

#pragma semicolon 1

#define PLUGIN_VERSION    "0.1"

new gColor[MAXPLAYERS 1];

public 
Plugin:myinfo 
{
    
name "Donator Engineer Building Colors",
    
author "abrandnewday",
    
description "Donator Feature: Color your Engineer Buildings!",
    
version PLUGIN_VERSION,
    
url "https://forums.alliedmods.net/member.php?u=165383"
}

public 
OnPluginStart()
{
    
CreateConVar("sm_buildcolor_v"PLUGIN_VERSION"Donator Building Colors Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
    
RegConsoleCommand("sm_buildingcolors"Command_BuildingColors"Access the Building Colors menu");
    
    
HookEvent("player_builtobject"Event_BuiltObject);
}

public 
OnPluginEnd()
{
    new 
ent = -1;
    while((
ent FindEntityByClassname(ent"obj_dispenser")) != -1)
    {
        
SetEntityRenderColor(ent255255255_);
    }
    while((
ent FindEntityByClassname(ent"obj_teleporter")) != -1)
    {
        
SetEntityRenderColor(ent255255255_);
    }
    while((
ent FindEntityByClassname(ent"obj_sentry")) != -1)
    {
        
SetEntityRenderColor(ent255255255_);
    }
}

public 
OnClientPutInServer(iClient)
{
    
gColor[iClient] = 0;
}

public 
Action:Command_BuildingColors(iClientargs)
{
    if (!
IsDonator(iClient))
    {
        
ReplyToCommand(iClient"Sorry, you must be a Donator to use this command!");
        return 
Plugin_Handled;
    }
    
Menu_ChangeBuildingColor(iClient);
}

public 
Action:Menu_ChangeBuildingColor(iClient)
{
    new 
Handle:menu CreateMenu(BuildingColorMenuSelected);
    
SetMenuTitle(menu"Donator: Change Building Color:");

    
AddMenuItem(menu"0""No Color");
    
AddMenuItem(menu"1""Black");
    
AddMenuItem(menu"2""Red");
    
AddMenuItem(menu"3""Green");
    
AddMenuItem(menu"4""Blue");
    
AddMenuItem(menu"5""Yellow");
    
AddMenuItem(menu"6""Purple");
    
AddMenuItem(menu"7""Cyan");
    
AddMenuItem(menu"8""Orange");
    
AddMenuItem(menu"9""Pink");
    
AddMenuItem(menu"10""Olive");
    
AddMenuItem(menu"11""Lime");
    
AddMenuItem(menu"12""Violet");
    
AddMenuItem(menu"13""Light Blue");
    
AddMenuItem(menu"14""Silver");
    
AddMenuItem(menu"15""Chocolate");
    
AddMenuItem(menu"16""Saddle Brown");
    
AddMenuItem(menu"17""Indigo");
    
AddMenuItem(menu"18""Ghost White");
    
AddMenuItem(menu"19""Thistle");
    
AddMenuItem(menu"20""Alice Blue");
    
AddMenuItem(menu"21""Steel Blue");
    
AddMenuItem(menu"22""Teal");
    
AddMenuItem(menu"23""Gold");
    
AddMenuItem(menu"24""Tan");
    
AddMenuItem(menu"25""Tomato");
    
    
DisplayMenu(menuiClient20);
}

public 
BuildingColorMenuSelected(Handle:menuMenuAction:actioniClientparam2)
{
    if(
action == MenuAction_End)
    {
        
CloseHandle(menu);
    }

    if(
action == MenuAction_Select)
    {
        
decl String:info[12];
        
GetMenuItem(menuparam2infosizeof(info));
        
gColor[iClient] = StringToInt(info);
    }
}

public 
Action:Event_BuiltObject(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
iClient GetClientOfUserId(GetEventInt(event"userid"));
    if(!
IsValidClient(iClient)) return Plugin_Continue;

    new 
iBuilding GetEventInt(event"index");

    switch(
gColor[iClient])
    {
        case 
1SetEntityRenderColor(iBuilding000_);
        case 
2SetEntityRenderColor(iBuilding25500_);
        case 
3SetEntityRenderColor(iBuilding02550_);
        case 
4SetEntityRenderColor(iBuilding00255_);
        case 
5SetEntityRenderColor(iBuilding2552550_);
        case 
6SetEntityRenderColor(iBuilding2550255_);
        case 
7SetEntityRenderColor(iBuilding0255255_);
        case 
8SetEntityRenderColor(iBuilding2551280_);
        case 
9SetEntityRenderColor(iBuilding2550128_);
        case 
10SetEntityRenderColor(iBuilding1282550_);
        case 
11SetEntityRenderColor(iBuilding0255128_);
        case 
12SetEntityRenderColor(iBuilding1280255_);
        case 
13SetEntityRenderColor(iBuilding0128255_);
        case 
14SetEntityRenderColor(iBuilding192192192_);
        case 
15SetEntityRenderColor(iBuilding21010530_);
        case 
16SetEntityRenderColor(iBuilding1396919_);
        case 
17SetEntityRenderColor(iBuilding750130_);
        case 
18SetEntityRenderColor(iBuilding248248255_);
        case 
19SetEntityRenderColor(iBuilding216191216_);
        case 
20SetEntityRenderColor(iBuilding240248255_);
        case 
21SetEntityRenderColor(iBuilding70130180_);
        case 
22SetEntityRenderColor(iBuilding0128128_);
        case 
23SetEntityRenderColor(iBuilding2552150_);
        case 
24SetEntityRenderColor(iBuilding210180140_);
        case 
25SetEntityRenderColor(iBuilding2559971_);
    }
    return 
Plugin_Continue;
}

stock bool:IsValidClient(iClientbool:replay true)
{
    if(
iClient <= || iClient MaxClients || !IsClientInGame(iClient)) return false;
    if(
replay && (IsClientSourceTV(iClient) || IsClientReplay(iClient))) return false;
    return 
true;
}

stock IsDonator(iClient)
{
    if(!
GetUserFlagBits(iClient) && ADMFLAG_CUSTOM1)
    {
        return 
false;
    }
    return 
true;

__________________


Don't forget to rate a plugin thread if you like the plugin!

Last edited by abrandnewday; 06-21-2013 at 11:35.
abrandnewday is offline
Send a message via Skype™ to abrandnewday
Horsedick
AlliedModders Donor
Join Date: Sep 2011
Old 06-21-2013 , 17:30   Re: [TF2] Donator Building Colors
Reply With Quote #6

I'd try it but its giving this when trying to compile.
Quote:
/home/groups/sourcemod/upload_tmp/php5yvKjj.sp(22) : error 017: undefined symbol "RegConsoleCommand" /home/groups/sourcemod/upload_tmp/php5yvKjj.sp(57) : warning 209: function "Command_BuildingColors" should return a value
Horsedick is offline
abrandnewday
( ͡░ ͜ʖ ͡░)
Join Date: Dec 2011
Location: FUCK
Old 06-21-2013 , 18:18   Re: [TF2] Donator Building Colors
Reply With Quote #7

Quote:
Originally Posted by Horsedick View Post
I'd try it but its giving this when trying to compile.
Probably screwed something up. Let me run through it and see if I can get it to compile.

I actually didn't test-compile that code, I just did that as an example.

EDIT: Here you go! This should work
Attached Files
File Type: sp Get Plugin or Get Source (donatorbuildingcolors.sp - 204 views - 5.0 KB)
__________________


Don't forget to rate a plugin thread if you like the plugin!

Last edited by abrandnewday; 06-21-2013 at 18:21.
abrandnewday is offline
Send a message via Skype™ to abrandnewday
StayOx
SourceMod Donor
Join Date: Jun 2012
Location: Gliese 581g
Old 06-21-2013 , 23:38   Re: [TF2] Donator Building Colors
Reply With Quote #8

Hello guy, unfortunately it is not possible to use your plugin, because the plugin "[ANY] Basic Donator Interface" does not work if you have any version of the dependency that works please post it here as the original author is inactive.

The plugin is loaded however the command:

! donators - chat
sm_donators - console client

are not recognized
StayOx is offline
abrandnewday
( ͡░ ͜ʖ ͡░)
Join Date: Dec 2011
Location: FUCK
Old 06-21-2013 , 23:42   Re: [TF2] Donator Building Colors
Reply With Quote #9

Quote:
Originally Posted by StayOx View Post
Hello guy, unfortunately it is not possible to use your plugin, because the plugin "[ANY] Basic Donator Interface" does not work if you have any version of the dependency that works please post it here as the original author is inactive.

The plugin is loaded however the command:

! donators - chat
sm_donators - console client

are not recognized
Weird, it works for me. If you are just using BDI and this plugin, you may want to do a brief test.

  1. First, set up Basic Donator Interface on your server and run the plugin. Then upload this plugin to your server and load it up.
  2. Try using "!donators" in chat. Nothing should come up, and you should see yourself saying "!donators".
  3. Now make sure you've added yourself to the "donators.txt" file, by putting in your Steam ID and a level, like so: "STEAM_0:0:00000000;99".
  4. Once you've done that, go ingame and type in "sm_reloaddonators" or do it via RCON "rcon sm_reloaddonators".
  5. After you do that, say "!donators" and the Donator menu should appear with "Change Building Colors" on it.
__________________


Don't forget to rate a plugin thread if you like the plugin!

Last edited by abrandnewday; 06-21-2013 at 23:43.
abrandnewday is offline
Send a message via Skype™ to abrandnewday
StayOx
SourceMod Donor
Join Date: Jun 2012
Location: Gliese 581g
Old 06-21-2013 , 23:53   Re: [TF2] Donator Building Colors
Reply With Quote #10

Quote:
Originally Posted by abrandnewday View Post
Weird, it works for me. If you are just using BDI and this plugin, you may want to do a brief test.

  1. First, set up Basic Donator Interface on your server and run the plugin. Then upload this plugin to your server and load it up.
  2. Try using "!donators" in chat. Nothing should come up, and you should see yourself saying "!donators".
  3. Now make sure you've added yourself to the "donators.txt" file, by putting in your Steam ID and a level, like so: "STEAM_0:0:00000000;99".
  4. Once you've done that, go ingame and type in "sm_reloaddonators" or do it via RCON "rcon sm_reloaddonators".
  5. After you do that, say "!donators" and the Donator menu should appear with "Change Building Colors" on it.

Exactly, I've tried using "[ANY] Basic Interface Donate" numerous times, he has never worked for me, I type the command !donators and nothing happens, please post here the version that you use

this command: sm_reloaddonators always work
[SM] Donator database reloaded.
StayOx is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:38.


Powered by vBulletin®
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Theme made by Freecode