Jump to content

Photo

[CS16-Request]Request?[Nerezolvat]


  • This topic is locked This topic is locked
12 replies to this topic

#1
old thE GOD

old thE GOD

    Addicted Member

  • Membru
  • 284 posts
  • 31 topics
  • Joined 16-March 14
  • Country: Country Flag
#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[i] );
						
					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[j][i] = 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[j][i] = 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;
	}
} 

Daca poti , as dorii ca atunci cand un player are lama in mana sa aiba semi-clip cu coechipieri , iar cand are oricealtceva , arma , grenada sa fie normal :).

Doar daca poti.


Edited by old thE GOD, 26 August 2014 - 09:48 PM.


#2
Andrei;

Andrei;

    Administrator

  • Administrator
  • 3201 posts
  • 398 topics
  • Joined 16-December 12
  • Country: Country Flag

Spoiler

 

Astept reply, sa stiu daca merge.


Edited by Artick ;, 27 August 2014 - 02:05 PM.

  • Shalkee likes this

#3
old thE GOD

old thE GOD

    Addicted Member

  • Topic Starter

  • Membru
  • 284 posts
  • 31 topics
  • Joined 16-March 14
  • Country: Country Flag
Ty , il verific cum intru pe pc si revin cu edit :).

#4
old thE GOD

old thE GOD

    Addicted Member

  • Topic Starter

  • Membru
  • 284 posts
  • 31 topics
  • Joined 16-March 14
  • Country: Country Flag

In primul rand provoaca lag destul de mare , in al doilea rand nu merge:) , acum am avut posibilitatea sa il testez.


  • Dr.Pufaa. likes this

#5
Andrei;

Andrei;

    Administrator

  • Administrator
  • 3201 posts
  • 398 topics
  • Joined 16-December 12
  • Country: Country Flag

In primul rand provoaca lag destul de mare , in al doilea rand nu merge:) , acum am avut posibilitatea sa il testez.

Mai exact, ce nu merge ? Vrei sa spui ca inainte mergea si dupa modificare numai merge ? Sigur ai setat bine cvarurile ?



#6
old thE GOD

old thE GOD

    Addicted Member

  • Topic Starter

  • Membru
  • 284 posts
  • 31 topics
  • Joined 16-March 14
  • Country: Country Flag

Sincer sa fiu nu l-am testat inainte sa fiu sigur daca merge dar in sursa de unde l-am luat receziile erau bune deci presupun ca merge .

Legat de acum , concret , imediat dupa ce a fost implementat a produs un lag urias , am incercat totusi sa vad daca corespund modificarile de on off si nu au mers , sper ca fost destul de explicit :).

Ca sa fiu sigur ca functiona inainte o sa-l testez pe cel original , pana atunci poate te uiti prin el sa vezi daca e totul bine setat :) sau sa faci tu altul tinand cont de modificarile alea poate reusesti sa faci unul functional :) doar daca esti dispus.

 

EDIT 1:

 

L-am verificat si inainte mergea fara probleme:).


Edited by old thE GOD, 02 September 2014 - 06:50 PM.


#7
Bogdan ;

Bogdan ;

    Fost Resource Team

  • Retired
  • 4341 posts
  • 386 topics
  • Joined 14-March 13
  • Country: Country Flag

Sincer sa fiu nu l-am testat inainte sa fiu sigur daca merge dar in sursa de unde l-am luat receziile erau bune deci presupun ca merge .

 

Sa nu mai faci asta niciodata cand ceri ajutorul cuiva,mai citeste odata si vezi cum suna.

 

Vezi poate te ajuta asta ,ai aici plugin de genul,ti-l setezi tu dupa cum vrei cu cvarurile pe care le pui in amxx.cfg

se poate da tc?



#8
old thE GOD

old thE GOD

    Addicted Member

  • Topic Starter

  • Membru
  • 284 posts
  • 31 topics
  • Joined 16-March 14
  • Country: Country Flag
Nu ai inteles tu :) pluginul default functioneaza eu vrea daca este posibil sa fie activ asupra playerilor numai cand au lama in mana , daca nu este posibil astept un răspuns dupa care se poate închide threadul , astept raspuns de la cineva competent cu cunostinte dezvoltate in amx , eu am încercat cateceva ,ori dădea eroare la compilare ori provoca probleme pe server.

#9
Bogdan ;

Bogdan ;

    Fost Resource Team

  • Retired
  • 4341 posts
  • 386 topics
  • Joined 14-March 13
  • Country: Country Flag

Observ ca eu cu artick nu prea te putem ajuta..au trecut 2 saptamani imediat..

Eu iti recomand urmatorul lucru :

Sunt expert in servere,am avut destule la viata mea,si iti zic din propria experienta:

La 24 sloturi iti permiti sa lasi jocul default,fara plugin de antiblock,pentru ca mapele sunt destul de mari iar jucatorii sunt mai putini,nu e 12vs12 24/24

 

E sfatul meu,ramane la decizia ta sa ma asculti sau nu


Edited by Bogdan ;, 12 September 2014 - 04:18 PM.


#10
old thE GOD

old thE GOD

    Addicted Member

  • Topic Starter

  • Membru
  • 284 posts
  • 31 topics
  • Joined 16-March 14
  • Country: Country Flag

In primul rand nu e serverul meu , in al doilea rand pluginul il vreau stric pentru utilizare personala pentru viitor ,astept in final decizia lui artick daca nu a rezolvat nimic si sa inchida threadul apoi , multumesc pentru timpul acordat , o zi buna,



#11
old thE GOD

old thE GOD

    Addicted Member

  • Topic Starter

  • Membru
  • 284 posts
  • 31 topics
  • Joined 16-March 14
  • Country: Country Flag

Din cate vad nu ati rezolvat nimic , in concluzie puteti inchide threadul.

 

Sper ca nu e 2x post au trecut mai mult de 24h.



#12
Bogdan ;

Bogdan ;

    Fost Resource Team

  • Retired
  • 4341 posts
  • 386 topics
  • Joined 14-March 13
  • Country: Country Flag
Ne pare rau pentru asta,insa iti garantez ca eu cu artick depunem munca serioasa sa va ajutam.o sa mai cautam o solutie pentru tine.si in caz ca reusim vom redeschide topicul.
  • Andrei; and Andreea; like this

#13
Andrei;

Andrei;

    Administrator

  • Administrator
  • 3201 posts
  • 398 topics
  • Joined 16-December 12
  • Country: Country Flag
Spoiler

 

Uite, incearca si varianta asta. Codul e destul de "amestecat" si fara sa testez nu imi pot da seama ce si cum. Imi dai pm ca sa stiu daca merge sau nu.


Edited by Artick, 14 September 2014 - 02:07 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users