Иконка ресурса

Connect Announce 1.8

DexKekcuk #13

Участник
Сообщения
628
Реакции
69
Ну смотри в корневом файле .cfg я ничего не меняю, тоесть все настройки одинаковы и если я плагин перекомпилирую они не меняются.
1.Не изменяя плагин все показывало
2.Изменил плагин добавил букву С ,не пишет мне . А всем пишет.
3.Изменил плагин убрал букву С с данный строчки. Мне пишет и всем пишет, но без цветов.
 

Vetaldx dx

Участник
Сообщения
341
Реакции
28
Ну смотри в корневом файле .cfg я ничего не меняю, тоесть все настройки одинаковы и если я плагин перекомпилирую они не меняются.
1.Не изменяя плагин все показывало
2.Изменил плагин добавил букву С ,не пишет мне . А всем пишет.
3.Изменил плагин убрал букву С с данный строчки. Мне пишет и всем пишет, но без цветов.

Воспользуйся этим плагином, как по мне он лучше, и нет с ним не каких заморочек:boss:
http://hlmod.ru/forum/plaginy-dlya-sourcemod/31-cd-announcer-v2-3-beta.html
 

DexKekcuk #13

Участник
Сообщения
628
Реакции
69
Я конечно понимаю что не заморочек, но так скажем хочу этот плагин я его уже полностью все сделал, вот только в этом месте проблемка :(
И еще кто то писал про звук, он тоже не работает:

sm_ca_playdiscsound "1"
sm_ca_playdiscsoundfile "buttons\blip2.wav"
sm_ca_playsound "1"
sm_ca_playsoundfile "buttons\blip2.wav"
 
Последнее редактирование:

DexKekcuk #13

Участник
Сообщения
628
Реакции
69
Проблема с редактированием и отображением плагина.

Всем доброго времени суток.
Я взял для использования плагин http://hlmod.ru/forum/showthread.php?t=223
Сразу скажу как что я делал.
1.Скачал данный плагин.
2.Установил его на сервер.(Все работало замечательно. Я подключаюсь к серверу я вижу в чате что я подключился.)
3.Решил добавить библиотеку цветов Morecolors и GeoIPCity Так как при компиляции требовало.
4.Сделал все как надо. ( Где надо было подправил с PrintToChat на CprintToChat, и в одном месте с PrintToChatAll на CPrintToChatAll. Плагин работает игроки видят как я подключился и все цвета, но он перестал отображать самому мне что я подключился к серверу, настойки в .cfg я никаких не менял)
Вывод: Именно когда я меняю PrintToChatAll на CPrintToChatAll. Сразу перестает показывать мне что я подключился. А если поменять CPrintToChatAll на PrintToChatAll, тоесть вернуть именно эту строчку в данное положение то все становится на свои места, и я вижу что я подключась, но не видно цветов. Тоесть все написанное отображается в чате вместе с названием цветов.

Вот сами строчки именно где меняю. Но самое главное что именно CPrintToChatAll Все зависит от него, и не из-за настроек в cfg файле.
PHP:
/*****************************************************************


			P L U G I N   F U N C T I O N S


*****************************************************************/
//Thanks to Darkthrone (https://forums.alliedmods.net/member.php?u=54636)
bool:IsLanIP( String:src[16] )
{
	decl String:ip4[4][4];
	new ipnum;

	if(ExplodeString(src, ".", ip4, 4, 4) == 4)
	{
		ipnum = StringToInt(ip4[0])*65536 + StringToInt(ip4[1])*256 + StringToInt(ip4[2]);
		
		if((ipnum >= 655360 && ipnum < 655360+65535) || (ipnum >= 11276288 && ipnum < 11276288+4095) || (ipnum >= 12625920 && ipnum < 12625920+255))
		{
			return true;
		}
	}

	return false;
}

PrintFormattedMessageToAll( String:rawmsg[301], client )
{
	decl String:message[301];
	
	GetFormattedMessage( rawmsg, client, message, sizeof(message) );
	
	CPrintToChatAll( "%s", message );
}

PrintFormattedMessageToAdmins( String:rawmsg[301], client )
{
	decl String:message[301];
	
	GetFormattedMessage( rawmsg, client, message, sizeof(message) );
	
	for (new i = 1; i <= GetMaxClients(); i++)
	{
		if( IsClientInGame(i) && CheckCommandAccess( i, "", ADMFLAG_GENERIC, true ) )
		{
			CPrintToChat(i, "%s", message);
		}
	}
}

PrintFormattedMsgToNonAdmins( String:rawmsg[301], client )
{
	decl String:message[301];
	
	GetFormattedMessage( rawmsg, client, message, sizeof(message) );
	
	for (new i = 1; i <= GetMaxClients(); i++)
	{
		if( IsClientInGame(i) && !CheckCommandAccess( i, "", ADMFLAG_GENERIC, true ) )
		{
			CPrintToChat(i, "%s", message);
		}
	}
}

//GetFormattedMessage - based on code from the DJ Tsunami plugin Advertisements - http://forums.alliedmods.net/showthread.php?p=592536
GetFormattedMessage( String:rawmsg[301], client, String:outbuffer[], outbuffersize )
{
	decl String:buffer[256];
	decl String:ip[16];
	decl String:city[46];
	decl String:region[46];
	decl String:country[46];
	decl String:ccode[3];
	decl String:ccode3[4];
	decl String:sColor[4];
	decl String:sPlayerAdmin[32];
	decl String:sPlayerPublic[32];
	new bool:bIsLanIp;
	
	decl AdminId:aid;
	
	if( client > -1 )
	{
		GetClientIP(client, ip, sizeof(ip)); 
		
		//detect LAN ip
		bIsLanIp = IsLanIP( ip );
		
		// Using GeoIPCity extension...
		if ( g_UseGeoIPCity )
		{
			if( !GeoipGetRecord( ip, city, region, country, ccode, ccode3 ) )
			{
				if( bIsLanIp )
				{
					Format( city, sizeof(city), "%T", "LAN City Desc", LANG_SERVER );
					Format( region, sizeof(region), "%T", "LAN Region Desc", LANG_SERVER );
					Format( country, sizeof(country), "%T", "LAN Country Desc", LANG_SERVER );
					Format( ccode, sizeof(ccode), "%T", "LAN Country Short", LANG_SERVER );
					Format( ccode3, sizeof(ccode3), "%T", "LAN Country Short 3", LANG_SERVER );
				}
				else
				{
					Format( city, sizeof(city), "%T", "Unknown City Desc", LANG_SERVER );
					Format( region, sizeof(region), "%T", "Unknown Region Desc", LANG_SERVER );
					Format( country, sizeof(country), "%T", "Unknown Country Desc", LANG_SERVER );
					Format( ccode, sizeof(ccode), "%T", "Unknown Country Short", LANG_SERVER );
					Format( ccode3, sizeof(ccode3), "%T", "Unknown Country Short 3", LANG_SERVER );
				}
			}
		}
		else // Using GeoIP default extension...
		{
			if( !GeoipCode2(ip, ccode) )
			{
				if( bIsLanIp )
				{
					Format( ccode, sizeof(ccode), "%T", "LAN Country Short", LANG_SERVER );
				}
				else
				{
					Format( ccode, sizeof(ccode), "%T", "Unknown Country Short", LANG_SERVER );
				}
			}
			
			if( !GeoipCountry(ip, country, sizeof(country)) )
			{
				if( bIsLanIp )
				{
					Format( country, sizeof(country), "%T", "LAN Country Desc", LANG_SERVER );
				}
				else
				{
					Format( country, sizeof(country), "%T", "Unknown Country Desc", LANG_SERVER );
				}
			}
			
			// Since the GeoIPCity extension isn't loaded, we don't know the city or region.
			if( bIsLanIp )
			{
				Format( city, sizeof(city), "%T", "LAN City Desc", LANG_SERVER );
				Format( region, sizeof(region), "%T", "LAN Region Desc", LANG_SERVER );
				Format( ccode3, sizeof(ccode3), "%T", "LAN Country Short 3", LANG_SERVER );
			}
			else
			{
				Format( city, sizeof(city), "%T", "Unknown City Desc", LANG_SERVER );
				Format( region, sizeof(region), "%T", "Unknown Region Desc", LANG_SERVER );
				Format( ccode3, sizeof(ccode3), "%T", "Unknown Country Short 3", LANG_SERVER );
			}
		}
		
		// Fallback for unknown/empty location strings
		if( StrEqual( city, "" ) )
		{
			Format( city, sizeof(city), "%T", "Unknown City Desc", LANG_SERVER );
		}
		
		if( StrEqual( region, "" ) )
		{
			Format( region, sizeof(region), "%T", "Unknown Region Desc", LANG_SERVER );
		}
		
		if( StrEqual( country, "" ) )
		{
			Format( country, sizeof(country), "%T", "Unknown Country Desc", LANG_SERVER );
		}
		
		if( StrEqual( ccode, "" ) )
		{
			Format( ccode, sizeof(ccode), "%T", "Unknown Country Short", LANG_SERVER );
		}
		
		if( StrEqual( ccode3, "" ) )
		{
			Format( ccode3, sizeof(ccode3), "%T", "Unknown Country Short 3", LANG_SERVER );
		}
		
		// Add "The" in front of certain countries
		if( StrContains( country, "United", false ) != -1 || 
			StrContains( country, "Republic", false ) != -1 || 
			StrContains( country, "Federation", false ) != -1 || 
			StrContains( country, "Island", false ) != -1 || 
			StrContains( country, "Netherlands", false ) != -1 || 
			StrContains( country, "Isle", false ) != -1 || 
			StrContains( country, "Bahamas", false ) != -1 || 
			StrContains( country, "Maldives", false ) != -1 || 
			StrContains( country, "Philippines", false ) != -1 || 
			StrContains( country, "Vatican", false ) != -1 )
		{
			Format( country, sizeof(country), "The %s", country );
		}
		
		if (StrContains(rawmsg, "{PLAYERNAME}") != -1) 
		{
			GetClientName(client, buffer, sizeof(buffer));
			ReplaceString(rawmsg, sizeof(rawmsg), "{PLAYERNAME}", buffer);
		}

		if (StrContains(rawmsg, "{STEAMID}") != -1) 
		{
			GetClientAuthString(client, buffer, sizeof(buffer));
			ReplaceString(rawmsg, sizeof(rawmsg), "{STEAMID}", buffer);
		}
		
		if (StrContains(rawmsg, "{PLAYERCOUNTRY}") != -1 ) 
		{
			ReplaceString(rawmsg, sizeof(rawmsg), "{PLAYERCOUNTRY}", country);
		}
		
		if (StrContains(rawmsg, "{PLAYERCOUNTRYSHORT}") != -1 ) 
		{
			ReplaceString(rawmsg, sizeof(rawmsg), "{PLAYERCOUNTRYSHORT}", ccode);
		}
		
		if (StrContains(rawmsg, "{PLAYERCOUNTRYSHORT3}") != -1 ) 
		{
			ReplaceString(rawmsg, sizeof(rawmsg), "{PLAYERCOUNTRYSHORT3}", ccode3);
		}
		
		if (StrContains(rawmsg, "{PLAYERCITY}") != -1 ) 
		{
			ReplaceString(rawmsg, sizeof(rawmsg), "{PLAYERCITY}", city);
		}
		
		if (StrContains(rawmsg, "{PLAYERREGION}") != -1 ) 
		{
			ReplaceString(rawmsg, sizeof(rawmsg), "{PLAYERREGION}", region);
		}
		
		if (StrContains(rawmsg, "{PLAYERIP}") != -1 ) 
		{
			ReplaceString(rawmsg, sizeof(rawmsg), "{PLAYERIP}", ip);
		}
		
		if( StrContains(rawmsg, "{PLAYERTYPE}") != -1 && GetConVarInt(g_CvarConnectDisplayType) == 1  )
		{
			aid = GetUserAdmin( client );
			
			if( GetAdminFlag( aid, Admin_Generic ) )
			{
				Format( sPlayerAdmin, sizeof(sPlayerAdmin), "%T", "CA Admin", LANG_SERVER );
				ReplaceString(rawmsg, sizeof(rawmsg), "{PLAYERTYPE}", sPlayerAdmin);
			}
			else
			{
				Format( sPlayerPublic, sizeof(sPlayerPublic), "%T", "CA Public", LANG_SERVER );
				ReplaceString(rawmsg, sizeof(rawmsg), "{PLAYERTYPE}", sPlayerPublic);
			}
		}
	}
		
	for (new c = 0; c < sizeof(g_iSColors); c++) 
	{
		if ( StrContains(rawmsg, g_sSColors[c]) != -1 ) 
		{			
			Format(sColor, sizeof(sColor), "%c", g_iSColors[c]);
			ReplaceString(rawmsg, sizeof(rawmsg), g_sSColors[c], sColor);
		}
	}
	
	Format( outbuffer, outbuffersize, "%s", rawmsg );
}

PHP:
/**
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License, version 3.0, as published by the
 * Free Software Foundation.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * As a special exception, AlliedModders LLC gives you permission to link the
 * code of this program (as well as its derivative works) to "Half-Life 2," the
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
 * by the Valve Corporation.  You must obey the GNU General Public License in
 * all respects for all other code used.  Additionally, AlliedModders LLC grants
 * this exception to all derivative works.  AlliedModders LLC defines further
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
 * or <http://www.sourcemod.net/license.php>.
 *
 */


#pragma semicolon 1

#include <sourcemod>
#include <sdktools>
#include <geoip>
#include <morecolors>
#undef REQUIRE_EXTENSIONS
#include <geoipcity>
#undef REQUIRE_PLUGIN
#include <adminmenu>

#define VERSION "1.6"

/*****************************************************************


			G L O B A L   V A R S


*****************************************************************/
static g_iSColors[5]             = {1,               3,              4,         6,			5};
static String:g_sSColors[5][13]  = {"{DEFAULT}",     "{LIGHTGREEN}", "{GREEN}", "{YELLOW}",	"{OLIVE}"};

new Handle:hTopMenu = INVALID_HANDLE;
new String:g_fileset[128];
new String:g_filesettings[128];
new bool:g_UseGeoIPCity = false;

new Handle:g_CvarConnectDisplayType = INVALID_HANDLE;
/*****************************************************************


			L I B R A R Y   I N C L U D E S


*****************************************************************/
#include "cannounce/countryshow.sp"
#include "cannounce/joinmsg.sp"
#include "cannounce/geolist.sp"
#include "cannounce/suppress.sp"


/*****************************************************************


			P L U G I N   I N F O


*****************************************************************/
public Plugin:myinfo =
{
	name = "Connect Announce",
	author = "Arg!",
	description = "Replacement of default player connection message, allows for custom connection messages",
	version = VERSION,
	url = "http://forums.alliedmods.net/showthread.php?t=77306"
};



/*****************************************************************


			F O R W A R D   P U B L I C S


*****************************************************************/
public OnPluginStart()
{
	LoadTranslations("common.phrases");
	LoadTranslations("cannounce.phrases");
	
	CreateConVar("sm_cannounce_version", VERSION, "Connect announce replacement", FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD);

	g_CvarConnectDisplayType = CreateConVar("sm_ca_connectdisplaytype", "1", "[1|0] if 1 then displays connect message after admin check and allows the {PLAYERTYPE} placeholder. If 0 displays connect message on client auth (earlier) and disables the {PLAYERTYPE} placeholder");
	
	BuildPath(Path_SM, g_fileset, 128, "data/cannounce_messages.txt");
	BuildPath(Path_SM, g_filesettings, 128, "data/cannounce_settings.txt");
	
	//event hooks
	HookEvent("player_disconnect", event_PlayerDisconnect, EventHookMode_Pre);
	
	
	//country show
	SetupCountryShow();
	
	//custom join msg
	SetupJoinMsg();
	
	//geographical player list
	SetupGeoList();
	
	//suppress standard connection message
	SetupSuppress();
	
	//Account for late loading
	new Handle:topmenu;
	if (LibraryExists("adminmenu") && ((topmenu = GetAdminTopMenu()) != INVALID_HANDLE))
	{
		OnAdminMenuReady(topmenu);
	}
	
	// Check if we have GeoIPCity.ext loaded
	g_UseGeoIPCity = LibraryExists("GeoIPCity");
	
	//create config file if not exists
	AutoExecConfig(true, "cannounce");
}

public OnMapStart()
{
	//get, precache and set downloads for player custom sound files
	LoadSoundFilesCustomPlayer();
		
	//precahce and set downloads for sounds files for all players
	LoadSoundFilesAll();
	
	
	OnMapStart_JoinMsg();
}

public OnClientAuthorized(client, const String:auth[])
{
	if( GetConVarInt(g_CvarConnectDisplayType) == 0 )
	{
		if( !IsFakeClient(client) && GetClientCount(true) < MaxClients )
		{
			OnPostAdminCheck_CountryShow(client);
		
			OnPostAdminCheck_JoinMsg(auth);
		}
	}
}

public OnClientPostAdminCheck(client)
{
	decl String:auth[32];
	
	if( GetConVarInt(g_CvarConnectDisplayType) == 1 )
	{
		GetClientAuthString( client, auth, sizeof(auth) );
		
		if( !IsFakeClient(client) && GetClientCount(true) < MaxClients )
		{
			OnPostAdminCheck_CountryShow(client);
		
			OnPostAdminCheck_JoinMsg(auth);
		}
	}	
}

public OnPluginEnd()
{		
	OnPluginEnd_JoinMsg();
	
	OnPluginEnd_CountryShow();
}


public OnAdminMenuReady(Handle:topmenu)
{
	//Block us from being called twice
	if (topmenu == hTopMenu)
	{
		return;
	}
	
	//Save the Handle
	hTopMenu = topmenu;
	
	
	OnAdminMenuReady_JoinMsg();	
}


public OnLibraryRemoved(const String:name[])
{
	//remove this menu handle if adminmenu plugin unloaded
	if (strcmp(name, "adminmenu") == 0)
	{
		hTopMenu = INVALID_HANDLE;
	}
	
	// Was the GeoIPCity extension removed?
	if(StrEqual(name, "GeoIPCity"))
		g_UseGeoIPCity = false;
}


public OnLibraryAdded(const String:name[])
{
	// Is the GeoIPCity extension running?
	if(StrEqual(name, "GeoIPCity"))
		g_UseGeoIPCity = true;
}


/****************************************************************


			C A L L B A C K   F U N C T I O N S


****************************************************************/
public Action:event_PlayerDisconnect(Handle:event, const String:name[], bool:dontBroadcast)
{
	new client = GetClientOfUserId(GetEventInt(event, "userid"));
	
	if( client && !IsFakeClient(client) && !dontBroadcast )
	{
		event_PlayerDisc_CountryShow(event, name, dontBroadcast);
		
		OnClientDisconnect_JoinMsg();
	}
	
	
	return event_PlayerDisconnect_Suppress( event, name, dontBroadcast );
}


/*****************************************************************


			P L U G I N   F U N C T I O N S


*****************************************************************/
//Thanks to Darkthrone (https://forums.alliedmods.net/member.php?u=54636)
bool:IsLanIP( String:src[16] )
{
	decl String:ip4[4][4];
	new ipnum;

	if(ExplodeString(src, ".", ip4, 4, 4) == 4)
	{
		ipnum = StringToInt(ip4[0])*65536 + StringToInt(ip4[1])*256 + StringToInt(ip4[2]);
		
		if((ipnum >= 655360 && ipnum < 655360+65535) || (ipnum >= 11276288 && ipnum < 11276288+4095) || (ipnum >= 12625920 && ipnum < 12625920+255))
		{
			return true;
		}
	}

	return false;
}

PrintFormattedMessageToAll( String:rawmsg[301], client )
{
	decl String:message[301];
	
	GetFormattedMessage( rawmsg, client, message, sizeof(message) );
	
	CPrintToChatAll( "%s", message );
}

PrintFormattedMessageToAdmins( String:rawmsg[301], client )
{
	decl String:message[301];
	
	GetFormattedMessage( rawmsg, client, message, sizeof(message) );
	
	for (new i = 1; i <= GetMaxClients(); i++)
	{
		if( IsClientInGame(i) && CheckCommandAccess( i, "", ADMFLAG_GENERIC, true ) )
		{
			CPrintToChat(i, "%s", message);
		}
	}
}

PrintFormattedMsgToNonAdmins( String:rawmsg[301], client )
{
	decl String:message[301];
	
	GetFormattedMessage( rawmsg, client, message, sizeof(message) );
	
	for (new i = 1; i <= GetMaxClients(); i++)
	{
		if( IsClientInGame(i) && !CheckCommandAccess( i, "", ADMFLAG_GENERIC, true ) )
		{
			CPrintToChat(i, "%s", message);
		}
	}
}

//GetFormattedMessage - based on code from the DJ Tsunami plugin Advertisements - http://forums.alliedmods.net/showthread.php?p=592536
GetFormattedMessage( String:rawmsg[301], client, String:outbuffer[], outbuffersize )
{
	decl String:buffer[256];
	decl String:ip[16];
	decl String:city[46];
	decl String:region[46];
	decl String:country[46];
	decl String:ccode[3];
	decl String:ccode3[4];
	decl String:sColor[4];
	decl String:sPlayerAdmin[32];
	decl String:sPlayerPublic[32];
	new bool:bIsLanIp;
	
	decl AdminId:aid;
	
	if( client > -1 )
	{
		GetClientIP(client, ip, sizeof(ip)); 
		
		//detect LAN ip
		bIsLanIp = IsLanIP( ip );
		
		// Using GeoIPCity extension...
		if ( g_UseGeoIPCity )
		{
			if( !GeoipGetRecord( ip, city, region, country, ccode, ccode3 ) )
			{
				if( bIsLanIp )
				{
					Format( city, sizeof(city), "%T", "LAN City Desc", LANG_SERVER );
					Format( region, sizeof(region), "%T", "LAN Region Desc", LANG_SERVER );
					Format( country, sizeof(country), "%T", "LAN Country Desc", LANG_SERVER );
					Format( ccode, sizeof(ccode), "%T", "LAN Country Short", LANG_SERVER );
					Format( ccode3, sizeof(ccode3), "%T", "LAN Country Short 3", LANG_SERVER );
				}
				else
				{
					Format( city, sizeof(city), "%T", "Unknown City Desc", LANG_SERVER );
					Format( region, sizeof(region), "%T", "Unknown Region Desc", LANG_SERVER );
					Format( country, sizeof(country), "%T", "Unknown Country Desc", LANG_SERVER );
					Format( ccode, sizeof(ccode), "%T", "Unknown Country Short", LANG_SERVER );
					Format( ccode3, sizeof(ccode3), "%T", "Unknown Country Short 3", LANG_SERVER );
				}
			}
		}
		else // Using GeoIP default extension...
		{
			if( !GeoipCode2(ip, ccode) )
			{
				if( bIsLanIp )
				{
					Format( ccode, sizeof(ccode), "%T", "LAN Country Short", LANG_SERVER );
				}
				else
				{
					Format( ccode, sizeof(ccode), "%T", "Unknown Country Short", LANG_SERVER );
				}
			}
			
			if( !GeoipCountry(ip, country, sizeof(country)) )
			{
				if( bIsLanIp )
				{
					Format( country, sizeof(country), "%T", "LAN Country Desc", LANG_SERVER );
				}
				else
				{
					Format( country, sizeof(country), "%T", "Unknown Country Desc", LANG_SERVER );
				}
			}
			
			// Since the GeoIPCity extension isn't loaded, we don't know the city or region.
			if( bIsLanIp )
			{
				Format( city, sizeof(city), "%T", "LAN City Desc", LANG_SERVER );
				Format( region, sizeof(region), "%T", "LAN Region Desc", LANG_SERVER );
				Format( ccode3, sizeof(ccode3), "%T", "LAN Country Short 3", LANG_SERVER );
			}
			else
			{
				Format( city, sizeof(city), "%T", "Unknown City Desc", LANG_SERVER );
				Format( region, sizeof(region), "%T", "Unknown Region Desc", LANG_SERVER );
				Format( ccode3, sizeof(ccode3), "%T", "Unknown Country Short 3", LANG_SERVER );
			}
		}
		
		// Fallback for unknown/empty location strings
		if( StrEqual( city, "" ) )
		{
			Format( city, sizeof(city), "%T", "Unknown City Desc", LANG_SERVER );
		}
		
		if( StrEqual( region, "" ) )
		{
			Format( region, sizeof(region), "%T", "Unknown Region Desc", LANG_SERVER );
		}
		
		if( StrEqual( country, "" ) )
		{
			Format( country, sizeof(country), "%T", "Unknown Country Desc", LANG_SERVER );
		}
		
		if( StrEqual( ccode, "" ) )
		{
			Format( ccode, sizeof(ccode), "%T", "Unknown Country Short", LANG_SERVER );
		}
		
		if( StrEqual( ccode3, "" ) )
		{
			Format( ccode3, sizeof(ccode3), "%T", "Unknown Country Short 3", LANG_SERVER );
		}
		
		// Add "The" in front of certain countries
		if( StrContains( country, "United", false ) != -1 || 
			StrContains( country, "Republic", false ) != -1 || 
			StrContains( country, "Federation", false ) != -1 || 
			StrContains( country, "Island", false ) != -1 || 
			StrContains( country, "Netherlands", false ) != -1 || 
			StrContains( country, "Isle", false ) != -1 || 
			StrContains( country, "Bahamas", false ) != -1 || 
			StrContains( country, "Maldives", false ) != -1 || 
			StrContains( country, "Philippines", false ) != -1 || 
			StrContains( country, "Vatican", false ) != -1 )
		{
			Format( country, sizeof(country), "The %s", country );
		}
		
		if (StrContains(rawmsg, "{PLAYERNAME}") != -1) 
		{
			GetClientName(client, buffer, sizeof(buffer));
			ReplaceString(rawmsg, sizeof(rawmsg), "{PLAYERNAME}", buffer);
		}

		if (StrContains(rawmsg, "{STEAMID}") != -1) 
		{
			GetClientAuthString(client, buffer, sizeof(buffer));
			ReplaceString(rawmsg, sizeof(rawmsg), "{STEAMID}", buffer);
		}
		
		if (StrContains(rawmsg, "{PLAYERCOUNTRY}") != -1 ) 
		{
			ReplaceString(rawmsg, sizeof(rawmsg), "{PLAYERCOUNTRY}", country);
		}
		
		if (StrContains(rawmsg, "{PLAYERCOUNTRYSHORT}") != -1 ) 
		{
			ReplaceString(rawmsg, sizeof(rawmsg), "{PLAYERCOUNTRYSHORT}", ccode);
		}
		
		if (StrContains(rawmsg, "{PLAYERCOUNTRYSHORT3}") != -1 ) 
		{
			ReplaceString(rawmsg, sizeof(rawmsg), "{PLAYERCOUNTRYSHORT3}", ccode3);
		}
		
		if (StrContains(rawmsg, "{PLAYERCITY}") != -1 ) 
		{
			ReplaceString(rawmsg, sizeof(rawmsg), "{PLAYERCITY}", city);
		}
		
		if (StrContains(rawmsg, "{PLAYERREGION}") != -1 ) 
		{
			ReplaceString(rawmsg, sizeof(rawmsg), "{PLAYERREGION}", region);
		}
		
		if (StrContains(rawmsg, "{PLAYERIP}") != -1 ) 
		{
			ReplaceString(rawmsg, sizeof(rawmsg), "{PLAYERIP}", ip);
		}
		
		if( StrContains(rawmsg, "{PLAYERTYPE}") != -1 && GetConVarInt(g_CvarConnectDisplayType) == 1  )
		{
			aid = GetUserAdmin( client );
			
			if( GetAdminFlag( aid, Admin_Generic ) )
			{
				Format( sPlayerAdmin, sizeof(sPlayerAdmin), "%T", "CA Admin", LANG_SERVER );
				ReplaceString(rawmsg, sizeof(rawmsg), "{PLAYERTYPE}", sPlayerAdmin);
			}
			else
			{
				Format( sPlayerPublic, sizeof(sPlayerPublic), "%T", "CA Public", LANG_SERVER );
				ReplaceString(rawmsg, sizeof(rawmsg), "{PLAYERTYPE}", sPlayerPublic);
			}
		}
	}
		
	for (new c = 0; c < sizeof(g_iSColors); c++) 
	{
		if ( StrContains(rawmsg, g_sSColors[c]) != -1 ) 
		{			
			Format(sColor, sizeof(sColor), "%c", g_iSColors[c]);
			ReplaceString(rawmsg, sizeof(rawmsg), g_sSColors[c], sColor);
		}
	}
	
	Format( outbuffer, outbuffersize, "%s", rawmsg );
}
 
Последнее редактирование:

Konstantin

Участник
Сообщения
1,775
Реакции
759
Re: Проблема с редактированием и отображением плагина.

По-моему, нужно добавлять "С" только к PrintToChatAll( "%s", message ); на 278-й строке.

################

Ну, тогда не знаю... Покажи полностью исходник (выложи под спойлер в первый пост)?
 
Последнее редактирование:

DexKekcuk #13

Участник
Сообщения
628
Реакции
69
Re: Проблема с редактированием и отображением плагина.

Ну так вот я о том же, если я добавляю, то все видят что я подключаюсь, но я сам не вижу что я подключаюсь, а если "C" Убрать то я вижу что я подключился но библиотек цветов не работает. Вот в чем проблема, я хочу чтоб я видел что я подкючаюсь.

Добавлено через 2 минуты
Ну я щас попробую!)

Добавлено через 7 минут
Нет Все равно не видно, если убераю с двух других И оставляю PrintToChat а к PrintToChatAll подставляю C Все равно не видно.

Добавлено через 2 часа 4 минуты
Ну зачем объединили темы, относится он сюда ну и пусть, я попросил помощи сюда вчера так никто и не зашел кроме 2 человек. Может так бы помогли. Тема UP, помогите.
 
Последнее редактирование:

Серый™

CS:S Server
Сообщения
2,925
Реакции
1,376
Вот полностью вырезанная версия от хлама(не оптимизировал). Логи оставил.
Две версии, обычная и просто с подключённой библиотекой morecolors(будет время переделаю).
 

Вложения

  • cannounce.sp
    17.3 КБ · Просмотры: 39
  • cannounce_morecolors.sp
    16.9 КБ · Просмотры: 50

Sharik109

Участник
Сообщения
17
Реакции
2
Как сделать так? например
Игрок подключился
SteamID: v76v56v
Что бы так же было в строчки?
 

R1KO

fuck society
Сообщения
9,457
Реакции
7,786
Sharik109, \n перенос
 
Сообщения
2,587
Реакции
1,343
Если бы вы тему читали повнимательнее - то увидели бы, что это не будет работать, уже проверяли.
 

R1KO

fuck society
Сообщения
9,457
Реакции
7,786
В cannounce.sp
находим

PHP:
GetFormattedMessage( String:rawmsg[301], client, String:outbuffer[], outbuffersize )
{

И перед
PHP:
if (StrContains(rawmsg, "{PLAYERNAME}") != -1) 
		{
			GetClientName(client, buffer, sizeof(buffer));
			ReplaceString(rawmsg, sizeof(rawmsg), "{PLAYERNAME}", buffer);
		}
Вставляем

PHP:
ReplaceString(rawmsg, sizeof(rawmsg), "\\n", "\n", false);

Потом компилим и все дела..

\n будет работать
 

Sharik109

Участник
Сообщения
17
Реакции
2
В cannounce.sp
находим

PHP:
GetFormattedMessage( String:rawmsg[301], client, String:outbuffer[], outbuffersize )
{

И перед
PHP:
if (StrContains(rawmsg, "{PLAYERNAME}") != -1) 
		{
			GetClientName(client, buffer, sizeof(buffer));
			ReplaceString(rawmsg, sizeof(rawmsg), "{PLAYERNAME}", buffer);
		}
Вставляем

PHP:
ReplaceString(rawmsg, sizeof(rawmsg), "\\n", "\n", false);

Потом компилим и все дела..

\n будет работать

Не компилируеться выдает ошибку.
 

R1KO

fuck society
Сообщения
9,457
Реакции
7,786
Sharik109, ну нет расширения. Это уже твоя проблема. Нужно найти все файлы для компиляции
 

R1KO

fuck society
Сообщения
9,457
Реакции
7,786
Sharik109, конкретно ошибку напиши
 
Сообщения
4
Реакции
0
Доброго времени суток, помогите мне
<FAILED> file "geoipcity.ext.so": /game/cstrike/addons/sourcemod/extensions/geoipcity.ext.so: cannot open shared object file: No such file or directory
В чем проблема?
 
Сверху Снизу