modificare plugin problema compilare [Rezolvat]

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
dannyel98
Membru, skill 0
Membru, skill 0
Posts: 51
Joined: 26 Mar 2017, 20:58
Detinator Steam: Da
Detinator server CS: ZP.CSBLACKDEVIL.COM
SteamID: dannyel1998
Fond eXtream: 0

24 May 2019, 20:31

Da eroare la compilare ce poate fi?

Code: Select all

#include <amxmodx>
#include <fakemeta>

#pragma semicolon 1

#define DISTANCE 120.0
#define UPDATE_FREQ 0.2

new bool:g_bSemiclip[33][33];
new bool:g_bHasSemiclip[33];
new bool:g_bSemiclipEnabled;

new g_iTaskId;
new g_iForwardId[3];
new g_iMaxPlayers;
new g_iCvar[3];

public plugin_init( )
{
	register_plugin( "(Team-)Semiclip", "1.0", "SchlumPF*" );
	
	g_iCvar[0] = register_cvar( "semiclip_enabled", "1" );
	g_iCvar[1] = register_cvar( "semiclip_teamclip", "1" );
	g_iCvar[2] = register_cvar( "semiclip_transparancy", "0" );
	
	register_forward( FM_Think, "fwdThink" );
	register_forward( FM_ClientCommand, "fwdClientCommand" );
	
	if( get_pcvar_num( g_iCvar[0] ) )
	{
		g_iForwardId[0] = register_forward( FM_PlayerPreThink, "fwdPlayerPreThink" );
		g_iForwardId[1] = register_forward( FM_PlayerPostThink, "fwdPlayerPostThink" );
		g_iForwardId[2] = register_forward( FM_AddToFullPack, "fwdAddToFullPack_Post", 1 );
		
		g_bSemiclipEnabled = true;
	}
	else
		g_bSemiclipEnabled = false;
	
	g_iMaxPlayers = get_maxplayers( );
	
	new ent = engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString, "info_target" ) );
	set_pev( ent, pev_classname, "task_semiclip" );
	set_pev( ent, pev_nextthink, get_gametime( ) + 1.01 );
	g_iTaskId = ent;
}

public fwdPlayerPreThink( plr )
{
	static id;
	
	if( is_user_alive( plr ) )
	{
		for( id = 1 ; id <= g_iMaxPlayers ; id++ )
		{
			if( pev( id, pev_solid ) == SOLID_SLIDEBOX && g_bSemiclip[plr][id] && id != plr )
			{
				set_pev( id, pev_solid, SOLID_NOT );
				g_bHasSemiclip[id] = true;
			}
		}
	}
}

public fwdPlayerPostThink( plr )
{
	static id;

	if( is_user_alive( plr ) )
	{
		for( id = 1 ; id <= g_iMaxPlayers ; id++ )
		{
			if( g_bHasSemiclip[id] )
			{
				set_pev( id, pev_solid, SOLID_SLIDEBOX );
				g_bHasSemiclip[id] = false;
			}
		}
	}
}

public fwdThink( ent )
{
	static i, j;
	static team[33];
	static Float:origin[33][3];
	
	if( ent == g_iTaskId )
	{
		if( get_pcvar_num( g_iCvar[0] ) )
		{
			for( i = 1 ; i <= g_iMaxPlayers ; i++ )
			{
				if( is_user_alive( i ) )
				{
					pev( i, pev_origin, origin );
						
					if( get_pcvar_num( g_iCvar[1] ) )
						team = get_user_team( i );
					
					for( j = 1 ; j <= g_iMaxPlayers ; j++ )
					{
						if( is_user_alive( j ) )
						{
							if( get_pcvar_num( g_iCvar[1] ) && team != team[j] )
							{
								g_bSemiclip[j] = false;
								g_bSemiclip[j] = false;
								
							}	
							else if( floatabs( origin[0] - origin[j][0] ) < DISTANCE && floatabs( origin[1] - origin[j][1] ) < DISTANCE && floatabs( origin[2] - origin[j][2] ) < ( DISTANCE * 2 ) )
							{
								g_bSemiclip[j] = true;
								g_bSemiclip[j] = true;
							}
							else
							{
								g_bSemiclip[i][j] = false;
								g_bSemiclip[j][i] = false;
							}
						}
					}
				}
			}
		}
		
		set_pev( ent, pev_nextthink, get_gametime( ) + UPDATE_FREQ );
	}
}

public fwdAddToFullPack_Post( es_handle, e, ent, host, hostflags, player, pset )
{
	if( player )
	{
		if( g_bSemiclip[host][ent] )
		{
			set_es( es_handle, ES_Solid, SOLID_NOT ); // makes semiclip flawless
			
			if( get_pcvar_num( g_iCvar[2] ) == 1 )
			{
				set_es( es_handle, ES_RenderMode, kRenderTransAlpha );
				set_es( es_handle, ES_RenderAmt, 85 );
			}
			else if( get_pcvar_num( g_iCvar[2] ) == 2 )
			{
				set_es( es_handle, ES_Effects, EF_NODRAW );
				set_es( es_handle, ES_Solid, SOLID_NOT );
			}
		}
	}
}

// is there a better way to detect changings of g_iCvar[0]?
public fwdClientCommand( plr )
{
	// use the forwards just when needed, for good performance
	if( !get_pcvar_num( g_iCvar[0] ) && g_bSemiclipEnabled )
	{
		unregister_forward( FM_PlayerPreThink, g_iForwardId[0] );
		unregister_forward( FM_PlayerPostThink, g_iForwardId[1] );
		unregister_forward( FM_AddToFullPack, g_iForwardId[2], 1 );
		
		g_bSemiclipEnabled = false;
	}
	else if( get_pcvar_num( g_iCvar[0] ) && !g_bSemiclipEnabled )
	{
		g_iForwardId[0] = register_forward( FM_PlayerPreThink, "fwdPlayerPreThink" );
		g_iForwardId[1] = register_forward( FM_PlayerPostThink, "fwdPlayerPostThink" );
		g_iForwardId[2] = register_forward( FM_AddToFullPack, "fwdAddToFullPack_Post", 1 );
		
		g_bSemiclipEnabled = true;
	}
}
Last edited by MrAndrei on 25 May 2019, 00:38, edited 2 times in total.
..:: ZP.CSBLACKDEVIL.COM # 178.32.241.8:27015 # WWW.CSBLACKDEVIL.COM ::.
https://www.gametracker.com/server_info ... 1.8:27015/
eXtreamSHOP
User avatar
Laurentiu P.
Fost moderator
Fost moderator
Posts: 2224
Joined: 10 Jul 2013, 20:26
Detinator Steam: Nu
Reputatie: Fost super moderator
Fond eXtream: 100
Has thanked: 9 times
Been thanked: 28 times

24 May 2019, 20:50

sterge din sursa

Code: Select all

-----------------------------------
cvaruri:
semiclip_enabled 0/1 activezi/dezactivezi semiclip
semiclip_teamclip 1/0 activezi/dezactivezi semiclipul doar la echipe(daca e 0 e pentru toti)
semiclip_transparancy 0/1 daca e 1 cand 2 sau mai multi jucatori sunt mai aproape de x unitati vor fi transparenti adica se vede prin ei.
Image
@IONUTZ
Membru, skill +1
Membru, skill +1
Posts: 192
Joined: 17 Dec 2017, 23:11
Detinator Steam: Da
Fond eXtream: 0
Has thanked: 2 times
Been thanked: 3 times

24 May 2019, 20:51

dannyel98
Membru, skill 0
Membru, skill 0
Posts: 51
Joined: 26 Mar 2017, 20:58
Detinator Steam: Da
Detinator server CS: ZP.CSBLACKDEVIL.COM
SteamID: dannyel1998
Fond eXtream: 0

24 May 2019, 21:01

Nu sunt in sursa aia dupa ------------------------------------ am scris pur si simplu cvarurile
dar de link nu merge apare
The file link that you requested is not valid. Please contact link publisher or try to make a search.
..:: ZP.CSBLACKDEVIL.COM # 178.32.241.8:27015 # WWW.CSBLACKDEVIL.COM ::.
https://www.gametracker.com/server_info ... 1.8:27015/
User avatar
faKe91
Moderator ajutator
Moderator ajutator
Posts: 1412
Joined: 07 Oct 2014, 17:49
Detinator Steam: Da
CS Status: I <3 Heavy Metal
SteamID: dogseatmypancreas
Reputatie: Moderator ajutator
Fost Membru Club eXtreamCS (doua luni)
Fond eXtream: 0
Location: Republica Moldova, Chișinău
Has thanked: 7 times
Been thanked: 8 times

24 May 2019, 21:02

Code: Select all

#include <amxmodx>
#include <fakemeta>

#pragma semicolon 1

#define DISTANCE 120.0
#define UPDATE_FREQ 0.2

new bool:g_bSemiclip[33][33];
new bool:g_bHasSemiclip[33];
new bool:g_bSemiclipEnabled;

new g_iTaskId;
new g_iForwardId[3];
new g_iMaxPlayers;
new g_iCvar[3];

public plugin_init( )
{
	register_plugin( "(Team-)Semiclip", "1.0", "SchlumPF*" );

	g_iCvar[0] = register_cvar( "semiclip_enabled", "1" );
	g_iCvar[1] = register_cvar( "semiclip_teamclip", "1" );
	g_iCvar[2] = register_cvar( "semiclip_transparancy", "0" );

	register_forward( FM_Think, "fwdThink" );
	register_forward( FM_ClientCommand, "fwdClientCommand" );

	if( get_pcvar_num( g_iCvar[0] ) )
	{
		g_iForwardId[0] = register_forward( FM_PlayerPreThink, "fwdPlayerPreThink" );
		g_iForwardId[1] = register_forward( FM_PlayerPostThink, "fwdPlayerPostThink" );
		g_iForwardId[2] = register_forward( FM_AddToFullPack, "fwdAddToFullPack_Post", 1 );

		g_bSemiclipEnabled = true;
	}
	else
	{
		g_bSemiclipEnabled = false;

		g_iMaxPlayers = get_maxplayers( );

		new ent = engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString, "info_target" ) );
		set_pev( ent, pev_classname, "task_semiclip" );
		set_pev( ent, pev_nextthink, get_gametime( ) + 1.01 );
		g_iTaskId = ent;
	}
}

public fwdPlayerPreThink( plr )
{
	static id;

	if( is_user_alive( plr ) )
	{
		for( id = 1 ; id <= g_iMaxPlayers ; id++ )
		{
			if( pev( id, pev_solid ) == SOLID_SLIDEBOX && g_bSemiclip[plr][id] && id != plr )
			{
				set_pev( id, pev_solid, SOLID_NOT );
				g_bHasSemiclip[id] = true;
			}
		}
	}
}

public fwdPlayerPostThink( plr )
{
	static id;

	if( is_user_alive( plr ) )
	{
		for( id = 1 ; id <= g_iMaxPlayers ; id++ )
		{
			if( g_bHasSemiclip[id] )
			{
				set_pev( id, pev_solid, SOLID_SLIDEBOX );
				g_bHasSemiclip[id] = false;
			}
		}
	}
}

public fwdThink( ent )
{
	static i, j;
	static team[33];
	static Float:origin[33][3];

	if( ent == g_iTaskId )
	{
		if( get_pcvar_num( g_iCvar[0] ) )
		{
			for( i = 1 ; i <= g_iMaxPlayers ; i++ )
			{
				if( is_user_alive( i ) )
				{
					pev( i, pev_origin, origin );

					if( get_pcvar_num( g_iCvar[1] ) )
					team[i] = get_user_team( i );

					for( j = 1 ; j <= g_iMaxPlayers ; j++ )
					{
						if( is_user_alive( j ) )
						{
							if( get_pcvar_num( g_iCvar[1] ) && team[i] != team[j] )
							{
								g_bSemiclip[i][j] = false;
								g_bSemiclip[i][j] = false;

							}	
							else if( floatabs( origin[i][0] - origin[j][0] ) < DISTANCE && floatabs( origin[i][1] - origin[j][1] ) < DISTANCE && floatabs( origin[i][2] - origin[j][2] ) < ( DISTANCE * 2 ) )
							{
								g_bSemiclip[i][j] = true;
								g_bSemiclip[i][j] = true;
							}
							else
							{
								g_bSemiclip[i][j] = false;
								g_bSemiclip[i][j] = false;
							}
						}
					}
				}
			}
		}

		set_pev( ent, pev_nextthink, get_gametime( ) + UPDATE_FREQ );
	}
}

public fwdAddToFullPack_Post( es_handle, e, ent, host, hostflags, player, pset )
{
	if( player )
	{
		if( g_bSemiclip[host][ent] )
		{
			set_es( es_handle, ES_Solid, SOLID_NOT ); // makes semiclip flawless

			if( get_pcvar_num( g_iCvar[2] ) == 1 )
			{
				set_es( es_handle, ES_RenderMode, kRenderTransAlpha );
				set_es( es_handle, ES_RenderAmt, 85 );
			}
			else if( get_pcvar_num( g_iCvar[2] ) == 2 )
			{
				set_es( es_handle, ES_Effects, EF_NODRAW );
				set_es( es_handle, ES_Solid, SOLID_NOT );
			}
		}
	}
}

// is there a better way to detect changings of g_iCvar[0]?
public fwdClientCommand( plr )
{
	// use the forwards just when needed, for good performance
	if( !get_pcvar_num( g_iCvar[0] ) && g_bSemiclipEnabled )
	{
		unregister_forward( FM_PlayerPreThink, g_iForwardId[0] );
		unregister_forward( FM_PlayerPostThink, g_iForwardId[1] );
		unregister_forward( FM_AddToFullPack, g_iForwardId[2], 1 );

		g_bSemiclipEnabled = false;
	}
	else if( get_pcvar_num( g_iCvar[0] ) && !g_bSemiclipEnabled )
	{
		g_iForwardId[0] = register_forward( FM_PlayerPreThink, "fwdPlayerPreThink" );
		g_iForwardId[1] = register_forward( FM_PlayerPostThink, "fwdPlayerPostThink" );
		g_iForwardId[2] = register_forward( FM_AddToFullPack, "fwdAddToFullPack_Post", 1 );

		g_bSemiclipEnabled = true;
	}
}
dannyel98
Membru, skill 0
Membru, skill 0
Posts: 51
Joined: 26 Mar 2017, 20:58
Detinator Steam: Da
Detinator server CS: ZP.CSBLACKDEVIL.COM
SteamID: dannyel1998
Fond eXtream: 0

24 May 2019, 21:05

merge mersi
Last edited by dannyel98 on 24 May 2019, 21:09, edited 1 time in total.
..:: ZP.CSBLACKDEVIL.COM # 178.32.241.8:27015 # WWW.CSBLACKDEVIL.COM ::.
https://www.gametracker.com/server_info ... 1.8:27015/
User avatar
faKe91
Moderator ajutator
Moderator ajutator
Posts: 1412
Joined: 07 Oct 2014, 17:49
Detinator Steam: Da
CS Status: I <3 Heavy Metal
SteamID: dogseatmypancreas
Reputatie: Moderator ajutator
Fost Membru Club eXtreamCS (doua luni)
Fond eXtream: 0
Location: Republica Moldova, Chișinău
Has thanked: 7 times
Been thanked: 8 times

24 May 2019, 21:08

E bug de la forum nu afiseaza "i intre paranteze patrate" https://i.imgur.com/lJlZ7Tv.png

https://pastebin.com/wWtK78Sg
dannyel98
Membru, skill 0
Membru, skill 0
Posts: 51
Joined: 26 Mar 2017, 20:58
Detinator Steam: Da
Detinator server CS: ZP.CSBLACKDEVIL.COM
SteamID: dannyel1998
Fond eXtream: 0

24 May 2019, 21:10

a mers compilarea mersi era plugin care in timp mergea ce putea avea?
..:: ZP.CSBLACKDEVIL.COM # 178.32.241.8:27015 # WWW.CSBLACKDEVIL.COM ::.
https://www.gametracker.com/server_info ... 1.8:27015/
User avatar
cs_all
Moderator
Moderator
Posts: 765
Joined: 17 Dec 2013, 19:51
Detinator Steam: Da
Reputatie: Moderator
Fost Membru Club eXtreamCS (o luna)
Location: New Orleans
Has thanked: 1 time
Been thanked: 2 times

28 Jun 2019, 11:23

Marcat ca "Rezolvat"
Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 5 guests