[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
@sontung0:
- Làm cách nào để tạo ra 1 Entity có khả năng copy bản sao của player nhỉ, dias làm mà nó copy không đúng, đứng copy thì ko sao, nhưng ngồi + bắn mà copy thì nó ko làm dc, và 1 số nữa.
 
Ha ha, chú vẫn loay hoay vụ Confused bomb hả. Sorry nhé, anh chỉ gợi ý đến thế thôi chứ anh cũng không có thời gian. Chú xem phần pev_controller ấy, nó chính là hàm để điều chỉnh khung xương của entity
 
I am trying :-?.......................
 
@sontung0:
- Làm cách nào để tạo ra 1 Entity có khả năng copy bản sao của player nhỉ, dias làm mà nó copy không đúng, đứng copy thì ko sao, nhưng ngồi + bắn mà copy thì nó ko làm dc, và 1 số nữa.
có 1 plugin dạng dạng thế (file đính kèm)

còn về tạo 1 ent copy bản sao hoàn chỉnh của player thì hình như ko đc thì phải
bởi vì player đc set 2 sequence là :
pev_sequence (sequence phần trên)
pev_gaitsequence (sequence phần chân như run, walk, crouch.. mấy sequence đầu trong model player ấy)

với ent (ko phải player) thì chỉ có thể set đc pev_sequence chứ không set đc pev_gaitsequence

đó là theo những gì mình biết b-)
 

Attachments

Chỉnh sửa cuối:
Các quý vị lại cạn ý tưởng rồi:-jmềnh làm cái confused mà ko cần set pev sequence gì hết:-j
 
@sontung0:
- SỬa dùm dias này cái này đi :-?. Xem cái kia chả hiểu :))
++ Sửa lại Func AddToFullPack
++ Sửa lại cái phần copy hành động của chủ nhân ở fw think
thế là dc :)

PHP:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <fun>

#define PLUGIN "Fake"
#define VERSION "1.0"
#define AUTHOR "Dias"

new const fake_img_class[] = "fake_image"
new const fake_img_model[] = "models/player/hero/hero.mdl"

new bool:can_see_ent[33]
new saw_ent[33]

new Float:last[33]

public plugin_init()
{ 
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	//register_forward(FM_AddToFullPack, "fw_AddToFullPack", 1)
	register_think(fake_img_class, "fw_FakeImgThink")
	
	register_clcmd("say /buy", "cmd_buy")
}

public client_putinserver(id)
{
	set_task(1.0, "make_entity", id)
}

public plugin_precache()
{
	precache_model(fake_img_model)
}

public cmd_buy(id)
{
	can_see_ent[id] = true
}

public make_entity(id)
{
	static Float:Origin[3]
	entity_get_vector(id, EV_VEC_origin, Origin)
	
	new ent = create_entity("info_target")
	
	entity_set_origin(ent, Origin)

	entity_set_float(ent,EV_FL_takedamage,1.0)
	entity_set_float(ent,EV_FL_health,100.0)
	
	entity_set_string(ent,EV_SZ_classname, fake_img_class)
	entity_set_model(ent, fake_img_model)
	entity_set_int(ent,EV_INT_solid, SOLID_NOT)
	
	saw_ent[ent] = 1
	
	entity_set_byte(ent,EV_BYTE_controller1,125)
	entity_set_byte(ent,EV_BYTE_controller2,125)
	entity_set_byte(ent,EV_BYTE_controller3,125)
	entity_set_byte(ent,EV_BYTE_controller4,125)
	
	new Float:maxs[3] = {16.0,16.0,36.0}
	new Float:mins[3] = {-16.0,-16.0,-36.0}
	entity_set_size(ent,mins,maxs)
	
	entity_set_edict(ent, EV_ENT_owner, id)
	
	entity_set_float(ent,EV_FL_animtime, 0.1)
	entity_set_float(ent,EV_FL_framerate, 0.1)
	entity_set_int(ent, EV_INT_sequence, 0)
	
	entity_set_float(ent,EV_FL_nextthink, get_gametime() + 0.01)
	
	drop_to_floor(ent)

	return 1;
}

public fw_FakeImgThink(ent)
{
	static id
	id = pev(ent, pev_owner)
	
	static Float:Origin[3]
	static Float:Aim_Origin[3]
	static sq
	static controller[5]
	static Float:Time
	
	Time = get_gametime()
	
	pev(id, pev_origin, Origin)
	sq = pev(id, pev_sequence)
	pev(id, pev_v_angle, Aim_Origin)
	
	set_pev(ent, pev_origin, Origin)
	set_pev(ent, pev_v_angle, Aim_Origin)
	set_pev(ent, pev_sequence, sq)

	pev(id, pev_controller, controller[0])
	pev(id, pev_controller_0, controller[1])
	pev(id, pev_controller_1, controller[2])
	pev(id, pev_controller_2, controller[3])
	pev(id, pev_controller_3, controller[4])
	
	set_pev(ent, pev_controller, controller[0])
	set_pev(ent, pev_controller_0, controller[1])
	set_pev(ent, pev_controller_1, controller[2])
	set_pev(ent, pev_controller_2, controller[3])
	set_pev(ent, pev_controller_3, controller[4])
	
	entity_set_float(ent,EV_FL_nextthink, get_gametime() + 0.01)
}

public fw_AddToFullPack(es_handled, inte, ent, host, hostflags, player, pSet)
{ 
	if(!is_user_alive(player) || !is_user_connected(player))
		return FMRES_IGNORED
	
	static id
	id = pev(ent, pev_owner)
	
	if(!can_see_ent[host] || !saw_ent[ent])
	{
		set_es(es_handled, ES_Effects, get_es(es_handled, ES_Effects) | EF_NODRAW) 
		set_es(es_handled, ES_Solid, get_es(es_handled, ES_Solid) | SOLID_NOT)
	}
	
	return FMRES_HANDLED
}
 
@sontung0:
- SỬa dùm dias này cái này đi :-?. Xem cái kia chả hiểu :))
++ Sửa lại Func AddToFullPack
++ Sửa lại cái phần copy hành động của chủ nhân ở fw think
thế là dc :)

PHP:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <fun>

#define PLUGIN "Fake"
#define VERSION "1.0"
#define AUTHOR "Dias"

new const fake_img_class[] = "fake_image"
new const fake_img_model[] = "models/player/hero/hero.mdl"

new bool:can_see_ent[33]
new saw_ent[33]

new Float:last[33]

public plugin_init()
{ 
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	//register_forward(FM_AddToFullPack, "fw_AddToFullPack", 1)
	register_think(fake_img_class, "fw_FakeImgThink")
	
	register_clcmd("say /buy", "cmd_buy")
}

public client_putinserver(id)
{
	set_task(1.0, "make_entity", id)
}

public plugin_precache()
{
	precache_model(fake_img_model)
}

public cmd_buy(id)
{
	can_see_ent[id] = true
}

public make_entity(id)
{
	static Float:Origin[3]
	entity_get_vector(id, EV_VEC_origin, Origin)
	
	new ent = create_entity("info_target")
	
	entity_set_origin(ent, Origin)

	entity_set_float(ent,EV_FL_takedamage,1.0)
	entity_set_float(ent,EV_FL_health,100.0)
	
	entity_set_string(ent,EV_SZ_classname, fake_img_class)
	entity_set_model(ent, fake_img_model)
	entity_set_int(ent,EV_INT_solid, SOLID_NOT)
	
	saw_ent[ent] = 1
	
	entity_set_byte(ent,EV_BYTE_controller1,125)
	entity_set_byte(ent,EV_BYTE_controller2,125)
	entity_set_byte(ent,EV_BYTE_controller3,125)
	entity_set_byte(ent,EV_BYTE_controller4,125)
	
	new Float:maxs[3] = {16.0,16.0,36.0}
	new Float:mins[3] = {-16.0,-16.0,-36.0}
	entity_set_size(ent,mins,maxs)
	
	entity_set_edict(ent, EV_ENT_owner, id)
	
	entity_set_float(ent,EV_FL_animtime, 0.1)
	entity_set_float(ent,EV_FL_framerate, 0.1)
	entity_set_int(ent, EV_INT_sequence, 0)
	
	entity_set_float(ent,EV_FL_nextthink, get_gametime() + 0.01)
	
	drop_to_floor(ent)

	return 1;
}

public fw_FakeImgThink(ent)
{
	static id
	id = pev(ent, pev_owner)
	
	static Float:Origin[3]
	static Float:Aim_Origin[3]
	static sq
	static controller[5]
	static Float:Time
	
	Time = get_gametime()
	
	pev(id, pev_origin, Origin)
	sq = pev(id, pev_sequence)
	pev(id, pev_v_angle, Aim_Origin)
	
	set_pev(ent, pev_origin, Origin)
	set_pev(ent, pev_v_angle, Aim_Origin)
	set_pev(ent, pev_sequence, sq)

	pev(id, pev_controller, controller[0])
	pev(id, pev_controller_0, controller[1])
	pev(id, pev_controller_1, controller[2])
	pev(id, pev_controller_2, controller[3])
	pev(id, pev_controller_3, controller[4])
	
	set_pev(ent, pev_controller, controller[0])
	set_pev(ent, pev_controller_0, controller[1])
	set_pev(ent, pev_controller_1, controller[2])
	set_pev(ent, pev_controller_2, controller[3])
	set_pev(ent, pev_controller_3, controller[4])
	
	entity_set_float(ent,EV_FL_nextthink, get_gametime() + 0.01)
}

public fw_AddToFullPack(es_handled, inte, ent, host, hostflags, player, pSet)
{ 
	if(!is_user_alive(player) || !is_user_connected(player))
		return FMRES_IGNORED
	
	static id
	id = pev(ent, pev_owner)
	
	if(!can_see_ent[host] || !saw_ent[ent])
	{
		set_es(es_handled, ES_Effects, get_es(es_handled, ES_Effects) | EF_NODRAW) 
		set_es(es_handled, ES_Solid, get_es(es_handled, ES_Solid) | SOLID_NOT)
	}
	
	return FMRES_HANDLED
}
Cần gì phải làm khổ thế này:|có 1 cách để làm cho nó auto copy sequence của player mà:|
 
Plugin maker :http://www.mediafire.com/?d25ukmoqk4x7b2k
Phần mềm tự động cài plugin weapons,rất tiếc ko có cài được sound,thực ra phần mềm này chỉ là phần mềm tự động điền chữ cho mình trên 1 file sma mẫu mà thôi,cho gà nhà là chính.:)).Bác nào pro up cho anh em 1 biểu mẫu weapons SMA để làm wpn mới đi.
Nguồn:HKCDC.org
Ver:4.0
Language:Tàu khựa(yên tâm,có hướng dẫn nè:

[HIDE]
36069c8d1a3774dd53a4ec7b68d5a413_36517043.plugmake.jpg
[/HIDE]

---------- Post added at 10:16 ---------- Previous post was at 10:08 ----------

L 10/14/2011 - 10:12:20: -------- Mapchange to de_torn --------
Host_Error: PF_precache_model_I: Model 'models/p_glock18.mdl' failed to precache because the item count is over the 512 limit.
Reduce the number of brush models and/or regular models in the map to correct thi
Lỗi này là sao?Help !:((:-o
A ảnh hơi nhỏ,các bác truy cạp link sau để xem Here
 
Cái trên là do shadow bên baidu làm. Trình độ đứng 1 về mod bên tàu hay sao ý :)
 
@red:
- Tới lượt nhức đầu với cái AddToFullPack, check cho nó chỉ ẩn mỗi ent nó ẩn hết các player :(

PHP:
if(!can_see_ent[player] && ent == fake_img_ent)
{
        set_es...
}
 
@Dias: cái AddToFullPack có thể hiểu là dữ liệu của các ent trước khi hiển thị cho client thì nó sẽ đc gọi, trong đó có 4 biến quan trọng
PHP:
fw_AddToFullPack(es_handled, inte, ent, host, hostflags, player, pSet)
host: chính là id của client mà dữ liệu gửi sẽ về
ent: là id của các ent mà client sẽ nhận thông tin
player : Có giá trị là 0 hc 1, bằng 1 có nghĩa ent (biến bên trên) là player, bằng 0 thì ko phải là player
es_handled: dạng như là id fake của các ent. Nó có tác dụng dùng để set info cho các ent (dùng set_es) để hiển thị cho client mà không ảnh hưởng đến giá trị thật của ent (cứ hiểu là fake value cũng đc)
VD: Nếu cậu set
PHP:
set_es(es_handled, ES_Effects, EF_NODRAW)
thì ent đó sẽ không draw đối với client hiện tại (là host), còn với các client khác thì nó vẫn bình thường vì giá trị thật của nó ( pev(ent, pev_Effects) ) không phải là EF_NODRAW

Vào game thêm dòng này vào code là hiểu
PHP:
if (player) client_print(host, print_chat, "ent[%i] host[%i]", ent, host)
 
Chỉnh sửa cuối:
Vậy bây giờ phải check if như thế nào ?. Check 1 cái là có thể nhìn thấy cái fake ent, 1 cái là ẩn player cũ đi để hiện ent lên, rất rắc rối. nghĩ mãi vẫn chưa ra câu if
 
Vậy bây giờ phải check if như thế nào ?. Check 1 cái là có thể nhìn thấy cái fake ent, 1 cái là ẩn player cũ đi để hiện ent lên, rất rắc rối. nghĩ mãi vẫn chưa ra câu if
Nếu host là trong danh sách các victim bị dính bom thi kiểm tra các ent
nếu ent là fake player của attacker mà victim bị bomb thì draw nó
nếu ent là attacker của victim thì not draw đó

đơn giản đúng không ;))
 
Chỉnh sửa cuối:
Nó ẩn ent đi rồi nó cũng ẩn luôn mấy cái client kia. Mình là host, giờ mình bị confuse thì mình cũng không thấy cái ent đâu, rồi bọn player team cũng bị ẩn luôn :(. Và làm sao để check ent là thằng fake player, dias thử tạo 1 cái biến rồi dính cái id của ent vào biến đó, cuối cùng qua check nó báo id out of range :)).
 
Nó ẩn ent đi rồi nó cũng ẩn luôn mấy cái client kia. Mình là host, giờ mình bị confuse thì mình cũng không thấy cái ent đâu, rồi bọn player team cũng bị ẩn luôn :(
hình như cậu vẫn chưa hiểu cái addtofullpack thì phải
đọc lại lý thuyết trên kia đê
 
ai cho xin cái plugin lúc mình có máu ~25HP thì nó hiện lên màn hình đỏ và ghi "you're hurt, get to cover", giống mw2 ý
10xetyg.jpg
 

Attachments

  • 10xetyg.jpg
    10xetyg.jpg
    30.1 KB · Đọc: 1
hiểu cái addtofullpack rồi mà :-?. Mỗi tội là check nhiều nên rối loạn cả đầu
- đúng chưa nhỉ ?. nếu sai thì sontung viết 1 cái code example về nó đi :-?
PHP:
public fw_AddToFullPack(es_handled, inte, ent, host, hostflags, player, pSet)
{ 
	if(!is_user_alive(host) || !is_user_connected(host))
		return FMRES_IGNORED
	
	if(is_confusing[host] && ent == saw_ent)
	{
		set_es(es_handled, ES_Effects, get_es(es_handled, ES_Effects) | EF_NODRAW) 
	}
	
	return FMRES_HANDLED
}

=============
đây là trước lúc bị dính bomb
8f029eb8af4322723966944e6a50c3ae_36546329.12.png


- Còn sau khi dính bomb thì nó ẩn hết sạch, ent cũng ko hiện :))
 
Chỉnh sửa cuối:
@dias: chỉ có thể giúp đc thế này
PHP:
// bien nay dung de luu attacker cua victim (g_iConfusing[vcitim] = attacker)
new g_iConfusing[33]

// bien nay dung de luu ent fake cua attacker (g_iEntFake[attacker] = ent fake
new g_iEntFake[33]

public fw_AddToFullPack(es_handled, inte, ent, host, hostflags, player, pSet)
{
	// neu host ko con song thi bo qua
	if ( !is_user_alive(host) )
		return FMRES_IGNORED
	
	// neu host ko bi dinh bomb hc thang attacker da chet
	new iAttacker = g_iConfusing[host]
	if ( !iAttacker || !is_user_alive(iAttacker) )
		return FMRES_IGNORED
	
	// neu ent chinh la thang dap bom
	if (ent == iAttacker)
	{
		// xu ly thang do
		set_es(es_handled, ES_Effects, EF_NODRAW)
	}
	// neu ent la fake player cua attack
	else if (g_iEntFake[iAttacker] == ent)
	{
		// show hang cho thang host xem
	}
	
	return FMRES_HANDLED
}
 
Cho mình hỏi là ngôn ngữ pawn với pascal thì cái nào phức tạp hơn nhỉ :)
 
ai cho xin cái plugin lúc mình có máu ~25HP thì nó hiện lên màn hình đỏ và ghi "you're hurt, get to cover", giống mw2 ý
10xetyg.jpg
k ai giúp àk :( bác sontung với dias thì cứ bàn cái j j ấy :((
 
Back
Top