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 130069864115036 dodana przez Skull3D, 21.03.2011 10:10
Typ:


xms
130069864115036
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.
369.
370.
371.
372.
373.
374.
375.
376.
377.
378.
379.
380.
381.
382.
383.
384.
385.
386.
387.
388.
389.
390.
391.
392.
393.
394.
395.
396.
397.
398.
399.
400.
401.
402.
403.
404.
405.
406.
407.
408.
409.
410.
411.
412.
413.
414.
415.
416.
417.
418.
419.
420.
421.
422.
423.
424.
425.
426.
427.
428.
429.
430.
431.
432.
433.
434.
435.
436.
437.
438.
439.
440.
441.
442.
443.
444.
445.
446.
447.
448.
449.
450.
451.
452.
453.
454.
455.
456.
457.
458.
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <amxmisc>
#include <nvault>
#include <ColorChat>
#include <fakemeta>
 
#define MAXLEVEL 10
#define prefix "XP"
 
 
/*--------===== HEAD SPLASH DEFINES =====-------*/
 
#define MINIMUM_FALL_SPEED 0.01
#define MAXIMUM_DAMAGE_FROM_JUMP 70
#define DAMAGE 70
#define DELAY 0.01
 
 
new const LEVELS[10] = {
	// Level
	500,    // 1
	3000,    // 2
	8000,    // 3
	15000,    // 4
	19000,    // 5
	25000,    // 6
	31000,    // 7
	38000,    // 8
	41000,    // 9
	50000    // 10
};
 
new const RANGI[10][] = {
	"Ranga 1",
	"Ranga 2",
	"Ranga 3",
	"Ranga 4",
	"Ranga 5",
	"Ranga 6",
	"Ranga 7",
	"Ranga 8",
	"Ranga 9",
	"Ranga 10"
};
 
/*--------===== ZMIENNE GLOBALNE =====-------*/
new g_Vault,xp_kill,xp_hs,xp_headsplash,SkillPoints[33],PlayerXP[33],PlayerLevel[33];
new pointshp[33], pointsgranat[33];  
 
new Float:falling_speed[33];
new Float:damage_after[33][33];
new amx_headsplash;
new sprite_blood;
new sprite_bloodspray;
 
public plugin_init() 
{
	/*--------===== REJERSTRACJA PLUGINU =====-------*/
 
	register_plugin("SILNIK XP MOD", "1.0", "xmS")
 
	/*--------===== CVARY =====-------*/
 
	register_cvar("xp_kill", "25")
	register_cvar("xp_hs","10")
	register_cvar("xp_headsplash","35")
 
 
	amx_headsplash     =     register_cvar("amx_headsplash", "1");
 
	/*--------===== ZMIENNE GLOBALNE =====-------*/
 
	xp_kill     =     get_cvar_num("xp_kill")
	xp_hs         =     get_cvar_num("xp_hs")
	xp_headsplash     =     get_cvar_num("xp_headsplash")
	g_Vault     =     nvault_open("xms_xp_mod");
 
	/*--------===== FORWARDS =====-------*/
 
	register_forward(FM_PlayerPreThink, "hud_prethink");
	register_forward(FM_Touch, "forward_touch");
 
 
	/*--------===== EVENTS =====-------*/
 
	register_event("DeathMsg", "eDeath", "a");
 
	/*------==== LOG EVENTY ====-----*/
 
	register_logevent("EventRoundStart",2,"1=Round_Start");
}
 
 
public EventRoundStart(id)
{ 
	for (new id=0; id < 32; id++)
	{
		new starthealth = get_user_health( id ); // sprawdzamy ile gracz ma zycia
 
		set_user_health( id, pointshp[id] * 10 + starthealth ); // do jego zycia dodajemy nasz skill 
		// razy 10 czyli 1 * 10 = 10 (2 * 10 = 20 etc.) + jego zycie na start
 
	}
      if(pointsgranat[id] >= 1) 
      {
        set_task(5.0, "weapon_granaty", id);
      }
}  
 
public eDeath() { 
	new attacker = read_data( 1 ); 
	new ofiara = read_data( 2 );
	new headshot = read_data( 3 ); 
 
	if(ofiara != attacker && attacker != 0)
	{
		if(get_user_team(attacker) != get_user_team(ofiara))
		{
			PlayerXP[attacker] += xp_kill;
 
			if(headshot) 
			{
				PlayerXP[attacker] += xp_hs; 
				ColorChat(attacker,GREEN,"[%s]^x01: Dostales ^x04%d^x01 xp za zabicie wroga oraz bonus^x04 %d^x01 xp za headshot'a !",prefix,xp_kill,xp_hs);    
			}
			else
			{
				ColorChat(attacker,GREEN,"[%s]^x01: Dostales ^x04%d^x01 xp za zabicie wroga",prefix,xp_kill);
			}
		}
	}
	while(PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]]) 
	{ 
		PlayerLevel[attacker] += 1;
		SkillPoints[attacker] += 1;
		ColorChat(attacker,GREEN,"[%s]^x01: Gratuluje, wbiles poziom ! Twoj Poziom to :^x03 %d^x01, posiadasz :^x03 %d^x01 punktow skilli.",prefix,PlayerLevel[attacker],SkillPoints[attacker]); 
	}  
}
 
public hud_prethink(id)
{
	if(PlayerLevel[id]>=MAXLEVEL)
	{
		new text[512]
		format(text,511,"Level: %d Exp: %d Ranga: %s",PlayerLevel[id],PlayerXP[id],RANGI[PlayerLevel[id]])
		message_begin(MSG_ONE,get_user_msgid("StatusText"),{0,0,0}, id)
		write_byte(0)
		write_string(text)
		message_end() 
	}
	else
	{
		new text[512]
		format(text,511,"Level: %d Exp: %d/%d (+%d) Ranga: %s", PlayerLevel[id], PlayerXP[id], LEVELS[PlayerLevel[id]],LEVELS[PlayerLevel[id]]-PlayerXP[id],RANGI[PlayerLevel[id]])
		message_begin(MSG_ONE,get_user_msgid("StatusText"),{0,0,0}, id)
		write_byte(0)
		write_string(text)
		message_end() 
	}
}
 
public skill_menu(id)
{
	new msgtitle[128]
	format(msgtitle,127,"\w[\rExpMod\w]\y Posiadasz skillow: %d", SkillPoints[id]);
	new menu_exp = menu_create(msgtitle, "cbskill_menu") // dajemy w title format, poniewaz nowy styl menu nie obsluguje zmiennych po przecinku
	menu_additem(menu_exp  , "Zycie", "1", 0)
	menu_additem(menu_exp  , "Granaty", "2", 0)
	menu_setprop(menu_exp,MPROP_EXITNAME,"\wWyjscie"); // zamieniamy exit na wyjscie
	menu_display(id, menu_exp, 0)
}
public cbskill_menu(id, menu  , item)
{
	new data[6], iName[64]
	new acces, callback
	menu_item_getinfo(menu, item, acces, data,5, iName, 63, callback)
 
	new klawisz = str_to_num(data)
 
	switch(klawisz)
	{ 
		case 1 : {
			if(SkillPoints[id] == 0) { // sprawdzamy czy posiada wolny skill
				ColorChat(id, GREEN, "[Exp Mod]^x01 Nie posiadasz wolnych skillow!");
			}
			else 
			{
				if(pointshp[id] >= 5) { // jesli gracz dodal 5 skilli do zycia to juz nie moze
					ColorChat(id, GREEN, "[Exp Mod]^x01 Masz juz maksymalna ilosc skillow");
				}
				else 
				{
					SkillPoints[id] -= 1; // zabieramy wolny skill
					pointshp[id] += 1; // dodajemy skill zycia
					ColorChat(id, GREEN, "******** Dodanie skilla do Zycia zakonczone sukcesem!");
				}
			}
		}
		case 2 : {
			if(SkillPoints[id] == 0) { // sprawdzamy czy posiada wolny skill
				ColorChat(id, GREEN, "[Exp Mod]^x01 Nie posiadasz wolnych skillow!");
			}
			else 
			{
				if(pointsgranat[id] >= 5) { // jesli gracz dodal 5 skilli do zycia to juz nie moze
					ColorChat(id, GREEN, "[Exp Mod]^x01 Masz juz maksymalna ilosc skillow");
				}
				else 
				{
					SkillPoints[id] -= 1; // zabieramy wolny skill
					pointsgranat[id] += 1; // dodajemy skill zycia
					ColorChat(id, GREEN, "******** Dodanie skilla do Zycia zakonczone sukcesem!");
				}
			}
		}
	}
} 
 
public client_connect(id)
{
	LoadXp(id);
}
 
public client_disconnect(id)
{
	SaveXp(id);
}
 
public SaveXp(id) {
	new AuthID[35]; 
	get_user_authid(id, AuthID, 34); 
 
	new vaultkey[64], vaultdata[256]; 
	format(vaultkey, 63, "%s-Mod", AuthID); 
	format(vaultdata, 255, "%i#%i#%i#%i#", PlayerXP[id], PlayerLevel[id],SkillPoints[id], pointshp[id], pointsgranat[id]); 
	nvault_set(g_Vault, vaultkey, vaultdata); 
	return PLUGIN_CONTINUE; 
}  
 
public LoadXp(id) {
	new AuthID[35]; 
	get_user_authid(id,AuthID,34); 
 
	new vaultkey[64], vaultdata[256]; 
	format(vaultkey, 63, "%s-Mod", AuthID); 
	format(vaultdata, 255, "%i#%i#%i#%i#", PlayerXP[id], PlayerLevel[id],SkillPoints[id], pointshp[id], pointsgranat[id]); 
	nvault_get(g_Vault, vaultkey, vaultdata,255); 
 
	replace_all(vaultdata, 255, "#", " "); 
 
	new playerxp[32], playerlevel[32], SkillPointsx[32], pointshpx[32], pointsgranatx[32];
 
	parse(vaultdata, playerxp, 31, playerlevel, 31, SkillPointsx, 31, pointshpx, 31, pointsgranatx, 31); 
 
	PlayerXP[id] = str_to_num(playerxp); 
	PlayerLevel[id] = str_to_num(playerlevel); 
	SkillPoints[id] = str_to_num(SkillPointsx);
	pointshp[id] = str_to_num(pointshpx);
	pointsgranat[id] = str_to_num(pointsgranatx);
	return PLUGIN_CONTINUE; 
}  
 
public forward_touch(toucher, touched) 
{
 
	if(!is_user_alive(toucher) || !is_user_alive(touched)) 
		return;
 
	if(!get_pcvar_num(amx_headsplash)) 
		return;
 
	if(falling_speed[touched]) 
		return;
 
	if(get_user_team(toucher) == get_user_team(touched) && !get_cvar_num("mp_friendlyfire")) 
		return;
 
	new touched_origin[3], toucher_origin[3];
	get_user_origin(touched, touched_origin); 
	get_user_origin(toucher, toucher_origin);
 
	new Float:toucher_minsize[3], Float:touched_minsize[3];
	pev(toucher,pev_mins,toucher_minsize);
	pev(touched,pev_mins,touched_minsize); 
 
	if(touched_minsize[2] != -18.0) 
	{
		if(!(toucher_origin[2] == touched_origin[2]+72 && toucher_minsize[2] != -18.0) && !(toucher_origin[2] == touched_origin[2]+54 && toucher_minsize[2] == -18.0))
		{
			return;
		}
	}
	else 
	{
		if(!(toucher_origin[2] == touched_origin[2]+68 && toucher_minsize[2] != -18.0) && !(toucher_origin[2] == touched_origin[2]+50 && toucher_minsize[2] == -18.0))
		{
			return;
		}
	}
 
	if(falling_speed[toucher] >= MINIMUM_FALL_SPEED)
	{
		new Float:damage = ((falling_speed[toucher] - MINIMUM_FALL_SPEED + 30) * (falling_speed[toucher] - MINIMUM_FALL_SPEED + 30)) / 1300;
		if(damage > MAXIMUM_DAMAGE_FROM_JUMP)
			damage = MAXIMUM_DAMAGE_FROM_JUMP;
		damage_player(touched, toucher, damage);
		damage_after[toucher][touched] = 0.0; 
	}
	if(is_user_alive(touched) && damage_after[toucher][touched] <= get_gametime())
	{
		damage_after[toucher][touched] = get_gametime() + DELAY;
		damage_player(touched, toucher, DAMAGE);
	}
}
 
public damage_player(pwned, pwnzor, Float:damage)
{
	new health = get_user_health(pwned);
	if(get_user_team(pwned) == get_user_team(pwnzor))
		damage /= 1.4;
	new CsArmorType:armortype;
	cs_get_user_armor(pwned, armortype);
	if(armortype == CS_ARMOR_VESTHELM)
		damage *= 0.7;
	if(health >  damage)
	{
		new pwned_origin[3];
		get_user_origin(pwned, pwned_origin);
		message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
		write_byte(TE_BLOODSPRITE);
		write_coord(pwned_origin[0]+8);
		write_coord(pwned_origin[1]);
		write_coord(pwned_origin[2]+26);
		write_short(sprite_bloodspray);
		write_short(sprite_blood);
		write_byte(248);
		write_byte(4);
		message_end();
 
		new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "trigger_hurt"));
		if(!ent)
			return;
		new value[16];
		float_to_str(damage * 2, value, sizeof value - 1);
		set_kvd(0, KV_ClassName, "trigger_hurt");
		set_kvd(0, KV_KeyName, "dmg");
		set_kvd(0, KV_Value, value);
		set_kvd(0, KV_fHandled, 0);
		dllfunc(DLLFunc_KeyValue, ent, 0);
		num_to_str(DMG_GENERIC, value, sizeof value - 1);
		set_kvd(0, KV_ClassName, "trigger_hurt");
		set_kvd(0, KV_KeyName, "damagetype");
		set_kvd(0, KV_Value, value);
		set_kvd(0, KV_fHandled, 0);
		dllfunc(DLLFunc_KeyValue, ent, 0);
		set_kvd(0, KV_ClassName, "trigger_hurt");
		set_kvd(0, KV_KeyName, "origin");
		set_kvd(0, KV_Value, "8192 8192 8192");
		set_kvd(0, KV_fHandled, 0);
		dllfunc(DLLFunc_KeyValue, ent, 0);
		dllfunc(DLLFunc_Spawn, ent);
		set_pev(ent, pev_classname, "head_splash");
		dllfunc(DLLFunc_Touch, ent, pwned);
		engfunc(EngFunc_RemoveEntity, ent);
	}
	else
	{
		new pwned_origin[3];
		get_user_origin(pwned, pwned_origin);
		message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
		write_byte(TE_BLOODSPRITE);
		write_coord(pwned_origin[0]+8);
		write_coord(pwned_origin[1]);
		write_coord(pwned_origin[2]+26);
		write_short(sprite_bloodspray);
		write_short(sprite_blood);
		write_byte(248);
		write_byte(12);
		message_end();
 
		set_pev(pwned, pev_frags, float(get_user_frags(pwned) + 1));
		user_silentkill(pwned);
		make_deathmsg(pwnzor, pwned, 1, "his/her feet :)");
		if(get_user_team(pwnzor) != get_user_team(pwned))
		{
			set_pev(pwnzor, pev_frags, float(get_user_frags(pwnzor) + 1));
			cs_set_user_money(pwnzor, cs_get_user_money(pwnzor) + 300);
			PlayerXP[pwnzor]+=xp_headsplash;
			ColorChat(pwnzor,GREEN,"[%s]^x01: Zabiles headsplashem , dostales %d xp.",prefix,xp_headsplash);
 
			while(PlayerXP[pwnzor] >= LEVELS[PlayerLevel[pwnzor]]) 
			{ 
				client_cmd(pwnzor,"stopsound;wait;mp3 play sound/misc/xmsexpmod/lvlup.mp3")
				PlayerLevel[pwnzor] += 1;
				SkillPoints[pwnzor] += 1;
				ColorChat(pwnzor,GREEN,"[%s]^x01: Level UP ! Twoj Poziom =^x03 %d^x01 Skill Points =^x03 %d",prefix,PlayerLevel[pwnzor],SkillPoints[pwnzor]); 
			} 
 
 
		}
		else
		{
			set_pev(pwnzor, pev_frags, float(get_user_frags(pwnzor) - 1));
			cs_set_user_money(pwnzor, cs_get_user_money(pwnzor) - 300);
		}
 
		message_begin(MSG_ALL, get_user_msgid("ScoreInfo"));
		write_byte(pwnzor);
		write_short(get_user_frags(pwnzor));
		write_short(cs_get_user_deaths(pwnzor));
		write_short(0);
		write_short(get_user_team(pwnzor));
		message_end();
 
		message_begin(MSG_ALL, get_user_msgid("ScoreInfo"));
		write_byte(pwned);
		write_short(get_user_frags(pwned));
		write_short(cs_get_user_deaths(pwned));
		write_short(0);
		write_short(get_user_team(pwned));
		message_end();
		set_pev(pwned, pev_frags, float(get_user_frags(pwned) - 1));
	}
}  
 
public weapon_granaty(id) 
{
new los = random_num(1, 100);
 
if(los <= 50 * pointsgranat[id])
{
    if (get_user_team(id) == 1) // 1 - terro
    {
        give_item(id, "weapon_smokegrenade");
        give_item(id, "weapon_hegrenade");
        give_item(id, "weapon_flashbang");
        give_item(id, "weapon_flashbang");
        ColorChat(id, GREEN, "[%d '/.]^x01 Dostales Zestaw Granatow!", 50 * pointsgranat[id]);
    }
    else
    {
        //give_item(id, "weapon_smokegrenade");
        give_item(id, "weapon_hegrenade");
        //give_item(id, "weapon_flashbang");
        //give_item(id, "weapon_flashbang");
        ColorChat(id, GREEN, "[%d '/.]^x01 Dostales Granata Wybuchowego!", 50 * pointsgranat[id]);
    }
 
}
 
else 
{// 56 procent ze nic nie wypadnie
    //ColorChat(id, GREEN, "[xmS? XpMOD]^x01 Pech.. nic nie wylosowales.");
}
}