This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

[ANY] Improved Player Joined Team Messages v1.3.0.2


Post New Thread Reply   
 
Thread Tools Display Modes
igotfits
Senior Member
Join Date: May 2009
Old 12-04-2012 , 06:35   Re: [TF2] Improved Player Joined Team Messages v1.2
Reply With Quote #11

: / can u explain how to, im sorry i never compiled before. im in the folder i dont see anything but .sp files and some folders none say compiler.
igotfits is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 12-04-2012 , 09:45   Re: [TF2] Improved Player Joined Team Messages v1.2
Reply With Quote #12

Quote:
Originally Posted by igotfits View Post
: / can u explain how to, im sorry i never compiled before. im in the folder i dont see anything but .sp files and some folders none say compiler.
Just download the precompiled one.

OP: I know I'm being picky, but I noticed you changed "RED" and "BLU" to "Red" and "Blu". I feel like the team names should be stylized in all caps, since RED and BLU are acronyms.

You don't have to do this to get approved, I haven't looked at your code yet. Just making a suggestion.
__________________
Dr. McKay is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 12-04-2012 , 09:50   Re: [TF2] Improved Player Joined Team Messages v1.2
Reply With Quote #13

Quote:
Originally Posted by Dr. McKay View Post
Just download the precompiled one.

OP: I know I'm being picky, but I noticed you changed "RED" and "BLU" to "Red" and "Blu". I feel like the team names should be stylized in all caps, since RED and BLU are acronyms.

You don't have to do this to get approved, I haven't looked at your code yet. Just making a suggestion. :)
An even better idea would be to make these team names change based on what game it is, seeing as how player_team is a Generic Source event rather than a TF2-specific one.

For example, the teams are:

0 - All-games - Unassigned (gray), HL2:DM - all players if teamplay is off (green)
1 - All-games - Spectators (gray)
2 - HL2:DM Teamplay Rebels (blue), DoD:S Allies (blue), CS:S Terrorists (red), TF2 RED (red), L4D/L4D2 Survivors (blue), All one-team games
3 - HL2:DM Teamplay Combine (red), DoD:S Axis (red), CS:S Counter-Terrorists (blue), TF2 BLU (blue), L4D/L4D2 Infected (red)
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 12-04-2012 at 09:57.
Powerlord is offline
bovril
Member
Join Date: Jan 2011
Old 12-31-2012 , 12:40   Re: [TF2] Improved Player Joined Team Messages v1.2
Reply With Quote #14

If possible can we get a cvar to disable it for bots? It spams the chat on mvm quite a bit
bovril is offline
ReFlexPoison
☠☠☠
Join Date: Jul 2011
Location: ☠☠☠
Old 12-31-2012 , 13:49   Re: [TF2] Improved Player Joined Team Messages v1.2
Reply With Quote #15

Based off of what Powerlord said about teams I gave it my best to set up the colors accordingly. Someone can edit the code for Half-Life 2: Deathmatch because I'm not familiar with how team setting works when mp_teamplay is enabled.

Plugin should properly account for:
  • Team Fortress 2
  • Counter-Strike
  • Day of Defeat: Source
  • Half-Life 2: Deathmatch (Sorta)
  • Left 4 Dead

Added sm_jointeam_bots so you can disable custom bot notifications.
Also added auto executing config file for the CVars.
Config file will be automatically created at cfg\sourcemod\plugin.improvedjoinmessages.cfg

PHP Code:
#pragma semicolon 1

// ====[ INCLUDES ]============================================================
#include <sourcemod>
#include <morecolors>

// ====[ DEFINES ]=============================================================
#define PLUGIN_VERSION "1.3"

// ====[ HANDLES | CVARS ]=====================================================
new Handle:cvarEnabled;
new 
Handle:cvarBots;
new 
Handle:cvarTeamplay;

// ====[ VARIABLES ]===========================================================
new bool:g_bEnabled;
new 
bool:g_bBots;
new 
bool:g_bTeamplay;
new 
String:g_strGame[12];

// ====[ PLUGIN ]==============================================================
public Plugin:myinfo =
{
    
name "[TF2] Improved Join Team Messages",
    
author "Oshizu | Edited by: ReFlexPoison",
    
description "Improves messages that appear when player joins team",
    
version PLUGIN_VERSION,
    
url "http://www.sourcemod.net",
}

// ====[ FUNCTIONS ]===========================================================
public OnPluginStart()
{
    
CreateConVar("sm_jointeam_version"PLUGIN_VERSION"Improved Join Team Messages Version"FCVAR_REPLICATED FCVAR_PLUGIN FCVAR_SPONLY FCVAR_DONTRECORD FCVAR_NOTIFY);

    
cvarEnabled CreateConVar("sm_jointeam_enabled""1""Enable Improved Join Team Messages\n0 = Disabled\n1 = Enabled"FCVAR_PLUGINtrue0.0true1.0);
    
cvarBots CreateConVar("sm_jointeam_bots""0""Enable notifications of bot team changes\n0 = Disabled\n1 = Enabled"FCVAR_PLUGINtrue0.0true1.0);
    
cvarTeamplay FindConVar("mp_teamplay");

    
g_bEnabled GetConVarBool(cvarEnabled);
    
g_bBots GetConVarBool(cvarBots);
    
g_bTeamplay GetConVarBool(cvarTeamplay);

    
AutoExecConfig(true"plugin.improvedjoinmessages");

    
HookConVarChange(cvarEnabledCVarChange);
    
HookConVarChange(cvarBotsCVarChange);
    
HookConVarChange(cvarTeamplayCVarChange);

    
HookEvent("player_team"Event_PlayerTeamEventHookMode_Pre);

    
GetGameFolderName(g_strGamesizeof(g_strGame));
}

public 
CVarChange(Handle:hConvar, const String:strOldValue[], const String:strNewValue[])
{
    if(
hConvar == cvarEnabled)
        
g_bEnabled GetConVarBool(cvarEnabled);
    if(
hConvar == cvarBots)
        
g_bBots GetConVarBool(cvarBots);
    if(
hConvar == cvarTeamplay)
        
g_bTeamplay GetConVarBool(cvarTeamplay);
}

public 
Action:Event_PlayerTeam(Handle:hEvent, const String:strName[], bool:bDontBroadcast)
{
    if(!
g_bEnabled)
        return 
Plugin_Continue;

    new 
iClient GetClientOfUserId(GetEventInt(hEvent"userid"));
    if(!
IsValidClient(iClient))
        return 
Plugin_Continue;

    if(!
g_bBots && IsFakeClient(iClient))
        return 
Plugin_Continue;

    new 
iOldTeam GetEventInt(hEvent"oldteam");
    new 
iNewTeam GetEventInt(hEvent"team");

    
SetEventBroadcast(hEventtrue);

    
//Team Fortress 2
    //2 = RED (Red)
    //3 = BLU (Blue)
    
if(StrEqual(g_strGame"tf"))
    {
        switch(
iOldTeam)
        {
            case 
01:
            {
                switch(
iNewTeam)
                {
                    case 
0CPrintToChatAll("Player {gray}%N joined team {gray}Unassigned"iClient);
                    case 
1CPrintToChatAll("Player {gray}%N{default} joined team {gray}Spectators"iClient);
                    case 
2CPrintToChatAll("Player {gray}%N{default} joined team {red}RED"iClient);
                    case 
3CPrintToChatAll("Player {gray}%N{default} joined team {blue}BLU"iClient);
                }
            }
            case 
2:
            {
                switch(
iNewTeam)
                {
                    case 
0CPrintToChatAll("Player {red}%N joined team {gray}Unassigned"iClient);
                    case 
1CPrintToChatAll("Player {red}%N{default} joined team {gray}Spectators"iClient);
                    case 
2CPrintToChatAll("Player {red}%N{default} joined team {red}RED"iClient);
                    case 
3CPrintToChatAll("Player {red}%N{default} joined team {blue}BLU"iClient);
                }
            }
            case 
3:
            {
                switch(
iNewTeam)
                {
                    case 
0CPrintToChatAll("Player {blue}%N joined team {gray}Unassigned"iClient);
                    case 
1CPrintToChatAll("Player {blue}%N{default} joined team {gray}Spectators"iClient);
                    case 
2CPrintToChatAll("Player {blue}%N{default} joined team {red}RED"iClient);
                    case 
3CPrintToChatAll("Player {blue}%N{default} joined team {blue}BLU"iClient);
                }
            }
        }
    }
    
//Counter-Strike
    //2 = Terrorists (Red)
    //3 = Counter-Terrorists (Blue)
    
else if(StrEqual(g_strGame"cstrike"))
    {
        switch(
iOldTeam)
        {
            case 
01:
            {
                switch(
iNewTeam)
                {
                    case 
0CPrintToChatAll("Player {gray}%N joined team {gray}Unassigned"iClient);
                    case 
1CPrintToChatAll("Player {gray}%N{default} joined team {gray}Spectators"iClient);
                    case 
2CPrintToChatAll("Player {gray}%N{default} joined team {red}Terrorists"iClient);
                    case 
3CPrintToChatAll("Player {gray}%N{default} joined team {blue}Counter-Terrorists"iClient);
                }
            }
            case 
2:
            {
                switch(
iNewTeam)
                {
                    case 
0CPrintToChatAll("Player {red}%N joined team {gray}Unassigned"iClient);
                    case 
1CPrintToChatAll("Player {red}%N{default} joined team {gray}Spectators"iClient);
                    case 
2CPrintToChatAll("Player {red}%N{default} joined team {red}Terrorists"iClient);
                    case 
3CPrintToChatAll("Player {red}%N{default} joined team {blue}Counter-Terrorists"iClient);
                }
            }
            case 
3:
            {
                switch(
iNewTeam)
                {
                    case 
0CPrintToChatAll("Player {blue}%N joined team {gray}Unassigned"iClient);
                    case 
1CPrintToChatAll("Player {blue}%N{default} joined team {gray}Spectators"iClient);
                    case 
2CPrintToChatAll("Player {blue}%N{default} joined team {red}Terrorists"iClient);
                    case 
3CPrintToChatAll("Player {blue}%N{default} joined team {blue}Counter-Terrorists"iClient);
                }
            }
        }
    }
    
//Day of Defeat: Source
    //2 = Allies (Blue)
    //3 = Axis (Red)
    
else if(StrEqual(g_strGame"dod"))
    {
        switch(
iOldTeam)
        {
            case 
01:
            {
                switch(
iNewTeam)
                {
                    case 
0CPrintToChatAll("Player {gray}%N joined team {gray}Unassigned"iClient);
                    case 
1CPrintToChatAll("Player {gray}%N{default} joined team {gray}Spectators"iClient);
                    case 
2CPrintToChatAll("Player {gray}%N{default} joined team {blue}Allies"iClient);
                    case 
3CPrintToChatAll("Player {gray}%N{default} joined team {red}Axis"iClient);
                }
            }
            case 
2:
            {
                switch(
iNewTeam)
                {
                    case 
0CPrintToChatAll("Player {blue}%N joined team {gray}Unassigned"iClient);
                    case 
1CPrintToChatAll("Player {blue}%N{default} joined team {gray}Spectators"iClient);
                    case 
2CPrintToChatAll("Player {blue}%N{default} joined team {blue}Allies"iClient);
                    case 
3CPrintToChatAll("Player {blue}%N{default} joined team {red}Axis"iClient);
                }
            }
            case 
3:
            {
                switch(
iNewTeam)
                {
                    case 
0CPrintToChatAll("Player {red}%N joined team {gray}Unassigned"iClient);
                    case 
1CPrintToChatAll("Player {red}%N{default} joined team {gray}Spectators"iClient);
                    case 
2CPrintToChatAll("Player {red}%N{default} joined team {blue}Allies"iClient);
                    case 
3CPrintToChatAll("Player {red}%N{default} joined team {red}Axis"iClient);
                }
            }
        }
    }
    
//Half-Life 2: Deathmatch
    //2 = Rebels (Blue)
    //3 = Combine (Red)
    
else if(StrEqual(g_strGame"hl2mp") && g_bTeamplay)
    {
        switch(
iOldTeam)
        {
            case 
01:
            {
                switch(
iNewTeam)
                {
                    case 
0CPrintToChatAll("Player {gray}%N joined team {gray}Unassigned"iClient);
                    case 
1CPrintToChatAll("Player {gray}%N{default} joined team {gray}Spectators"iClient);
                    case 
2CPrintToChatAll("Player {gray}%N{default} joined team {blue}Rebels"iClient);
                    case 
3CPrintToChatAll("Player {gray}%N{default} joined team {red}Combine"iClient);
                }
            }
            case 
2:
            {
                switch(
iNewTeam)
                {
                    case 
0CPrintToChatAll("Player {blue}%N joined team {gray}Unassigned"iClient);
                    case 
1CPrintToChatAll("Player {blue}%N{default} joined team {gray}Spectators"iClient);
                    case 
2CPrintToChatAll("Player {blue}%N{default} joined team {blue}Rebels"iClient);
                    case 
3CPrintToChatAll("Player {blue}%N{default} joined team {red}Combine"iClient);
                }
            }
            case 
3:
            {
                switch(
iNewTeam)
                {
                    case 
0CPrintToChatAll("Player {red}%N joined team {gray}Unassigned"iClient);
                    case 
1CPrintToChatAll("Player {red}%N{default} joined team {gray}Spectators"iClient);
                    case 
2CPrintToChatAll("Player {red}%N{default} joined team {blue}Rebels"iClient);
                    case 
3CPrintToChatAll("Player {red}%N{default} joined team {red}Combine"iClient);
                }
            }
        }
    }
    
//Left 4 Dead
    //2 = Survivors (Blue)
    //3 = Infected (Red)
    
else if(StrEqual(g_strGame"left4dead"))
    {
        switch(
iOldTeam)
        {
            case 
01:
            {
                switch(
iNewTeam)
                {
                    case 
0CPrintToChatAll("Player {gray}%N joined team {gray}Unassigned"iClient);
                    case 
1CPrintToChatAll("Player {gray}%N{default} joined team {gray}Spectators"iClient);
                    case 
2CPrintToChatAll("Player {gray}%N{default} joined team {blue}Survivors"iClient);
                    case 
3CPrintToChatAll("Player {gray}%N{default} joined team {red}Infected"iClient);
                }
            }
            case 
2:
            {
                switch(
iNewTeam)
                {
                    case 
0CPrintToChatAll("Player {blue}%N joined team {gray}Unassigned"iClient);
                    case 
1CPrintToChatAll("Player {blue}%N{default} joined team {gray}Spectators"iClient);
                    case 
2CPrintToChatAll("Player {blue}%N{default} joined team {blue}Survivors"iClient);
                    case 
3CPrintToChatAll("Player {blue}%N{default} joined team {red}Infected"iClient);
                }
            }
            case 
3:
            {
                switch(
iNewTeam)
                {
                    case 
0CPrintToChatAll("Player {red}%N joined team {gray}Unassigned"iClient);
                    case 
1CPrintToChatAll("Player {red}%N{default} joined team {gray}Spectators"iClient);
                    case 
2CPrintToChatAll("Player {red}%N{default} joined team {blue}Survivors"iClient);
                    case 
3CPrintToChatAll("Player {red}%N{default} joined team {red}Infected"iClient);
                }
            }
        }
    }
    return 
Plugin_Continue;
}

// ====[ STOCKS ]==============================================================
stock bool:IsValidClient(iClientbool:bReplay true)
{
    if(
iClient <= || iClient MaxClients || !IsClientInGame(iClient))
        return 
false;
    if(
bReplay && (IsClientSourceTV(iClient) || IsClientReplay(iClient)))
        return 
false;
    return 
true;

Attached Files
File Type: sp Get Plugin or Get Source (team_join.sp - 156 views - 10.2 KB)
File Type: smx team_join.smx (9.9 KB, 157 views)

Last edited by ReFlexPoison; 12-31-2012 at 13:52.
ReFlexPoison is offline
Root_
Veteran Member
Join Date: Jan 2012
Location: ryssland
Old 12-31-2012 , 14:10   Re: [TF2] Improved Player Joined Team Messages v1.2
Reply With Quote #16

DoD:S Allies and Axis having different colors. Unfourdately they are not included in morecolors, so use \x074D7942 for allies and \x07FF4040 for axis instead
__________________


dodsplugins.com - Plugins and Resources for Day of Defeat
http://twitch.tv/zadroot
Root_ is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 12-31-2012 , 14:20   Re: [TF2] Improved Player Joined Team Messages v1.2
Reply With Quote #17

Quote:
Originally Posted by Root_ View Post
DoD:S Allies and Axis having different colors. Unfourdately they are not included in morecolors, so use \x074D7942 for allies and \x07FF4040 for axis instead
Post that in the More Colors thread so I remember to add it when I get home.

Edit: Nevermind, emailed it to myself.
__________________

Last edited by Dr. McKay; 12-31-2012 at 14:22.
Dr. McKay is offline
ReFlexPoison
☠☠☠
Join Date: Jul 2011
Location: ☠☠☠
Old 12-31-2012 , 14:23   Re: [TF2] Improved Player Joined Team Messages v1.2
Reply With Quote #18

Quote:
Originally Posted by Dr. McKay View Post
Post that in the More Colors thread so I remember to add it when I get home.

Edit: Nevermind, emailed it to myself.
Add the tf2 item quality colors from the wiki so i dun have to create them for new plugins <3
ReFlexPoison is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 12-31-2012 , 14:24   Re: [TF2] Improved Player Joined Team Messages v1.2
Reply With Quote #19

Quote:
Originally Posted by ReFlexPoison View Post
Add the tf2 item quality colors from the wiki so i dun have to create them for new plugins <3
Alright.
__________________
Dr. McKay is offline
milkkore
Member
Join Date: Mar 2012
Old 01-17-2013 , 21:05   Re: [TF2] Improved Player Joined Team Messages v1.2
Reply With Quote #20

Is it somehow possible to not have the messages shown when teams are switched/scrambled (in TF2)?

PS: I noticed in the screenshot of the plugin that there's a message announcing from which country a player is connecting, is that another plugin?

Last edited by milkkore; 01-17-2013 at 21:07.
milkkore is offline
Reply



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 05:06.


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