[AMX][Codes] Hỏi đáp về các code của AMX ...

  • Thread starter Thread starter sontung0
  • Ngày gửi Ngày gửi
Status
Không mở trả lời sau này.
anh Chief hiểu nhầm ý em rồi, ý em là cái command đó có Code như thế nào
về Fastrun nha ^^
 
Bộ ông tưởng Tôi Dựa vào sv Thebest àh :)).
=> Có vài cái hay thì làm giống chứ dựa thì ăn cám là vừa :|
 
Ta không nói chú dựa vào The Best.. Sao tự nhiên kêu lên The Best ở đây :)) ta chỉ comment lại cái mà chú nói ở trên kia kìa.
 
Cái Plugin Effeck killer hiện 1 spr có file sma ko,của sontung để time kill tận 8 thì cao wá,mún chỉnh lại 4 thôi
 
bắt đầu nội chiến rồi đây
@Chife :ok
 
Mấy bác cho hỏi có cách nào để lưu code của amx ko
 
Anh không hiểu em đang nói gì...file source của amxx định dạng sma, các code lưu trong đó.
 
@Ken: Ông có thể tùy chỉnh cvar các plug-in của anh Tùng trong file nst.ini đc mà :| nst_ek có 2 cvar tui hay chỉnh là nst_time_show (thời gian hiển thị) và nst_time_kill (thời gian xuất hiện giữa các sprite - Cái ông cần đấy :D)
 
Trong cái ấy không có cvar chỉnh thời gian khoảng cách giữa 2 combo..
 
Plugin effect killer đầu của anh tùng chỉ hiện 1 spr thôi,có 3 cvar là type sex time,mặc định anh tùng để time là 8 rồi,tui mún chỉnh lại 4 nên mới cần sma,ko lẽ mỗi lần vào chơi cứ phải gõ @-@
 
Thế mới bảo gõ dòng cvar đó vào nst.ini để nó mặc định hóa
@Chief: Đúng là cài mặc định thì ko có thật, nhưng tự add vào nó vẫn có tác dụng chứ nhỉ :D
 
Thế mới bảo gõ dòng cvar đó vào nst.ini để nó mặc định hóa
@Chief: Đúng là cài mặc định thì ko có thật, nhưng tự add vào nó vẫn có tác dụng chứ nhỉ :D

èo,phải tạo 1 file nst.ini à
 
Cái thời gian xem trong đống code có đấy, không nhớ ở line nào...
 
ko dc ợ,ver mới của NST thì có 4 cvar,ver cũ thì 3,cái ver cũ chỉ hiện 1 spr 1 lần thui,cái tui cần là ver cũ ý mà lại ko có sma
 
Ver cũ xem mấy trang đầu của bác Tùng.
 
ko dc ợ,ver mới của NST thì có 4 cvar,ver cũ thì 3,cái ver cũ chỉ hiện 1 spr 1 lần thui,cái tui cần là ver cũ ý mà lại ko có sma
cho cậu sma của Effects Killer V3.0 luôn này: (chỉ dùng đc trong CSO NST thôi nhé.vì nó dùng vài native của NST Wpn và Player)
Muốn chỉ tính đến 4 kill thì chỉnh cái #define LEVELS 8
Còn muốn dùng độc lập plugin thì thay thế vài cái native bằng các cvar là đc
Tự vọc nhớ
PHP:
#include <amxmodx>
#include <fakemeta>

#include <nst_player>
#include <nst_zombie>
#include <nst_wpn>


#define PLUGIN "Effects Killer"
#define VERSION "3.0"
#define AUTHOR "NST"

#define LEVELS 8
new kills[33], Float:timekill[33], revenge[33], oneshot[33]
new iconstatus, g_firstkill, g_lastkill
new g_FM_Running
new cvar_time_kill, cvar_type, cvar_time_show

new const sound_combo[][] =
{
	"vox/kill/%s/kill_1_%s.wav", 
	"vox/kill/%s/kill_2_%s.wav", 
	"vox/kill/%s/kill_3_%s.wav", 
	"vox/kill/%s/kill_4_%s.wav", 
	"vox/kill/%s/kill_5_%s.wav", 
	"vox/kill/%s/kill_6_%s.wav", 
	"vox/kill/%s/kill_7_%s.wav", 
	"vox/kill/%s/kill_8_%s.wav", 
	"vox/kill/%s/revenge_%s.wav", 
	"vox/kill/%s/headshot_%s.wav", 
	"vox/kill/%s/knife_%s.wav", 
	"vox/kill/%s/grenade_%s.wav"
}
enum(+= 100)
{
	TASK_HIDESPR = 2000
}
#define ID_HIDESPR (taskid - TASK_HIDESPR)
enum
{
	HUD_SOUND = 1,
	HUD_MSGTEXT,
	HUD_SPRNAME
}
enum
{
	KILL_1 = 1,
	KILL_2,
	KILL_3,
	KILL_4,
	KILL_5,
	KILL_6,
	KILL_7,
	KILL_8,
	KILL_FIRST,
	C4_DEFUSE,
	C4_SET
}
enum
{
	KILL_NONE = 51,
	KILL_HEGRENADE,
	KILL_HEADSHOT,
	KILL_KNIFE,
	KILL_LAST,
	KILL_REVENGE,
	WALLSHOT,
	WALLSHOT_HEADSHOT,
	ONESHOT_2KILL,
	ONESHOT_3KILL
}


public plugin_precache()
{
	for (new i = 1; i <= 2; i++)
	{
		new sex[32]
		if (i == 1) sex = "woman"
		else sex = "man"
		
		for (new e = 0; e <= 11; e++)
		{
			new sound_ct[100], sound_t[100], team_ct[32] = "ct", team_t[32] = "t"
			format(sound_ct, 99, sound_combo[e], sex, team_ct)
			format(sound_t, 99, sound_combo[e], sex, team_t)
			//precache_sound(sound_ct)
			//precache_sound(sound_t)
		}
		
	}
	//precache_sound("misc/MultiKill/C4_Defuse.wav")
	//precache_sound("misc/MultiKill/C4_Set.wav")
	
}
public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
	register_event("DeathMsg", "event_DeathMsg", "a")
	
	cvar_time_kill = register_cvar("nst_ek_time_kill","3")
	cvar_type = register_cvar("nst_ek_type","1")
	cvar_time_show = register_cvar("nst_ek_time_show","2.0")
	
	iconstatus = get_user_msgid("StatusIcon")
	g_FM_Running = is_module_loaded("FakeMeta")
}
public event_round_start()
{
	new reset_value[33]

	g_firstkill = 1
	kills = reset_value
	revenge = reset_value
	oneshot = reset_value
}
public event_DeathMsg()
{
	// get value data
	static killer, headshot, weapon[32], wpnindex, victim
	killer = read_data(1)
	victim = read_data(2)
	headshot = read_data(3)
	read_data(4, weapon, charsmax(weapon))
	if (equali(weapon, "grenade")) format(weapon, charsmax(weapon), "hegrenade")
	format(weapon, charsmax(weapon), "weapon_%s", weapon)
	wpnindex = get_weaponid(weapon)
	
	// none killer = victim
	if (!is_user_connected(killer) || !is_user_connected(victim) || killer==victim) return;
	if (get_user_team(killer)==get_user_team(victim) && !get_cvar_num("mp_friendlyfire")) return;
	
	// reset kills of victim
	kills[victim] = 0

	// set revenge of victim
	revenge[victim] = killer

	// get num kill & one shoot multikill
	new Float:timeleft = get_gametime()-timekill[killer]
	if (timeleft <= get_pcvar_float(cvar_time_kill)) kills[killer] += 1
	else kills[killer] = 1
	if (kills[killer]>LEVELS) kills[killer] = 1
	timekill[killer] = get_gametime()

	if (!oneshot[killer]) oneshot[killer] = 1
	if (!timeleft && wpnindex != CSW_HEGRENADE) oneshot[killer] += 1
	else oneshot[killer] = 1
	oneshot[killer] = min(3, oneshot[killer])
	//client_print(killer, print_chat, "%i", oneshot[killer])
	
	// get last kill
	new players_ct[32], players_t[32], ict, ite
	get_players(players_ct,ict,"ae","CT")   
	get_players(players_t,ite,"ae","TERRORIST")
	if (ict == 0 || ite == 0) g_lastkill = 1
	
	// check revenge
	new g_revenge
	if (victim == revenge[killer])
	{
		g_revenge = 1
		revenge[killer] = 0
	}

	// hud 1
	new check_sound
	if (oneshot[killer] > 1)
	{
		if (oneshot[killer] == 2) show_hud(killer, ONESHOT_2KILL)
		else if (oneshot[killer] == 3) show_hud(killer, ONESHOT_3KILL)
	}
	else if (g_lastkill)
	{
		g_lastkill = 0
		show_hud(killer, KILL_LAST)
	}	
	else if (g_revenge)
	{
		play_sound(killer, KILL_REVENGE)
		show_hud(killer, KILL_REVENGE)
	}
	else if ((wpnindex != CSW_KNIFE) && (wpnindex != CSW_HEGRENADE) && !can_see_fm(killer, victim)) 
	{
		if (headshot)
		{
			if (kills[killer] == 1)
			{
				play_sound(killer, KILL_HEADSHOT)
				check_sound = 1
			}
			show_hud(killer, WALLSHOT_HEADSHOT)
		}
		else show_hud(killer, WALLSHOT)
	}
	else if (headshot && wpnindex)
	{
		if (kills[killer] == 1)
		{
			play_sound(killer, KILL_HEADSHOT)
			check_sound = 1
		}
		show_hud(killer, KILL_HEADSHOT)
	}
	else if (wpnindex == CSW_KNIFE)
	{
		if (kills[killer] == 1)
		{
			play_sound(killer, KILL_KNIFE)
			check_sound = 1
		}
		show_hud(killer, KILL_KNIFE)
	}
	else if (wpnindex == CSW_HEGRENADE)
	{
		if (kills[killer] == 1)
		{
			play_sound(killer, KILL_HEGRENADE)
			check_sound = 1
		}
		show_hud(killer, KILL_HEGRENADE)
	}
	else
	{
		show_hud(killer, KILL_NONE)
	}
	
	
	// hud 2
	if (g_firstkill)
	{
		g_firstkill = 0
		show_hud(killer, KILL_FIRST)
		if (!check_sound) play_sound(killer, KILL_1)
	}
	else
	{
		show_hud(killer, kills[killer])
		if (!check_sound) play_sound(killer, kills[killer])
	}

}
public bomb_defused(id)
{
	show_hud(id, C4_DEFUSE)
	play_sound(id, C4_DEFUSE)
}
public bomb_planted(id)
{
	show_hud(id, C4_SET)
	play_sound(id, C4_SET)
}


// #################### SHOW HUD ####################
show_hud(id, idhud)
{
	if (!is_user_connected(id)) return;
	
	new type_cvar = get_pcvar_num(cvar_type)
	if (type_cvar == 1) show_spr(id, idhud)
	else if (type_cvar == 2) show_msg(id, idhud)
}
play_sound(id, idhud)
{
	if (!is_user_connected(id)) return;
	
	new sound[64], team[32], sex[32], cs_team
	if (nst_get_mod_runing()==NST_MOD_ZB3) cs_team = nst_get_user_team(id)
	else cs_team = get_user_team(id)
		
	if (cs_team==1) team = "T"
	else team = "CT"
	if (get_user_sex(id) == 2) sex = "woman"
	else sex = "man"
	format(sound, charsmax(sound), "%s", get_hud_data(idhud, HUD_SOUND))
	format(sound, charsmax(sound), sound, sex, team)
	
	PlaySound(id, sound)
}

show_msg(id, idhud)
{
	new msg[64]
	format(msg, charsmax(msg), "%s", get_hud_data(idhud, HUD_MSGTEXT))

	set_hudmessage(0, 204, 0, -1.0, 0.65, 1, 0.02, 3.0, 0.3, 0.3, 2)
	show_hudmessage(id, msg)
}
show_spr(id, idspr)
{
	if (idspr >= KILL_NONE) hide_spr(id, 2)
	else hide_spr(id, 1)

	spr_action(id, idspr, 1)
	
	if (idspr < KILL_NONE)
	{
		if (task_exists(id+TASK_HIDESPR)) remove_task(id+TASK_HIDESPR)
		set_task(get_pcvar_float(cvar_time_show), "task_hidehud", id+TASK_HIDESPR)
	}
} 
public task_hidehud(taskid)
{
	new id = ID_HIDESPR
	hide_spr(id, 2)
	hide_spr(id, 1)

}
hide_spr(id, idspr)
{
	if (idspr == 1)
	{
		for (new i = KILL_1; i <= C4_SET; i++)
		{
			spr_action(id, i, 0)
		}
	}
	else if (idspr == 2)
	{
		for (new i = KILL_NONE; i <= ONESHOT_3KILL; i++)
		{
			spr_action(id, i, 0)
		}
	}
}  
spr_action(id, spr, run)
{	
	new sprname[64]
	format(sprname, charsmax(sprname), "%s", get_hud_data(spr, HUD_SPRNAME))

	message_begin(MSG_ONE,iconstatus,{0,0,0},id)
	write_byte(run) // status (0=hide, 1=show, 2=flash)
	write_string(sprname) // sprite name
	message_end()
}
get_hud_data(idhud, type)
{
	new value[64], sprname[33], sound[64], msgtext[32]
	
	switch (idhud)
	{
		case KILL_1:
		{
			sprname = "kill_1"
			sound = "vox/kill/%s/kill_1_%s"
			msgtext = "1 KILL"
		}
		case KILL_2:
		{
			sprname = "kill_2"
			sound = "vox/kill/%s/kill_2_%s"
			msgtext = "2 KILL"
		}
		case KILL_3:
		{
			sprname = "kill_3"
			sound = "vox/kill/%s/kill_3_%s"
			msgtext = "3 KILL"
		}
		case KILL_4:
		{
			sprname = "kill_4"
			sound = "vox/kill/%s/kill_4_%s"
			msgtext = "4 KILL"
		}
		case KILL_5:
		{
			sprname = "kill_5"
			sound = "vox/kill/%s/kill_5_%s"
			msgtext = "5 KILL"
		}
		case KILL_6:
		{
			sprname = "kill_6"
			sound = "vox/kill/%s/kill_6_%s"
			msgtext = "6 KILL"
		}
		case KILL_7:
		{
			sprname = "kill_7"
			sound = "vox/kill/%s/kill_7_%s"
			msgtext = "7 KILL"
		}
		case KILL_8:
		{
			sprname = "kill_8"
			sound = "vox/kill/%s/kill_8_%s"
			msgtext = "8 KILL"
		}
		case KILL_FIRST:
		{
			sprname = "kill_first"
			msgtext = "FIRST KILL"
		}
		case C4_DEFUSE:
		{
			sprname = "c4_defuse"
			sound = "vox/kill/c4_defuse"
		}
		case C4_SET:
		{
			sprname = "c4_set"
			sound = "vox/kill/c4_set"
		}
	
	
		case KILL_NONE:
		{
			sprname = "kill_none"
		}
		case KILL_HEGRENADE:
		{
			sprname = "kill_he"
			sound = "vox/kill/%s/grenade_%s"
			msgtext = "GRENADE KILL"
		}
		case KILL_HEADSHOT:
		{
			sprname = "kill_headshot"
			sound = "vox/kill/%s/headshot_%s"
			msgtext = "HEADSHOT"
		}
		case KILL_KNIFE:
		{
			sprname = "kill_knife"
			sound = "vox/kill/%s/knife_%s"
			msgtext = "KNIFE KILL"
		}
		case KILL_LAST:
		{
			sprname = "kill_last"
		}
		case KILL_REVENGE:
		{
			sprname = "kill_revenge"
			sound = "vox/kill/%s/revenge_%s"
			msgtext = "REVENGE"
		}
		case WALLSHOT:
		{
			sprname = "wall_shot"
			msgtext = "WALLSHOOT"
		}
		case WALLSHOT_HEADSHOT:
		{
			sprname = "wall_shot_hs"
			msgtext = "WALLSHOOT HEADSHOT"
		}
		case ONESHOT_2KILL:
		{
			sprname = "1shot_2kill"
			msgtext = "ONE SHOT 2 KILL"
		}
		case ONESHOT_3KILL:
		{
			sprname = "1shot_3kill"
			msgtext = "ONE SHOT MULTIKILL"
		}
	}

	if (type==HUD_SOUND) format(value, charsmax(value), "%s", sound)
	else if (type==HUD_MSGTEXT) format(value, charsmax(value), "%s", msgtext)
	else if (type==HUD_SPRNAME) format(value, charsmax(value), "%s", sprname)
	
	return value;
}
get_user_sex(id)
{
	new mod_runing, sex
	mod_runing = nst_get_mod_runing()
	if ( (mod_runing == NST_MOD_ZB3 || mod_runing == NST_MOD_ZBU || mod_runing == NST_MOD_ZBS) && nst_zb_get_user_zombie(id) )
	{
		sex = nst_zb_get_user_sex(id)
	}
	else
	{
		sex = nst_get_user_sex(id)
	}

	return sex;
}
// Plays a sound on clients
PlaySound(id, const sound[])
{
	if (equal(sound[strlen(sound)-4], ".mp3"))
		client_cmd(id, "mp3 play ^"sound/%s^"", sound)
	else
		client_cmd(id, "spk ^"%s^"", sound)
}
bool:can_see_fm(entindex1, entindex2)
{
	if ((!g_FM_Running) || !entindex1 || !entindex2)
		return false
//  new ent1, ent2

	if (pev_valid(entindex1) && pev_valid(entindex1))
	{
		new flags = pev(entindex1, pev_flags)
		if (flags & EF_NODRAW || flags & FL_NOTARGET)
		{
			return false
		}

		new Float:lookerOrig[3]
		new Float:targetBaseOrig[3]
		new Float:targetOrig[3]
		new Float:temp[3]

		pev(entindex1, pev_origin, lookerOrig)
		pev(entindex1, pev_view_ofs, temp)
		lookerOrig[0] += temp[0]
		lookerOrig[1] += temp[1]
		lookerOrig[2] += temp[2]

		pev(entindex2, pev_origin, targetBaseOrig)
		pev(entindex2, pev_view_ofs, temp)
		targetOrig[0] = targetBaseOrig [0] + temp[0]
		targetOrig[1] = targetBaseOrig [1] + temp[1]
		targetOrig[2] = targetBaseOrig [2] + temp[2]

		engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0) //  checks the had of seen player
		if (get_tr2(0, TraceResult:TR_InOpen) && get_tr2(0, TraceResult:TR_InWater))
		{
			return false
		} 
		else 
		{
			new Float:flFraction
			get_tr2(0, TraceResult:TR_flFraction, flFraction)
			if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
			{
				return true
			}
			else
			{
				targetOrig[0] = targetBaseOrig [0]
				targetOrig[1] = targetBaseOrig [1]
				targetOrig[2] = targetBaseOrig [2]
				engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0) //  checks the body of seen player
				get_tr2(0, TraceResult:TR_flFraction, flFraction)
				if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
				{
					return true
				}
				else
				{
					targetOrig[0] = targetBaseOrig [0]
					targetOrig[1] = targetBaseOrig [1]
					targetOrig[2] = targetBaseOrig [2] - 17.0
					engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0) //  checks the legs of seen player
					get_tr2(0, TraceResult:TR_flFraction, flFraction)
					if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
					{
						return true
					}
				}
			}
		}
	}
	return false
}

Lại quên mang plugin cho ông Chief rồi hic
 
Èo,e cám ơn a tùng nhưng có cách nào dùng cho các ver khác ko,e chơi tới 4 bản CS lận
 
ông Chief chỉ tôi vụ sprites đi :D
 
@kaan94: Trên AM có TUT
Nếu muốn dùng trong Cs thường thì copy cái inc mà anh Tùng dùng make plugin là đc có đúng ko ?
 
Anh Tùng cho em hỏi cái v3.0 này có gì mới ko :x
 
Status
Không mở trả lời sau này.
Back
Top