Skocz do zawartości

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Wklejka 5zyig0m73mhw dodana przez Droso, 27.10.2013 12:41
Typ:



1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
155.
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
166.
167.
168.
169.
170.
171.
172.
173.
174.
175.
176.
177.
178.
179.
180.
181.
182.
183.
184.
185.
186.
187.
188.
189.
190.
191.
192.
193.
194.
195.
196.
197.
198.
199.
200.
201.
202.
203.
204.
205.
206.
207.
208.
209.
210.
211.
212.
213.
214.
215.
216.
217.
218.
219.
220.
221.
222.
223.
224.
225.
226.
227.
228.
229.
230.
231.
232.
233.
234.
235.
236.
237.
238.
239.
240.
241.
242.
243.
244.
245.
246.
247.
248.
249.
250.
251.
252.
253.
254.
255.
256.
257.
258.
259.
260.
261.
262.
263.
264.
265.
266.
267.
268.
269.
270.
271.
272.
273.
274.
275.
276.
277.
278.
279.
280.
281.
282.
283.
284.
285.
286.
287.
288.
289.
290.
291.
292.
293.
294.
295.
296.
297.
298.
299.
300.
301.
302.
303.
304.
305.
306.
307.
308.
309.
310.
311.
312.
313.
314.
315.
316.
317.
318.
319.
320.
321.
322.
323.
324.
325.
326.
327.
328.
329.
330.
331.
332.
333.
334.
335.
336.
337.
338.
339.
340.
341.
342.
343.
344.
345.
346.
347.
348.
349.
350.
351.
352.
353.
354.
355.
356.
357.
358.
359.
360.
361.
362.
363.
364.
365.
366.
367.
368.
#include <amxmodx>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <xs>
 
new ModelWeapon[] = "models/p_glock18.mdl"
new ModelWeaponID
new CheckVisibilityForward = 0;
 
new Models[CsTeams][] =
{
	"",
	"models/player/leet/leet.mdl",
	"models/player/sas/sas.mdl",
	""
}
 
new ModelsIDs[CsTeams]
new CurrentEnt
new const Plugin[] = "Lucia Hallucination"
new const Author[] = "joaquimandrade"
new const Version[]	= "1.0"
 
enum EntityData
{
	Origin[3],
	Angles[3],
CsTeams:Team
}
 
const MaxSlots = 32
 
new UserEntityData[MaxSlots+1][EntityData]
 
 
new Float:LastTimeViewedAnEntity[MaxSlots+1]
 
const PermissionFlag = ADMIN_BAN
 
 
new CurrentHost;
 
new Float:VectorNormalHideStartFactor = 46.0
new Float:VectorNormalHideEndFactor = 40.0
 
new Float:VectorNormalHideStep = 1.0
 
new const Float:PlayerRay = 22.0
new const Float:HullFactor = 0.5
 
const Float:PlayerHideMaxDistance = 1200.0
 
new CsTeams:Teams = CS_TEAM_T + CS_TEAM_CT
 
new OnFirstPersonViewN
 
new ForwardAddToFullPackPre
new ForwardAddToFullPackPost
new bool:obserwowany[33];
 
public plugin_precache()
{
	ModelWeaponID = precache_model(ModelWeapon)
 
	ModelsIDs[CS_TEAM_T] = precache_model(Models[CS_TEAM_T])
	ModelsIDs[CS_TEAM_CT] = precache_model(Models[CS_TEAM_CT])
}
public plugin_init()
{
	register_plugin(Plugin,Version,Author)
 
	register_cvar("luciaHallucination",Version,FCVAR_SERVER|FCVAR_SPONLY);
	register_event("CurWeapon","CurWeapon","be", "1=1")
}
 
 
public addToFullPackPre(es, e, ent, host, hostflags, player, pSet)
{
	if(player && (host != ent) && is_user_alive(ent))
	{
		if(LastTimeViewedAnEntity[host] != get_gametime() && is_user_alive(host) && obserwowany[host] && cs_get_user_team(host) != cs_get_user_team(ent))
		{
			if(!engfunc(EngFunc_CheckVisibility, ent, pSet))
			{
				CurrentEnt = ent
				CurrentHost = host
 
				if(!CheckVisibilityForward)
				{
					CheckVisibilityForward = register_forward(FM_CheckVisibility,"checkVisibility")
				}
			}
		}
	}
}
 
 
public checkVisibility(id,pset)
{	
	if(CurrentEnt == id)
	{
		unregister_forward(FM_CheckVisibility,CheckVisibilityForward)
		CheckVisibilityForward = 0
 
		forward_return(FMV_CELL,1)
		return FMRES_SUPERCEDE
	}
 
	return FMRES_IGNORED
}
 
public addToFullPackPost(es, e, ent, host, hostflags, player, pSet)
{	
	if((host == CurrentHost) && (ent == CurrentEnt))
	{	
		LastTimeViewedAnEntity[CurrentHost] = get_gametime();
		new CsTeams:team
		new spectated = host
		team = UserEntityData[spectated][Team]
 
		set_es(es,ES_Origin,Float:UserEntityData[host][Origin]);
		set_es(es,ES_Angles,Float:UserEntityData[spectated][Angles]);
		set_es(es,ES_RenderMode,kRenderTransAlpha);
		set_es(es,ES_RenderAmt,170);
 
		new CsTeams:enemyTeam = Teams - team
 
		set_es(es,ES_Team,_:enemyTeam);
		set_es(es,ES_ModelIndex,ModelsIDs[enemyTeam]);
		set_es(es,ES_WeaponModel,ModelWeaponID);
		set_es(es,ES_Effects,EF_INVLIGHT);
	}
 
	CurrentHost = CurrentEnt = 0
}
 
 
public DodajemyGracza(id)
{	
	if(is_user_alive(id)){
		obserwowany[id] = true;
		remove_task(id);
		set_task(5.0, "PobierajOriginGracza", id, _,_, "b");
		if(!OnFirstPersonViewN++)
		{
			ForwardAddToFullPackPre = register_forward(FM_AddToFullPack,"addToFullPackPre",0);
			ForwardAddToFullPackPost = register_forward(FM_AddToFullPack,"addToFullPackPost",1)
		}
		getEntityData(id);
	}
	else
	set_task(6.0, "DodajemyGracza", id);
}
 
UsuwamyGracza(id)
{	
	obserwowany[id] = false;
	remove_task(id);
	if(!--OnFirstPersonViewN)
	{
		unregister_forward(FM_AddToFullPack,ForwardAddToFullPackPre)
		unregister_forward(FM_AddToFullPack,ForwardAddToFullPackPost,1)
	}
}
 
 
public client_disconnect(id){
	if(obserwowany[id])
	UsuwamyGracza(id);
 
	remove_task(id);
}
 
public client_putinserver(id){
	set_task(6.0, "DodajemyGracza", id);
	// Wiem ze da to wszystkim graczom, ale i tak to jest tylko do testow i tylko ja jestem i boty na serwerze :D
}
 
hullCheck(Float:origin[3])
{	
	static Float:margin[3]
 
	xs_vec_copy(origin,margin)
 
	for(new i=0;i<3;i++)
	margin[i] += HullFactor
 
	engfunc(EngFunc_TraceHull,origin,margin,1,HULL_POINT,0,0)
	return get_tr2(0,TR_AllSolid)
 
}
 
bool:isSafeHideOrigin(Float:origin[3])
{
	static Float:centerPointsZDistanceMultiply[] = {1.2,0.5,0.0,-0.5,-1.0,-1.5}
	static Float:centerPoints[sizeof centerPointsZDistanceMultiply][3]
 
	for(new i=0;i<sizeof centerPointsZDistanceMultiply;i++)
	{
		xs_vec_copy(origin,centerPoints[i])
		centerPoints[i][2] += centerPointsZDistanceMultiply[i] * (PlayerRay)
 
		if(!hullCheck(centerPoints[i]))
		{
			return false
		}
 
		static Float:borderPointsXYDistanceMultiply[4][2] = {{0.0,1.2},{1.2,0.0},{0.0,-1.2},{-1.2,0.0}}
 
		for(new j=0;j<4;j++)
		{
			static Float:borderPoint[3]
			xs_vec_copy(centerPoints[i],borderPoint)
 
			for(new k=0;k<2;k++)
			{
				borderPoint[k] += borderPointsXYDistanceMultiply[j][k] * (PlayerRay)
			}
 
			if(!hullCheck(borderPoint))
			{
				return false
			}
		}
	}
 
	return true
}
 
getEntityData(id)
{
	static Float:origin[3],Float:viewAngles[3],Float:viewOfs[3]
 
	pev(id,pev_origin,origin)
	pev(id,pev_view_ofs,viewOfs)
 
	xs_vec_add(origin,viewOfs,origin)
 
	pev(id,pev_v_angle,viewAngles)
 
	static Float:path[3]
 
	angle_vector(viewAngles,ANGLEVECTOR_FORWARD,path)
	xs_vec_normalize(path,path)
 
	xs_vec_mul_scalar(path,PlayerHideMaxDistance,path)
 
	static Float:end[3]
 
	xs_vec_add(origin,path,end)
 
	engfunc(EngFunc_TraceLine,origin,end,0,id,0);
 
	static Float:fraction
	get_tr2(0,TR_flFraction,fraction)
 
	if((fraction != 1.0) && (get_tr2(0,TR_Hit) == -1))
	{
		get_tr2(0,TR_EndPos,end)
 
		static Float:normal[3]
		get_tr2(0,TR_vecPlaneNormal,normal)
 
		static Float:normalPath[3]
 
		for(new Float:i=VectorNormalHideStartFactor;i>=VectorNormalHideEndFactor;i-=VectorNormalHideStep)
		{
			xs_vec_mul_scalar(normal,-i,normalPath)
			xs_vec_add(end,normalPath,normalPath)
 
			if(isSafeHideOrigin(normalPath))
			{
				static Float:angles[3]
 
				vector_to_angle(normal,angles)
 
				if(angles[0] > 0.0)
				angles[0] = 0.0
 
				xs_vec_copy(angles,Float:UserEntityData[id][Angles])
				xs_vec_copy(normalPath,Float:UserEntityData[id][Origin])
 
				UserEntityData[id][Team] = _:cs_get_user_team(id)
 
				return true
			}
		}
	}
 
	return false
}
 
getEntityData2(id)
{
	static Float:origin[3],Float:viewAngles[3],Float:viewOfs[3]
 
	pev(id,pev_origin,origin)
	pev(id,pev_view_ofs,viewOfs)
 
	xs_vec_add(origin,viewOfs,origin)
 
	pev(id,pev_v_angle,viewAngles)
 
	static Float:path[3]
 
	angle_vector(viewAngles,ANGLEVECTOR_FORWARD,path)
	xs_vec_normalize(path,path)
 
	xs_vec_mul_scalar(path,PlayerHideMaxDistance,path)
 
	static Float:end[3]
 
	xs_vec_add(origin,path,end)
 
	engfunc(EngFunc_TraceLine,origin,end,0,id,0);
 
	static Float:fraction
	get_tr2(0,TR_flFraction,fraction)
 
	if((fraction != 1.0) && (get_tr2(0,TR_Hit) == -1))
	{
		get_tr2(0,TR_EndPos,end)
 
		static Float:normal[3]
		get_tr2(0,TR_vecPlaneNormal,normal)
 
		static Float:normalPath[3]
 
		for(new Float:i=VectorNormalHideStartFactor;i>=VectorNormalHideEndFactor;i-=VectorNormalHideStep)
		{
			xs_vec_mul_scalar(normal,-i,normalPath)
			xs_vec_add(end,normalPath,normalPath)
 
			if(isSafeHideOrigin(normalPath))
			{
				xs_vec_copy(normalPath,Float:UserEntityData[id][Origin])
				return true
			}
		}
	}
 
	return false
}
 
public PobierajOriginGracza(id){
	if(is_user_alive(id))
	getEntityData2(id);
}
 
public CurWeapon(id)
{
	if(!obserwowany[id])
	return;
 
	if(!is_user_alive(id))
	return;
 
	new wid = read_data(2);
 
	if(wid == CSW_KNIFE || wid == CSW_HEGRENADE || wid == CSW_SMOKEGRENADE || wid == CSW_FLASHBANG)
	return;
 
	if(get_user_button(id) & IN_ATTACK){		
		// XX
		// UserEntityData[id][Origin] - origin es (bytu [gracza] ktory jest w scianie)
	}
}

Dodanych wklejek: 11179
Powered By (Pav32) Pastebin © 2011