Съобщенията излизат двойно в чата

Въпроси и проблеми свързани с AMXModX.
Аватар
Lethality
Извън линия
VHE Mapper
VHE Mapper
Мнения: 211
Регистриран на: 06 Яну 2020, 15:41
Местоположение: Германия
Се отблагодари: 34 пъти
Получена благодарност: 50 пъти
Обратна връзка:

Съобщенията излизат двойно в чата

Мнение от Lethality » 26 Дек 2020, 21:04

Здравейте,
ползвам chatmanger и adminchat от OcixCrom и след като сложих Knife Manager v3.3 чатът започна да излиза двойно. Бихте ли ми помогнали на какво се дължи това?

Благодаря!
331.png
331.png (23.15 KiB) Преглеждано 1372 пъти
331.png
331.png (23.15 KiB) Преглеждано 1372 пъти

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

Съобщенията излизат двойно в чата

Мнение от OciXCrom » 26 Дек 2020, 21:13

На ползване 2 плъгина които контролират чата. Колкото си спомням въпросният Knife Manager имаше опция за чата. Изключи я или премахни я.

Аватар
Lethality
Извън линия
VHE Mapper
VHE Mapper
Мнения: 211
Регистриран на: 06 Яну 2020, 15:41
Местоположение: Германия
Се отблагодари: 34 пъти
Получена благодарност: 50 пъти
Обратна връзка:

Съобщенията излизат двойно в чата

Мнение от Lethality » 26 Дек 2020, 21:17

Това се опитах да открия, но не виждам в кода, кое точно трябва да се спре, за да се предотврати този проблем. Това е кодът.

Код за потвърждение: Избери целия код

/*

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	
	AMX Mod X Script
	
	Plugin: Knife Management
	Version: 3.3
	Author: Jon
        
	Link: http://forums.alliedmods.net/showthread.php?t=100506
        
        This program is free software; you can redistribute it and/or modify it
        under the terms of the GNU General Public License as published by the
        Free Software Foundation; either version 2 of the License, or (at
        your option) any later version.

        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, write to the Free Software Foundation,
        Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

        In addition, as a special exception, the author gives permission to
        link the code of this program with the Half-Life Game Engine ("HL
        Engine") and Modified Game Libraries ("MODs") developed by Valve,
        L.L.C ("Valve"). You must obey the GNU General Public License in all
        respects for all of the code used other than the HL Engine and MODs
        from Valve. If you modify this file, you may extend this exception
        to your version of the file, but you are not obligated to do so. If
        you do not wish to do so, delete this exception statement from your
        version.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	
	_ Features (most of them are cvar controlled) _
	
	* Strip weapons and block buying
	* Respawn mode
	* No slashing on acermaps
	* Disable spraying on wires maps
	* 3rd-person camera
	* Free hit system
	* Check HP on 35hp and 1hp maps (as it sometimes bugs)
	* Ghost chat (dead and living can read each other's chat messages)
	
*/

#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <engine>
#include <fun>

#define PLUGIN "Knife Management"
#define VERSION "3.3"
#define AUTHOR "Jon"

#define InTeam(%1) ( CS_TEAM_UNASSIGNED < cs_get_user_team(%1) < CS_TEAM_SPECTATOR ) 

// - // - // - // - // - // - // - //

enum _:MapTypes ( <<= 1 ) 
{
	TYPE_1HP = 1, TYPE_35HP, TYPE_ACER, TYPE_WIRE
}

enum _:Timers 
{ 
	Float:RESPAWN, Float:NEXTUSE, Float:LASTUSE 
}

const g_iKeysFreeHitMenu = MENU_KEY_1 | MENU_KEY_2;
const TASK_CHECKMENU = 3491;
const TASK_CHECKHEALTH = 3488;

new g_pRespawn;
new g_pFreeHits;
new g_pCamera;
new g_pRemoveBomb;
new g_pStabAcerMaps;
new g_pGhostChat;

new g_iMapType;
new g_iMsgSayText;
new g_iButtonCount[ 33 ];
new g_iFreeHitCount[ 33 ];
new g_iRequester[ 33 ];
new g_szFreeHitMenu[ 128 ];

new Float:g_fTimers[ 33 ][ Timers ];

new bool:g_bSpawned[ 33 ];
new bool:g_bCamera[ 33 ];

// - // - // - // - // - // - // - //

public plugin_precache()
{
	precache_model( "models/rpgrocket.mdl" );
	
	new iEnt = create_entity( "info_map_parameters" );
	DispatchKeyValue( iEnt, "buying", "3" );
	DispatchSpawn( iEnt );
	
	RegisterHam( Ham_Spawn, "armoury_entity", "FwdArmouryEntitySpawn" );
}

public plugin_init()
{
	register_plugin( PLUGIN, VERSION, AUTHOR );
	register_cvar( "km_version", VERSION, FCVAR_SERVER | FCVAR_SPONLY );
	
	g_pRespawn = register_cvar( "km_respawn", "0" );
	g_pFreeHits = register_cvar( "km_freehits", "2" );
	g_pCamera = register_cvar( "km_camera", "1" );
	g_pRemoveBomb = register_cvar( "km_removebomb", "0" );
	g_pStabAcerMaps = register_cvar( "km_stabacer", "0" );
	g_pGhostChat = register_cvar( "km_ghostchat", "1" );
	
	g_iMsgSayText = get_user_msgid( "SayText" );
	
	register_impulse( 201, "FwdSprayImpulse" );

	RegisterHam( Ham_Weapon_PrimaryAttack, "weapon_knife", "FwdKnifePrimaryAttack" );
	RegisterHam( Ham_Spawn, "player", "FwdPlayerSpawnPost", 1 );
	RegisterHam( Ham_Killed, "player", "FwdPlayerKilled" );
	RegisterHam( Ham_ObjectCaps, "player", "FwdObjectCaps" );
	
	register_clcmd( "say", "CmdSay" );
	register_clcmd( "say /cam", "CmdCamera" );
	register_clcmd( "say /camera", "CmdCamera" );
	register_clcmd( "say /respawn", "CmdRespawn" );
	
	if( get_pcvar_num( g_pRemoveBomb ) )
	{
		remove_entity_name( "func_bomb_target" );
		remove_entity_name( "info_bomb_target" );
	}
	
	// - Because the block buying method doesn't work the first round
	server_cmd( "sv_restart 1" ); 
}	

public plugin_cfg()
{
	new szMap[ 33 ];
	get_mapname( szMap, 32 );
	
	if( containi( szMap, "1hp" ) != -1 && !equal( szMap, "1hp" ) )
	{
		g_iMapType = TYPE_1HP;
	}
	
	if( containi( szMap, "35hp" ) != -1 )
	{
		g_iMapType |= TYPE_35HP;
	}
	
	if( containi( szMap, "acer" ) != -1 )
	{
		g_iMapType |= TYPE_ACER;
	}
	
	if( containi( szMap, "wire" ) != -1 )
	{
		g_iMapType |= TYPE_WIRE;
	}
		
	new iLen = charsmax( g_szFreeHitMenu );

	add( g_szFreeHitMenu, iLen, "\yGive a free hit to \r%s?^n^n" );
	add( g_szFreeHitMenu, iLen, "1. \wYes^n" );
	add( g_szFreeHitMenu, iLen, "\r2. \wNo" );
	
	register_menucmd( register_menuid( "FreeHitMenu" ), g_iKeysFreeHitMenu, "HandleFreeHitMenu" );
}

public client_disconnect( iClient )
{
	g_bCamera[ iClient ] = false;
	g_bSpawned[ iClient ] = false;
}

public client_PreThink( iClient )
{
	if( !get_pcvar_num( g_pRespawn ) || is_user_alive( iClient ) || !InTeam( iClient ) )
	{
		return PLUGIN_CONTINUE;
	}
	
	if( g_fTimers[ iClient ][ RESPAWN ] <= get_gametime() )
	{
		ExecuteHamB( Ham_CS_RoundRespawn, iClient );
	}
	
	return PLUGIN_CONTINUE;
}

public FwdPlayerSpawnPost( iClient )
{
	if( !is_user_alive( iClient ) )
	{
		return HAM_IGNORED;
	}
	
	strip_user_weapons( iClient );
	give_item( iClient, "weapon_knife" );
		
	g_iButtonCount[ iClient ] = 0;
	g_iFreeHitCount[ iClient ] = 0;
		
	if( !g_bSpawned[ iClient ] && get_pcvar_num( g_pFreeHits ) )
	{
		g_bSpawned[ iClient ] = true;
		
		GreenPrint( iClient, "If you want to request a free hit, press your +use key 3 times while aiming at an enemy." );
	}
		
	if( g_bCamera[ iClient ] )
	{
		set_view( iClient, CAMERA_3RDPERSON );
	}
		
	if( g_iMapType & ( TYPE_35HP | TYPE_1HP ) )
	{
		remove_task( iClient + TASK_CHECKHEALTH );
		set_task( 1.0, "TaskCheckHealth", iClient + TASK_CHECKHEALTH );
	}
	
	return HAM_IGNORED;
}

public FwdArmouryEntitySpawn( iEnt )
{
	remove_entity( iEnt );
}

public FwdPlayerKilled( iClient )
{
	if( is_user_connected( iClient ) )
	{
		if( g_bCamera[ iClient ] )
		{
			set_view( iClient, CAMERA_NONE );
		}
		
		if( get_pcvar_num( g_pRespawn ) )
		{
			g_fTimers[ iClient ][ RESPAWN ] = get_gametime( ) + 1.5;
		}
	}
}

public FwdKnifePrimaryAttack( iEnt )
{
	if( get_pcvar_num( g_pStabAcerMaps ) && g_iMapType & TYPE_ACER )
	{
		ExecuteHamB( Ham_Weapon_SecondaryAttack, iEnt );
		
		return HAM_SUPERCEDE;
	}
	
	return HAM_IGNORED;
}

public FwdObjectCaps( iClient )
{
	if( !is_user_connected( iClient ) || !( entity_get_int( iClient, EV_INT_button ) & IN_USE ) )
	{
		return HAM_IGNORED;
	}
	
	new iFreeHits = get_pcvar_num( g_pFreeHits );
	
	if( !iFreeHits )
	{
		return HAM_IGNORED;
	}
	
	new iTarget, iBody;
	get_user_aiming( iClient, iTarget, iBody );
			
	if( is_user_connected( iTarget ) && cs_get_user_team( iClient ) != cs_get_user_team( iTarget ) )
	{
		new Float:fTime = get_gametime( );
				
		if( g_fTimers[ iClient ][ NEXTUSE ] <= fTime )
		{
			if( g_fTimers[ iClient ][ LASTUSE ] <= fTime - 1.5 )
			{
				g_iButtonCount[ iClient ] = 0;
				
				return HAM_IGNORED;
			}
			
			g_iButtonCount[ iClient ]++;
			g_fTimers[ iClient ][ NEXTUSE ] = fTime + 0.25;
			g_fTimers[ iClient ][ LASTUSE ] = fTime;
					
			if( g_iButtonCount[ iClient ] == 3 )
			{
				if( g_iFreeHitCount[ iClient ] >= iFreeHits )
				{
					GreenPrint( iClient, "You can only request free hits %i times per round.", iFreeHits );
				}
						
				else if( g_iRequester[ iTarget ] > 0 )
				{
					GreenPrint( iClient, "This player is already treating another free hit request." );
				}
						
				else if( get_user_health( iClient ) > 65 )
				{
					GreenPrint( iClient, "Your health must be below 65 to request a free hit." );
				}
						
				else if( get_user_health( iTarget ) <= 65 )
				{
					new szName[ 33 ];
					get_user_name( iTarget, szName, 32 );
							
					GreenPrint( iClient, "%s already has 65 HP or less.", szName );
				}
						
				else
				{
					g_iFreeHitCount[ iClient ]++;
					g_iRequester[ iTarget ] = iClient;
					
					new szMenu[ 128 ], szName[ 33 ];
					get_user_name( iClient, szName, 32 );
					formatex( szMenu, 127, g_szFreeHitMenu, szName );
		
					show_menu( iClient, g_iKeysFreeHitMenu, g_szFreeHitMenu, 5, "FreeHitMenu" ); 
					set_task( 5.0, "TaskCheckMenu", iClient + TASK_CHECKMENU );
					
					GreenPrint( iClient, "Request sent.." );
				}
			}
		}
	}
	
	return HAM_IGNORED;
}

public FwdSprayImpulse( iClient )
{
	if( g_iMapType & TYPE_WIRE )
	{
		return PLUGIN_HANDLED;
	}
	
	return PLUGIN_CONTINUE;
}	

public CmdSay( iClient )
{
	if( get_pcvar_num( g_pGhostChat ) )
	{
		new szMsg[ 192 ];
		read_args( szMsg, 191 );
		remove_quotes( szMsg );
		
		if( szMsg[ 0 ] )
		{
			new szName[ 33 ];
			get_user_name( iClient, szName, 32 );
			format( szMsg, 191, "^x01%s^x03%s^x01 :  %s", is_user_alive( iClient ) ? "" : "*DEAD* ", szName, szMsg );
			UTIL_SayText( 0, iClient, szMsg );
		
			return PLUGIN_HANDLED_MAIN;
		}
	}
	
	return PLUGIN_CONTINUE;
}
		

public CmdCamera( iClient )
{
	if( get_pcvar_num( g_pCamera ) )
	{
		if( ( g_bCamera[ iClient ] = !g_bCamera[ iClient ] ) )
		{
			if( is_user_alive( iClient ) )
			{
				set_view( iClient, CAMERA_3RDPERSON )
			}
			
			GreenPrint( iClient, "Camera enabled." );
		}
		
		else
		{
			set_view( iClient, CAMERA_NONE );
			GreenPrint( iClient, "Camera disabled." );
		}
	}
}

public CmdRespawn( iClient )
{
	if( get_pcvar_num( g_pRespawn ) && !is_user_alive( iClient ) && InTeam( iClient ) )
	{
		set_hudmessage( 0, 255, 0, -1.0, -1.0, 1, 0.0, 4.0, 0.0, 0.0, -1 )
		show_hudmessage( iClient, "Press primary attack button to respawn." );
	}
}	

public HandleFreeHitMenu( iClient, iKey )
{
	new szNameTarget[ 33 ], szNameReq[ 33 ];
	get_user_name( iClient, szNameTarget, 32 );
	get_user_name( g_iRequester[ iClient ], szNameReq, 32 );
	
	switch( iKey )
	{
		case 0:
		{
			entity_set_float( iClient, EV_FL_health, entity_get_float( g_iRequester[ iClient ], EV_FL_health ) )
			
			GreenPrint( 0, "%s accepted a free hit request from %s. They now have the same health.", szNameTarget, szNameReq );
		}
		
		case 1:
		{
			GreenPrint( 0, "%s declined a free hit request from %s.", szNameTarget, szNameReq );
		}
	}
	
	g_iRequester[ iClient ] = 0;
	
	remove_task( iClient + TASK_CHECKMENU );
}	

public TaskCheckHealth( iClient )
{
	iClient -= TASK_CHECKHEALTH;
	
	new iHealth = get_user_health( iClient );
	
	if( g_iMapType & TYPE_1HP && iHealth != 1 )
	{
		entity_set_float( iClient, EV_FL_health, 1.0 );
	}
	
	else if( g_iMapType & TYPE_35HP && iHealth != 35 )
	{
		entity_set_float( iClient, EV_FL_health, 35.0 );
	}
}

public TaskCheckMenu( iClient )
{
	iClient -= TASK_CHECKMENU;
	
	new szNameTarget[ 33 ], szNameReq[ 33 ];
	get_user_name( iClient, szNameTarget, 32 );
	get_user_name( g_iRequester[ iClient ], szNameReq, 32 );
	
	GreenPrint( 0, "%s didn't answer %s's free hit request.", szNameTarget, szNameReq );
	
	g_iRequester[ iClient ] = 0;
}
		
GreenPrint( const iClient, const szText[], any:... )
{
	new szMsg[ 192 ], iLen = formatex( szMsg, 191, "^x04[KM]^x01 " );
	vformat( szMsg[ iLen ], 191 - iLen, szText, 3 );
	UTIL_SayText( iClient, 1, szMsg );
}

UTIL_SayText( const iClient, const iSender, const szMsg[] )
{
	message_begin( iClient ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, g_iMsgSayText, _, iClient );
	write_byte( iSender );
	write_string( szMsg );
	message_end();
}
PS: Оказа се km_ghostchat 0 трябва да е, понеже по default e 1

Благодаря!
:lock: :lock: :lock:

Заключено
  • Подобни теми
    Отговори
    Преглеждания
     Последно мнение

Обратно към “Поддръжка / Помощ”

Кой е на линия

Потребители разглеждащи този форум: 0 регистрирани и 5 госта