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 t1cptk6w8hcs dodana przez , 03.05.2012 19:10
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.
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>
 
#define MAX_PLAYERS 32
 
new bool:g_hs_mode
new display_hud
new bool:g_RestartAttempt[MAX_PLAYERS+1]
new g_fwid
 
new HamHook:fw_TraceAttack;
new g_iMaxPlayers;
 
_Un_RegisterHamForwards(on = 0)
{
	on ? EnableHamForward(fw_TraceAttack) : DisableHamForward(fw_TraceAttack);
}
 
public plugin_init() {
	register_plugin("HeadShot Mod", "1.1b", "ConnorMcLeod")
	register_dictionary("hs_only.txt")
 
	register_event("TextMsg", "eRestartAttempt", "a", "2=#Game_will_restart_in")
	register_event("ResetHUD", "eResetHUD", "be")
 
	register_concmd("amx_hs_mode", "switchCmd", ADMIN_KICK, "- <0|1> : Hs Only Mode = Disabled|Enabled")
	register_clcmd("clcmd_fullupdate", "fullupdateCmd")
 
	display_hud = register_cvar("amx_hs_display", "1")
 
	fw_TraceAttack = RegisterHam(Ham_TraceAttack, "player", "Forward_TraceAttack");
	g_iMaxPlayers = get_maxplayers();
}
 
public fullupdateCmd() {
	return PLUGIN_HANDLED_MAIN
}
 
public eRestartAttempt() {
	new players[MAX_PLAYERS], num
	get_players(players, num, "a")
	for (new i; i < num; ++i)
		g_RestartAttempt[players[i]] = true
}
 
public eResetHUD(id) {
	if (g_RestartAttempt[id]) {
		g_RestartAttempt[id] = false
		return
	}
	event_player_spawn(id)
}
 
event_player_spawn(id) {
	if( g_hs_mode && get_pcvar_num(display_hud) )
		display_status(id);
}
 
public switchCmd(id, level, cid) {
	if(!cmd_access(id, level, cid, 2))
		return PLUGIN_HANDLED
 
	new arg[2]
	read_argv(1, arg, 1)
 
	new temp = str_to_num(arg)
 
	switch(temp) {
		case 0: {
			if(!g_hs_mode) {
				client_print(id, print_console, "Hs Only Mod already Disabled")
			}
			else {
				unregister_forward(FM_TraceLine, g_fwid, 1)
				g_hs_mode = false
				client_print(id, print_console, "Hs Only Mod Disabled")
			}
		}
		case 1: {
			if(g_hs_mode) {
				client_print(id, print_console, "Hs Only Mod already Enabled")
			}
			else {
				g_fwid = register_forward(FM_TraceLine, "forward_traceline", 1)
				g_hs_mode = true
				client_print(id, print_console, "Hs Only Mod Enabled")
				display_status()
			}
		}
		default: {
			client_print(id, print_console, "amx_hs_mode <0|1> : Hs Only Mode = Disabled|Enabled")
		}
	}
	_Un_RegisterHamForwards(display_hud);
	return PLUGIN_HANDLED
}
 
public Forward_TraceAttack(id, attacker, Float:dmg, Float:dir[3], tr, dmgbit)
{
	if(id != attacker && get_tr2(tr, TR_iHitgroup) != HIT_HEAD && get_pcvar_num(display_hud))
	{
		if(1 <= attacker <= g_iMaxPlayers)
		{
			if(!get_pcvar_num(display_hud) && get_user_weapon(attacker) == CSW_KNIFE)
			{
				return HAM_IGNORED;
			}
 
			return HAM_SUPERCEDE;
		}
	}
 
	return HAM_IGNORED;
}
 
display_status(id=0){
	switch( get_pcvar_num(display_hud) )
	{
		case 1: {
			set_hudmessage(255, 10, 0, 0.05, 0.60, 2, 0.1, 6.0, 0.1, 0.15, -1)
			show_hudmessage(id, "%L", id ? id : LANG_PLAYER, "HS_MODE_ON")
		}
		case 2:client_print(id, print_chat, "%L", id ? id : LANG_PLAYER, "HS_MODE_ON")
	}
}
 

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