Problema plugin Zoomless Announcer

Categoria cu cereri de pluginuri si nu numai.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Forum rules
Accesează link-ul pentru a putea vedea regulile forumului

Daca doriti sa vi se modifice un plugin, va rugam postati aici .
Post Reply
Hydr0
Membru, skill 0
Membru, skill 0
Posts: 46
Joined: 16 Sep 2021, 14:57
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Detinator server CS: inchis
Fond eXtream: 0
Has thanked: 2 times
Been thanked: 3 times

28 Oct 2021, 00:26

https://forums.alliedmods.net/showthread.php?p=763969
Cere debug: dupa debug apare urmatoarea:
amxx run time error 4: index out of bounds.
line 253 ham_killed
RoyalServer 2
User avatar
levin
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 3844
Joined: 24 Aug 2011, 12:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Discord: devilclass
Has thanked: 36 times
Been thanked: 594 times
Contact:

29 Oct 2021, 22:51

Code: Select all

/*
	Copyright © 2009, anakin_cstrike
	
	ZoomLess Announcer 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.

	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 ZoomLess Announcer; if not, write to the
	Free Software Foundation, Inc., 59 Temple Place - Suite 330,
	Boston, MA 02111-1307, USA.
	
	- - - - - - - - - - - - - - - -- - - - - - - - - - - - - - -
	
	-\ Announces Zoomless-kills in hud and chat. /-
	
	
	- Modules: Fakemeta, HamSandWich, Cstrike
	- Cvars:
		* zoom_plugin 1/0 - enable/disable plugin [default 1]
		* zoom_bonus - bonus in $ for zoomless kill [default 150]
		* zoom_chat 1/0 - enable/disable chat announce [default 1]
		* zoom_hud 1/0 - enable/disable hud announce [default 1]
	
	- Client commands:
		* say /myzoomless - displays your curent zoomless-kills
		* say /roundzoomless - displays total zoomless-kills done in that round
		* say /mapzoomless - displays total zoomless-kills done in that map
		* say /topzoomless - displays the top of the players who have done the most zoomless-kills
*/

#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>

// - - - - - - - -
new const PLUGIN[] = "ZoomLess Announcer"
#define VERSION "1.0"
// - - - - - - - -

/*  -\ Editable /- */

// * uncomment this if you don't have amxx version < 1.8
//#define OLD_VERSION

// * comment this if you don't want zoomless-kills to be saved
#define SAVE

// * comment this of you don't want zoomless-kill reward
#define BONUS

// TOP X
#define TOP_PLAYERS	5

// * HudMessage position
#define HUD_X	0.05
#define HUD_Y	0.45

// * HudMessage color
enum colors { Red, Green, Blue };
new const g_Colors[ colors ] = { 255, 160, 65 };

/*  -\  /- */

#if defined SAVE
#include <nvault>
#endif

#if defined OLD_VERSION
#define charsmax(%1)	sizeof %1 - 1
#endif

#define OFFSET_MONEY	115

new toggle_plugin, toggle_bonus, toggle_chat, toggle_hud;
new g_msgmoney, g_msgsaytext, g_maxplayers;

new g_Zoomless[ 33 ], g_CountPlayerZoomlessKills[ 33 ];
new g_CountMapZoomlessKills, g_CountRoundZoomlessKills;

new g_Sort[ 33 ][ 2 ];

public plugin_init()
{
	register_plugin( PLUGIN, VERSION, "anakin_cstrike" );
	register_dictionary( "zoomless_announcer.txt" );
	
	register_forward( FM_PlayerPreThink, "fw_prethink" );
	RegisterHam( Ham_Killed, "player", "ham_killed" );
	
	register_event( "HLTV", "roundnew", "a", "1=0", "2=0" );

	register_clcmd( "say /myzoomless", "show_playerzoomlesskills" );
	register_clcmd( "say /roundzoomless", "show_roundzoomlesskills" );
	register_clcmd( "say /mapzoomless", "show_mapzoomlesskills" );
	register_clcmd( "say /topzoomless", "show_topzoomless" );
	
	toggle_plugin = register_cvar( "zoom_plugin", "1" );
	toggle_chat = register_cvar( "zoom_chat", "1" );
	toggle_hud = register_cvar( "zoom_hud", "1" );
	toggle_bonus = register_cvar( "zoom_bonus", "150" );
	
	g_msgsaytext = get_user_msgid( "SayText" );
	g_msgmoney = get_user_msgid( "Money" );
	g_maxplayers = get_maxplayers();
}


public roundnew( )
	g_CountRoundZoomlessKills = 0;

public client_putinserver( id )
{
	if( !PluginEnabled() )
		return PLUGIN_CONTINUE;
	
	#if defined SAVE
		LoadZoomLessKills( id );
	#else
		g_CountPlayerZoomlessKills[ id ] = 0;
	#endif
	
	return PLUGIN_CONTINUE;
}
public client_disconnect( id )
{
	if( !PluginEnabled() )
		return PLUGIN_CONTINUE;
	
	#if defined SAVE
		SaveZoomLessKills( id );
	#else
		g_CountPlayerZoomlessKills[ id ] = 0;
	#endif
	
	return PLUGIN_CONTINUE;
}

public show_playerzoomlesskills( id )
{
	if( !PluginEnabled() )
	{
		ChatMessage( id, "%L", id, "ZOOMLESS_NOT_ENABLED" );
		return PLUGIN_HANDLED;
	}
	
	ChatMessage( id, "%L", id, "ZOOMLESS_KILLSDONE_BYYOU", g_CountPlayerZoomlessKills[ id ] );
	return PLUGIN_CONTINUE;
}
public show_roundzoomlesskills( id )
{
	if( !PluginEnabled() )
	{
		ChatMessage( id, "%L", id, "ZOOMLESS_NOT_ENABLED" );
		return PLUGIN_HANDLED;
	}
	
	( g_CountRoundZoomlessKills )
	?
		ChatMessage( id, "%L", id, "ZOOMLESS_DONE_THIS_ROUND", g_CountRoundZoomlessKills )
	:
		ChatMessage( id, "%L", id, "ZOOMLESS_NOKILLS_THIS_ROUND" );
	
	return PLUGIN_CONTINUE;
}
public show_mapzoomlesskills( id )
{
	if( !PluginEnabled() )
	{
		ChatMessage( id, "%L", id, "ZOOMLESS_NOT_ENABLED" );
		return PLUGIN_HANDLED;
	}
	
	( g_CountMapZoomlessKills )
	?
		ChatMessage( id, "%L", id, "ZOOMLESS_DONE_THIS_MAP", g_CountMapZoomlessKills )
	:
		ChatMessage( id, "%L", id, "ZOOMLESS_NOKILLS_THIS_MAP" );
	
	return PLUGIN_CONTINUE;
}

public show_topzoomless( id )
{
	if( !PluginEnabled() )
	{
		ChatMessage( id, "%L", id, "ZOOMLESS_NOT_ENABLED" );
		return PLUGIN_HANDLED;
	}
	
	new players[ 32 ], index, count, num, i;
	get_players( players, num );
	
	for( ; i < num; i++ )
	{
		index = players[ i ];
		
		g_Sort[ count ][ 0 ] = index;
		g_Sort[ count ][ 1 ] = g_CountPlayerZoomlessKills[ index ];
		
		count++;
	}
	
	SortCustom2D( g_Sort, count, "kills_compare" );
	
	new Motd[ 1024 ], Len;	
	
	Len = format( Motd, charsmax( Motd ),"<body bgcolor=#000000><font color=#98f5ff><pre>" );
	Len += format( Motd[ Len ], charsmax( Motd ) - Len,"%s %-22.22s %3s^n", "#", "Name", "Zoomless Kills" );
	
	
	new b = clamp( count, 0, TOP_PLAYERS );
	
	new name[ 32 ], player, j;
	
	for( ; j < b; j++ )
	{
		player = g_Sort[ j ][ 0 ];
		
		get_user_name( player, name, 31 );		
		Len += format( Motd[ Len ], charsmax( Motd )-Len,"%d %-22.22s %d^n", j+1, name, g_Sort[ j ][ 1 ] );
	}
	Len += format( Motd[ Len ], charsmax( Motd )-Len,"</body></font></pre>" );
	
	show_motd( id, Motd, "Zoomless Top" );
	return PLUGIN_CONTINUE;
}

public fw_prethink( id )
{
	if( !PluginEnabled() )
		return FMRES_IGNORED;
	if( !is_user_alive( id ) )
		return FMRES_IGNORED;
	
	static wpn;
	wpn = get_user_weapon( id );
	
	g_Zoomless[ id ] = ( pev( id, pev_button ) & IN_ATTACK && ( wpn == CSW_AWP || wpn == CSW_SCOUT ) && cs_get_user_zoom( id ) == CS_SET_NO_ZOOM ) ? true : false;	
	return FMRES_IGNORED;
}

public ham_killed( victim, killer, shouldgib )
{
	if( !PluginEnabled() )
		return HAM_IGNORED;
	if(!is_user_connected(killer)) reutrn HAM_IGNORED
	if( !g_Zoomless[ killer ] )
		return HAM_IGNORED;
		
	// - - - - - - - - -
	static
		Float: vOrigin[ 3 ],
		Float: kOrigin[ 3 ],
		Float: fDistance,
		vname[ 32 ], kname[ 32 ],
		iHealth, iArmor,
		chat, hud,bonus;
	// - - - - - - - - -
	
	g_CountPlayerZoomlessKills[ killer ]++;
	g_CountRoundZoomlessKills++;
	g_CountMapZoomlessKills++;
	
	pev( victim, pev_origin, vOrigin );
	pev( killer, pev_origin, kOrigin );
	get_user_name( victim, vname, charsmax( vname ) );
	get_user_name( killer, kname, charsmax( kname ) );
		
	fDistance = fm_get_distance( vOrigin, kOrigin );
	iHealth = get_user_health( killer );
	iArmor = get_user_armor( killer );
	chat = get_pcvar_num( toggle_chat );
	hud = get_pcvar_num( toggle_hud );
	
	if( chat )
	{
		ChatMessage( victim, "%L", victim, "ZOOMLESS_HAS_KILLED_YOU", kname, iHealth, iArmor );
		ChatMessage( 0, "%L", LANG_PLAYER, "ZOOMLESS_HAS_KILLED_PLAYER",  kname, vname, fDistance );
	}
	ChatMessage( killer, "%L", victim, "ZOOMLESS_TOTAL_KILLS", g_CountPlayerZoomlessKills[ killer ] );
	
	if( hud )
	{
		set_hudmessage( g_Colors[ Red ], g_Colors[ Green ], g_Colors[ Blue ], HUD_X, HUD_Y, 0, 6.0, 4.0 );
		show_hudmessage( 0, "%L", LANG_PLAYER, "ZOOMLESS_ZOOMLESS_ON", kname, vname );
	}
		
	#if defined BONUS
		bonus = get_pcvar_num( toggle_bonus );
		fm_set_user_money( killer, fm_get_user_money( killer ) + bonus, 1 );
		if( chat )
			ChatMessage( killer, "%L", killer, "ZOOMLESS_RECEIVED_BONUS", bonus, vname );
	#endif
	return HAM_IGNORED;
}

public kills_compare( elem1[ ], elem2[ ] )
{
	if( elem1[ 1 ] > elem2[ 1 ] )
		return -1;
	else if( elem1[ 1 ] < elem2[ 1 ] )
		return 1;
		
	return 0;
}

public SaveZoomLessKills( index )
{
	new Vault = nvault_open( "zoomless_kills" );
	new Key[ 64 ], Value[ 64 ], name[ 32 ];
	
	get_user_name( index, name, charsmax( name ) );
	formatex( Key, charsmax( Key ), "%s-zoomless_kills:", name );
	formatex( Value,  charsmax( Value ), "%d", g_CountPlayerZoomlessKills[ index ] );
	
	nvault_set( Vault, Key, Value );
	nvault_close( Vault );
}

public LoadZoomLessKills( index )
{
	new Vault = nvault_open( "zoomless_kills" );
	new Key[ 64 ], Value[ 64 ], name[ 32 ];
	
	get_user_name( index, name, charsmax( name ) );
	formatex( Key, charsmax( Key ), "%s-zoomless_kills:", name );
	
	nvault_get( Vault, Key, Value, charsmax( Value ) );
	nvault_close( Vault );
	
	g_CountPlayerZoomlessKills[ index ] = str_to_num( Value );
}

ChatMessage( index, const text[ ], { Float, Sql, Result, _ }:... )
{
	new Buffer[ 128 ], Buffer2[ 128 ];
	formatex( Buffer2, sizeof Buffer2 - 1, "%s", text );
	vformat( Buffer, sizeof Buffer - 1, Buffer2, 3 );
	
	if( index )
	{
		message_begin( MSG_ONE, g_msgsaytext, _, index );
		write_byte( index );
		write_string( Buffer );
		message_end();
	}
	else
	{
		for( new i = 1; i <= g_maxplayers; i++ )
		{
			if( !is_user_connected( i ) )
				continue;
			if( is_user_bot( i ) )
				continue;
			
			message_begin( MSG_ONE, g_msgsaytext, _, i );
			write_byte( i );
			write_string( Buffer );
			message_end();
		}
	}
}
		 
fm_set_user_money( index, money, flash = 1 )
{
	set_pdata_int( index, OFFSET_MONEY, money );
	
	message_begin( MSG_ONE, g_msgmoney, {0, 0, 0}, index );
	write_long( money );
	write_byte( flash ? 1 : 0 );
	message_end();
	
	return 1;
}
fm_get_user_money( index )
{
	new money = get_pdata_int( index, OFFSET_MONEY );
	return money;
}

Float:fm_get_distance( Float: Origin1[ 3 ], Float: Origin2[ 3 ] )
{
	new Float: fdistance = get_distance_f( Origin1, Origin2 );
	return ( fdistance*0.0254 );
}

bool:PluginEnabled( )
	return get_pcvar_num( toggle_plugin ) ? true : false;
Pentru ajutor, faceți cerere bine detaliată, completând și respectând modelul corespunzător.
Nu-mi mai dați cereri doar pentru a mă avea în lista de prieteni.
Dacă te ajut, și mă ignori/etc > te adaug în „foe”.
Aveți grijă la cei ce încearcă să mă copieze sau să dea drept mine..Puteți lua legătura cu mine prin STEAM dacă aveți o problemă/nelămurire în acest caz! Cont de forum am doar aici.
În cazul în care utilizați ceva din ce am postat(ex: aici), e bine să fiți la curent cu modificările aduse și de aici, iar dacă sunt ceva probleme nu ezitați să luați legătura cu mine. Actualizarea unor coduri nu se vor afișa public, doar dacă se găsește ceva critic/urgent de remediat, unele fiind coduri vechi iar unele refăcute chiar recent dar private.
* Nume pe cs1.6: eVoLuTiOn \ Nume vechi: eVo
* Atelierul meu - post2819572.html#p2819572 (închis, click link ca să vedeți de ce)
Hydr0
Membru, skill 0
Membru, skill 0
Posts: 46
Joined: 16 Sep 2021, 14:57
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Detinator server CS: inchis
Fond eXtream: 0
Has thanked: 2 times
Been thanked: 3 times

30 Oct 2021, 19:38

Nu se compileaza
User avatar
levin
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 3844
Joined: 24 Aug 2011, 12:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Discord: devilclass
Has thanked: 36 times
Been thanked: 594 times
Contact:

30 Oct 2021, 20:02

Code: Select all

/*
	Copyright © 2009, anakin_cstrike
	
	ZoomLess Announcer 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.

	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 ZoomLess Announcer; if not, write to the
	Free Software Foundation, Inc., 59 Temple Place - Suite 330,
	Boston, MA 02111-1307, USA.
	
	- - - - - - - - - - - - - - - -- - - - - - - - - - - - - - -
	
	-\ Announces Zoomless-kills in hud and chat. /-
	
	
	- Modules: Fakemeta, HamSandWich, Cstrike
	- Cvars:
		* zoom_plugin 1/0 - enable/disable plugin [default 1]
		* zoom_bonus - bonus in $ for zoomless kill [default 150]
		* zoom_chat 1/0 - enable/disable chat announce [default 1]
		* zoom_hud 1/0 - enable/disable hud announce [default 1]
	
	- Client commands:
		* say /myzoomless - displays your curent zoomless-kills
		* say /roundzoomless - displays total zoomless-kills done in that round
		* say /mapzoomless - displays total zoomless-kills done in that map
		* say /topzoomless - displays the top of the players who have done the most zoomless-kills
*/

#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>

// - - - - - - - -
new const PLUGIN[] = "ZoomLess Announcer"
#define VERSION "1.0"
// - - - - - - - -

/*  -\ Editable /- */

// * uncomment this if you don't have amxx version < 1.8
//#define OLD_VERSION

// * comment this if you don't want zoomless-kills to be saved
#define SAVE

// * comment this of you don't want zoomless-kill reward
#define BONUS

// TOP X
#define TOP_PLAYERS	5

// * HudMessage position
#define HUD_X	0.05
#define HUD_Y	0.45

// * HudMessage color
enum colors { Red, Green, Blue };
new const g_Colors[ colors ] = { 255, 160, 65 };

/*  -\  /- */

#if defined SAVE
#include <nvault>
#endif

#if defined OLD_VERSION
#define charsmax(%1)	sizeof %1 - 1
#endif

#define OFFSET_MONEY	115

new toggle_plugin, toggle_bonus, toggle_chat, toggle_hud;
new g_msgmoney, g_msgsaytext, g_maxplayers;

new g_Zoomless[ 33 ], g_CountPlayerZoomlessKills[ 33 ];
new g_CountMapZoomlessKills, g_CountRoundZoomlessKills;

new g_Sort[ 33 ][ 2 ];

public plugin_init()
{
	register_plugin( PLUGIN, VERSION, "anakin_cstrike" );
	register_dictionary( "zoomless_announcer.txt" );
	
	register_forward( FM_PlayerPreThink, "fw_prethink" );
	RegisterHam( Ham_Killed, "player", "ham_killed" );
	
	register_event( "HLTV", "roundnew", "a", "1=0", "2=0" );

	register_clcmd( "say /myzoomless", "show_playerzoomlesskills" );
	register_clcmd( "say /roundzoomless", "show_roundzoomlesskills" );
	register_clcmd( "say /mapzoomless", "show_mapzoomlesskills" );
	register_clcmd( "say /topzoomless", "show_topzoomless" );
	
	toggle_plugin = register_cvar( "zoom_plugin", "1" );
	toggle_chat = register_cvar( "zoom_chat", "1" );
	toggle_hud = register_cvar( "zoom_hud", "1" );
	toggle_bonus = register_cvar( "zoom_bonus", "150" );
	
	g_msgsaytext = get_user_msgid( "SayText" );
	g_msgmoney = get_user_msgid( "Money" );
	g_maxplayers = get_maxplayers();
}


public roundnew( )
	g_CountRoundZoomlessKills = 0;

public client_putinserver( id )
{
	if( !PluginEnabled() )
		return PLUGIN_CONTINUE;
	
	#if defined SAVE
		LoadZoomLessKills( id );
	#else
		g_CountPlayerZoomlessKills[ id ] = 0;
	#endif
	
	return PLUGIN_CONTINUE;
}
public client_disconnect( id )
{
	if( !PluginEnabled() )
		return PLUGIN_CONTINUE;
	
	#if defined SAVE
		SaveZoomLessKills( id );
	#else
		g_CountPlayerZoomlessKills[ id ] = 0;
	#endif
	
	return PLUGIN_CONTINUE;
}

public show_playerzoomlesskills( id )
{
	if( !PluginEnabled() )
	{
		ChatMessage( id, "%L", id, "ZOOMLESS_NOT_ENABLED" );
		return PLUGIN_HANDLED;
	}
	
	ChatMessage( id, "%L", id, "ZOOMLESS_KILLSDONE_BYYOU", g_CountPlayerZoomlessKills[ id ] );
	return PLUGIN_CONTINUE;
}
public show_roundzoomlesskills( id )
{
	if( !PluginEnabled() )
	{
		ChatMessage( id, "%L", id, "ZOOMLESS_NOT_ENABLED" );
		return PLUGIN_HANDLED;
	}
	
	( g_CountRoundZoomlessKills )
	?
		ChatMessage( id, "%L", id, "ZOOMLESS_DONE_THIS_ROUND", g_CountRoundZoomlessKills )
	:
		ChatMessage( id, "%L", id, "ZOOMLESS_NOKILLS_THIS_ROUND" );
	
	return PLUGIN_CONTINUE;
}
public show_mapzoomlesskills( id )
{
	if( !PluginEnabled() )
	{
		ChatMessage( id, "%L", id, "ZOOMLESS_NOT_ENABLED" );
		return PLUGIN_HANDLED;
	}
	
	( g_CountMapZoomlessKills )
	?
		ChatMessage( id, "%L", id, "ZOOMLESS_DONE_THIS_MAP", g_CountMapZoomlessKills )
	:
		ChatMessage( id, "%L", id, "ZOOMLESS_NOKILLS_THIS_MAP" );
	
	return PLUGIN_CONTINUE;
}

public show_topzoomless( id )
{
	if( !PluginEnabled() )
	{
		ChatMessage( id, "%L", id, "ZOOMLESS_NOT_ENABLED" );
		return PLUGIN_HANDLED;
	}
	
	new players[ 32 ], index, count, num, i;
	get_players( players, num );
	
	for( ; i < num; i++ )
	{
		index = players[ i ];
		
		g_Sort[ count ][ 0 ] = index;
		g_Sort[ count ][ 1 ] = g_CountPlayerZoomlessKills[ index ];
		
		count++;
	}
	
	SortCustom2D( g_Sort, count, "kills_compare" );
	
	new Motd[ 1024 ], Len;	
	
	Len = format( Motd, charsmax( Motd ),"<body bgcolor=#000000><font color=#98f5ff><pre>" );
	Len += format( Motd[ Len ], charsmax( Motd ) - Len,"%s %-22.22s %3s^n", "#", "Name", "Zoomless Kills" );
	
	
	new b = clamp( count, 0, TOP_PLAYERS );
	
	new name[ 32 ], player, j;
	
	for( ; j < b; j++ )
	{
		player = g_Sort[ j ][ 0 ];
		
		get_user_name( player, name, 31 );		
		Len += format( Motd[ Len ], charsmax( Motd )-Len,"%d %-22.22s %d^n", j+1, name, g_Sort[ j ][ 1 ] );
	}
	Len += format( Motd[ Len ], charsmax( Motd )-Len,"</body></font></pre>" );
	
	show_motd( id, Motd, "Zoomless Top" );
	return PLUGIN_CONTINUE;
}

public fw_prethink( id )
{
	if( !PluginEnabled() )
		return FMRES_IGNORED;
	if( !is_user_alive( id ) )
		return FMRES_IGNORED;
	
	static wpn;
	wpn = get_user_weapon( id );
	
	g_Zoomless[ id ] = ( pev( id, pev_button ) & IN_ATTACK && ( wpn == CSW_AWP || wpn == CSW_SCOUT ) && cs_get_user_zoom( id ) == CS_SET_NO_ZOOM ) ? true : false;	
	return FMRES_IGNORED;
}

public ham_killed( victim, killer, shouldgib )
{
	if( !PluginEnabled() )
		return HAM_IGNORED;
	if(!is_user_connected(killer)) return HAM_IGNORED
	if( !g_Zoomless[ killer ] )
		return HAM_IGNORED;
		
	// - - - - - - - - -
	static
		Float: vOrigin[ 3 ],
		Float: kOrigin[ 3 ],
		Float: fDistance,
		vname[ 32 ], kname[ 32 ],
		iHealth, iArmor,
		chat, hud,bonus;
	// - - - - - - - - -
	
	g_CountPlayerZoomlessKills[ killer ]++;
	g_CountRoundZoomlessKills++;
	g_CountMapZoomlessKills++;
	
	pev( victim, pev_origin, vOrigin );
	pev( killer, pev_origin, kOrigin );
	get_user_name( victim, vname, charsmax( vname ) );
	get_user_name( killer, kname, charsmax( kname ) );
		
	fDistance = fm_get_distance( vOrigin, kOrigin );
	iHealth = get_user_health( killer );
	iArmor = get_user_armor( killer );
	chat = get_pcvar_num( toggle_chat );
	hud = get_pcvar_num( toggle_hud );
	
	if( chat )
	{
		ChatMessage( victim, "%L", victim, "ZOOMLESS_HAS_KILLED_YOU", kname, iHealth, iArmor );
		ChatMessage( 0, "%L", LANG_PLAYER, "ZOOMLESS_HAS_KILLED_PLAYER",  kname, vname, fDistance );
	}
	ChatMessage( killer, "%L", victim, "ZOOMLESS_TOTAL_KILLS", g_CountPlayerZoomlessKills[ killer ] );
	
	if( hud )
	{
		set_hudmessage( g_Colors[ Red ], g_Colors[ Green ], g_Colors[ Blue ], HUD_X, HUD_Y, 0, 6.0, 4.0 );
		show_hudmessage( 0, "%L", LANG_PLAYER, "ZOOMLESS_ZOOMLESS_ON", kname, vname );
	}
		
	#if defined BONUS
		bonus = get_pcvar_num( toggle_bonus );
		fm_set_user_money( killer, fm_get_user_money( killer ) + bonus, 1 );
		if( chat )
			ChatMessage( killer, "%L", killer, "ZOOMLESS_RECEIVED_BONUS", bonus, vname );
	#endif
	return HAM_IGNORED;
}

public kills_compare( elem1[ ], elem2[ ] )
{
	if( elem1[ 1 ] > elem2[ 1 ] )
		return -1;
	else if( elem1[ 1 ] < elem2[ 1 ] )
		return 1;
		
	return 0;
}

public SaveZoomLessKills( index )
{
	new Vault = nvault_open( "zoomless_kills" );
	new Key[ 64 ], Value[ 64 ], name[ 32 ];
	
	get_user_name( index, name, charsmax( name ) );
	formatex( Key, charsmax( Key ), "%s-zoomless_kills:", name );
	formatex( Value,  charsmax( Value ), "%d", g_CountPlayerZoomlessKills[ index ] );
	
	nvault_set( Vault, Key, Value );
	nvault_close( Vault );
}

public LoadZoomLessKills( index )
{
	new Vault = nvault_open( "zoomless_kills" );
	new Key[ 64 ], Value[ 64 ], name[ 32 ];
	
	get_user_name( index, name, charsmax( name ) );
	formatex( Key, charsmax( Key ), "%s-zoomless_kills:", name );
	
	nvault_get( Vault, Key, Value, charsmax( Value ) );
	nvault_close( Vault );
	
	g_CountPlayerZoomlessKills[ index ] = str_to_num( Value );
}

ChatMessage( index, const text[ ], { Float, Sql, Result, _ }:... )
{
	new Buffer[ 128 ], Buffer2[ 128 ];
	formatex( Buffer2, sizeof Buffer2 - 1, "%s", text );
	vformat( Buffer, sizeof Buffer - 1, Buffer2, 3 );
	
	if( index )
	{
		message_begin( MSG_ONE, g_msgsaytext, _, index );
		write_byte( index );
		write_string( Buffer );
		message_end();
	}
	else
	{
		for( new i = 1; i <= g_maxplayers; i++ )
		{
			if( !is_user_connected( i ) )
				continue;
			if( is_user_bot( i ) )
				continue;
			
			message_begin( MSG_ONE, g_msgsaytext, _, i );
			write_byte( i );
			write_string( Buffer );
			message_end();
		}
	}
}
		 
fm_set_user_money( index, money, flash = 1 )
{
	set_pdata_int( index, OFFSET_MONEY, money );
	
	message_begin( MSG_ONE, g_msgmoney, {0, 0, 0}, index );
	write_long( money );
	write_byte( flash ? 1 : 0 );
	message_end();
	
	return 1;
}
fm_get_user_money( index )
{
	new money = get_pdata_int( index, OFFSET_MONEY );
	return money;
}

Float:fm_get_distance( Float: Origin1[ 3 ], Float: Origin2[ 3 ] )
{
	new Float: fdistance = get_distance_f( Origin1, Origin2 );
	return ( fdistance*0.0254 );
}

bool:PluginEnabled( )
	return get_pcvar_num( toggle_plugin ) ? true : false;
Pentru ajutor, faceți cerere bine detaliată, completând și respectând modelul corespunzător.
Nu-mi mai dați cereri doar pentru a mă avea în lista de prieteni.
Dacă te ajut, și mă ignori/etc > te adaug în „foe”.
Aveți grijă la cei ce încearcă să mă copieze sau să dea drept mine..Puteți lua legătura cu mine prin STEAM dacă aveți o problemă/nelămurire în acest caz! Cont de forum am doar aici.
În cazul în care utilizați ceva din ce am postat(ex: aici), e bine să fiți la curent cu modificările aduse și de aici, iar dacă sunt ceva probleme nu ezitați să luați legătura cu mine. Actualizarea unor coduri nu se vor afișa public, doar dacă se găsește ceva critic/urgent de remediat, unele fiind coduri vechi iar unele refăcute chiar recent dar private.
* Nume pe cs1.6: eVoLuTiOn \ Nume vechi: eVo
* Atelierul meu - post2819572.html#p2819572 (închis, click link ca să vedeți de ce)
Hydr0
Membru, skill 0
Membru, skill 0
Posts: 46
Joined: 16 Sep 2021, 14:57
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Detinator server CS: inchis
Fond eXtream: 0
Has thanked: 2 times
Been thanked: 3 times

30 Oct 2021, 21:02

Rezolvat. Testat si merge
10x.
Post Reply

Return to “Cereri”

  • Information
  • Who is online

    Users browsing this forum: Yandex [Bot] and 13 guests