AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [TF2] Donator Building Colors (https://forums.alliedmods.net/showthread.php?t=218774)

404UserNotFound 06-20-2013 15:41

[TF2] Donator Building Colors
 
3 Attachment(s)
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 :wink:

Horsedick 06-20-2013 17:32

Re: [TF2] Donator Building Colors
 
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 :)

404UserNotFound 06-20-2013 17:38

Re: [TF2] Donator Building Colors
 
Quote:

Originally Posted by Horsedick (Post 1974014)
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.

Horsedick 06-21-2013 10:07

Re: [TF2] Donator Building Colors
 
Quote:

Originally Posted by abrandnewday (Post 1974019)
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.

404UserNotFound 06-21-2013 10:28

Re: [TF2] Donator Building Colors
 
Quote:

Originally Posted by Horsedick (Post 1974353)
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;



Horsedick 06-21-2013 16:30

Re: [TF2] Donator Building Colors
 
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

404UserNotFound 06-21-2013 17:18

Re: [TF2] Donator Building Colors
 
1 Attachment(s)
Quote:

Originally Posted by Horsedick (Post 1974646)
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 :D

StayOx 06-21-2013 22:38

Re: [TF2] Donator Building Colors
 
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

404UserNotFound 06-21-2013 22:42

Re: [TF2] Donator Building Colors
 
Quote:

Originally Posted by StayOx (Post 1974796)
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.

StayOx 06-21-2013 22:53

Re: [TF2] Donator Building Colors
 
Quote:

Originally Posted by abrandnewday (Post 1974797)
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.


All times are GMT -4. The time now is 22:11.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.