[AMX] Tổng hợp Code, Plug do Mem chế hoặc giới thiệu

  • Thread starter Thread starter Orpheus
  • Ngày gửi Ngày gửi
Chẳng nhẽ .... dùng hết rồi mà không đựoc bác ạ.
PHP:
/* Script generated by Pawn Studio */

#include <amxmodx>
#include <amxmisc>
#include <metahook>

#define PLUGIN	"New Plugin"
#define AUTHOR	"Unknown"
#define VERSION	"1.0"

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	register_concmd("check_MH","check_MH")
	register_concmd("draw_text","draw_text")
	register_concmd("draw_image1","draw_image1")
	register_concmd("draw_image2","draw_image2")
}

public check_MH(id)
{
	if (MH_IsMetaHookPlayer(id)) client_print(id, print_chat, "Metahook dang hoat dong")
	else  client_print(id, print_chat, "Metahook khong hoat dong")
}
public draw_text(id)
{
	MH_DrawText(id, 1, "Xin chao!", -1.0, -1.0, 255, 255, 255, 1.0, 1)

}
public draw_image1(id)
{
	MH_DrawImage(id, 0, 1, "zero/z1", 0.5, 0.5, 255, 255,255, 0, 2.0, 10, 1)
}
public draw_image2(id)
{
	MH_DrawAdditiveImage(id, 0, 1, "zero/z1",  0.5, 0.5, 255, 255, 255, 0, 2.0, 1000, 1)
}

Cứ thử cho đường dẫn sai nó báo không tìm thấy file, sướng tưởng ok rồi, tí cho đường dẫn đúng vô thì không có hiện tượng gì xảy ra :(
Chẳng nhẽ cái này chỉ dành cho CSO ?

Hình như bạn làm hơi ngược, theo mình hiểu thì phải như thế này
1/ "Nếu người chơi dùng Metahook thì" "Hiện chữ/hiện hình"
2/ Tiếp theo, các id channel nên khác nhau , không nó lại đè lên nhau kể cả những thứ ngoài mh
3/ Cuối cùng, thêm cái client_putinserver sẽ tốt hơn 1 chút
 
^
^: Để ý chỗ in đậm là sẽ thấy=))
 
@buiducduy111
Sau khi mình test thử thì thấy do bạn khai báo sai với inc
đây là đoạn mẫu mình đã test
#include <amxmodx>
#include <metahook>

#define PLUGIN "New Plugin"
#define AUTHOR "Unknown"
#define VERSION "1.0"

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_concmd("draw_text","draw_text")
}

public client_putinserver(id)
{
if (MH_IsMetaHookPlayer(id))
{
check_MH_ok(id)
}

}
public check_MH_ok(id)
{
draw_text(id)
}

public draw_text(id)
{
MH_DrawText(id, 1, "Xin chao!", 0.5, 0.5, 255, 255, 255, 3.0, 1)
}
 
Vấn đề là gõ "testmh" nó hiện lên là "MH có hoạt động" còn không thấy text Hello đâu :(


Bạn nên logic một chút xíu.
1. Hàm drawtext được thực hiện khi gõ lệnh drawtext chứ ko phài testmh.
2. Bạn phải gõ drawtext thì mới hiện được.
3. Cho dù có gõ drawtext theo mình cũng ko hiện được vì tọa độ là -0.1, -0.1:)
 
Ai giúp tui chỉnh cái phần hiện XP của BF 2 rank xuống cái chỗ trong hình không ạ :-(||>
NOTE:
Nhân tiện cho tui xin cái plugin hiện Hud của cây súng kế bên phần hiện băng đạn luôn được không. Thank a lot:))
 
trong AMX Studio có cái Create HudMessage đó. Lợi dụng nó là lấy tọa độ. Vào tool đó là nó giả ra 1 cái màn hình cS lúc đó cầm chuột kéo text đi đâu thì đi rồi dưới có hiện tọa độ rồi copy
 
UI ui hôm qua quên lấy hình <Nhờ mấy anh chỉ giúp như đã nói ở trên :))>
1327154900431043853_574_574.jpg

NOTE:Tui gà mấy cai AMX MOD lắm ựa
 

Attachments

  • 1327154900431043853_574_574.jpg
    1327154900431043853_574_574.jpg
    60.6 KB · Đọc: 4
^: Options->Multiplayer->Advanced->Bỏ check Center Player Names.
 
Ta nhớ trong console có cái cvar là center_hud hay centerhud gì ấy. set nó về 0
 
Cảm ơn kungfulon nhé <&[]>.............
 
@All : Bác nào biết code set tầm xa cho dao & time gây damage chỉ dùm em với...
Cái set time thì chắc dùng set_task cũng được nhưng em không biết check xem thằng nào đứng trong vòng gây damage của nó
 
HAPPY NEW YEAR
Chúc các bác 1 năm mới an lành, học giỏi ! ?@_@? Chúc Gia đình các bác khỏe mạnh...làm ăn phát đạt ~^o^~
 
^
- Nhầm chỗ rồi. khuyến mãi cho vài POINT
 
1/ @DIAS: Cái plugins đó không phải thứ em cần... Em cần nó gây damage trong 1 khoảng thời gian xác định cơ
Ví dụ : Ấn chuột phải thì 2 s sau nó mới đâm thực sự. (Giống CSO NST)
2 PS: Bác nào xem dùm em cái plugins này
Sound - Tốt
Spr - Nó draw 1 lúc 4 spr giống nhau chồng chất :(

PHP:
/* Script generated by Pawn Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <metahook>

#define PLUGIN	"Kill Effect For Sinh Tu"
#define AUTHOR	"Bui Duc Duy"
#define VERSION	"1.0"
#define timekill_default 5.0
#define MAX_KILL 8


new user_total_kill, Float:timekill
new sound_kill[3][9][64], sound_headshot[3][64],sound_bomb[3][64],sound_knife[3][64]
new spr_kill[9][64],spr_headshot[64],spr_bomb[64], spr_knife[64]
public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	register_event("DeathMsg", "event_DeathMsg", "a")
}

public plugin_precache()
{
	for (new i = 1 ; i <= 2 ; i++)
	{
		for (new p = 1; p <=8 ; p++)
		{
			format(sound_kill[i][p],63,"bdd_kill/%i/%i.wav",i,p)
			precache_sound(sound_kill[i][p])
			format(spr_kill[p],63,"bdd_kill/%i",p)
		}
		format(sound_headshot[i],63,"bdd_kill/%i/Headshot.wav",i)
		format(sound_bomb[i],63,"bdd_kill/%i/Bomb.wav",i)
		format(sound_knife[i],63,"bdd_kill/%i/Knife.wav",i)
	}
	format(spr_headshot,63,"bdd_kill/Headshot")
	format(spr_bomb,63,"bdd_kill/Bomb")
	format(spr_knife,63,"bdd_kill/Knife")
	

}

public event_DeathMsg()
{
	static killer, headshot, victim ,wpnid, team
	killer = read_data(1)
	victim = read_data(2)
	headshot = read_data(3)
	
	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;
	if (is_user_bot(killer)) return
	
	team = get_user_team(killer)
	wpnid = get_user_weapon(killer)
	
	new Float:timeleft = get_gametime()-timekill
	if (timeleft <= timekill_default) user_total_kill += 1
	else user_total_kill = 1
	if (user_total_kill>MAX_KILL) user_total_kill = 1
	timekill = get_gametime()
	
	//
	if (user_total_kill == 1) 
	{
		if (headshot) 
		{
			PlaySound(killer, sound_headshot[team])
			Show_hud(killer, spr_headshot, 1)
			return
		}
		else if (wpnid == CSW_KNIFE) 
		{
			PlaySound(killer, sound_knife[team])
			Show_hud(killer, spr_knife, 1)
			return
		}
		else if (wpnid == CSW_HEGRENADE) 
		{
			PlaySound(killer, sound_bomb[team])
			Show_hud(killer, spr_bomb, 1)
			return
		}
		else 
		{
			PlaySound(killer, sound_kill[team][1])
			Show_hud(killer, spr_kill[1], 1)
			return
		}
	}
	else
	{
		for (new i = 2; i <= 8; i++)
		{
			if (user_total_kill == i)
			{
				PlaySound(killer, sound_kill[team][i])
				Show_hud(killer, spr_kill[i], 1)
				return
			}
		}
	}
}

PlaySound(id, const sound[])
{
	client_cmd(id, "spk ^"%s^"", sound)
}

Show_hud(id, const spr[], channel)
{
	MH_DrawAdditiveImage(id, 0, 0, spr, 0.4, 0.7, 255, 255, 255, 3, 3.0, channel, 1)
}
//Code càng tối ưu thì càng đểu mới đau ............
 
Chỉnh sửa cuối:
^ Lạm dụng return và return sai chỗ luôn.
 
format(spr_headshot,63,"bdd_kill/Headshot")
format(spr_bomb,63,"bdd_kill/Bomb")
format(spr_knife,63,"bdd_kill/Knife")
Phết pam.
 
^
- Chính chú đòi cả Delay attack và attack distance còn gì ?. Ta hướng dẫn cho cái attack distance đơn giản rồi chú lại bảo ko cần
- Muốn delay attack thì đây:

PHP:
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_knife", "fw_PriAttack")

public fw_SecAttack(ent)
{
	if(!pev_valid(ent))
		return HAM_IGNORED		

	static id
	id = pev(ent, pev_owner)		

	if(!g_hidden[id])
		return FMRES_IGNORED	
	
	g_attacking[id] = 2	
 
	set_pev(id, pev_weaponanim, 3)
	
	message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, _, id)
	write_byte(3)
	write_byte(pev(id, pev_body))
	message_end()
 
	set_pdata_float(id, 83, get_gametime(), 5)
	set_task(0.5, "Exec_SecAttack", ent)
 
	return HAM_SUPERCEDE	
}

public Exec_SecAttack(ent)
{
	set_pdata_float(pev(ent, pev_owner), 83, 0.0, 5)
	ExecuteHam(Ham_Weapon_SecondaryAttack, ent)	
}
Cho chú code của ta đó =)). Mỗi tội nếu sài cách này thì ko chỉnh dc knife_distance

@KFL:
- return và return PLUGIN_HANDLED khác nhau ở chỗ nào nhỉ :-?. return là của hệ thống còn return PLUGIN là của amx chăng
 
Chỉnh sửa cuối:
#define PLUGIN_CONTINUE 0
#define PLUGIN_HANDLED 1
return; = return 0; = return PLUGIN_CONTINUE;
 
Back
Top