View Single Post
404UserNotFound
BANNED
Join Date: Dec 2011
Old 06-21-2013 , 10: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;


Last edited by 404UserNotFound; 06-21-2013 at 10:35.
404UserNotFound is offline