[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
anh em cho mình hỏi :
1:mình thấy cái plug weapon icon bên alliedmod.giờ mình muốn nó có dạng đủ màu RGB (ví dụ như cho spirte có màu vào thì nó hiện nét).bạn nào giúp mình với
2:cũng weapon icon,mình muốn MG36 của nstwpn hiện lên thì phải làm thế nào,hay code thêm như nst_mg36,.....
Link plugins : http://forums.alliedmods.net/showthread.php?p=608558
P/S:Mình thanks trước nhé :)
 
anh em cho mình hỏi :
1:mình thấy cái plug weapon icon bên alliedmod.giờ mình muốn nó có dạng đủ màu RGB (ví dụ như cho spirte có màu vào thì nó hiện nét).bạn nào giúp mình với
2:cũng weapon icon,mình muốn MG36 của nstwpn hiện lên thì phải làm thế nào,hay code thêm như nst_mg36,.....
Link plugins : http://forums.alliedmods.net/showthread.php?p=608558
P/S:Mình thanks trước nhé :)
3:Bạn nào giúp mình thêm phần edit Toạ độ X,y với nhé . ở phần user_icon mình edit lại rồi nhưng nó không hiện
còn đây là code:
PHP:
#include <amxmodx>

#define PLUGIN "Weapon Icon"
#define VERSION "1.0"
#define AUTHOR "Zenix (m$ubn)"

new iconstatus;
new user_icons[32][192];
new icon_origin[3] = {0,0,0}
new pcv_show;
new pcv_iloc;

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_event ("CurWeapon", "update_icon", "ab")
	register_event("DeathMsg", "event_death", "a")
	pcv_show = register_cvar("amx_show_weapon_icon", "1");
	pcv_iloc = register_cvar("amx_show_weapon_icon_location", "1");
	register_concmd("amx_weapon_icon", "weapon_icon_toggle", ADMIN_CVAR, "Toggle display of the weapon icon on/off (default on)")
	
	check_icon_loc();
}

public update_icon(id) {
	check_icon_loc();
	if(!get_pcvar_num(pcv_show) || get_pcvar_num(pcv_iloc) == 0)
		return PLUGIN_CONTINUE;
	
	if(is_user_alive(id))
	{
		new iwpn, wclip, wammo, sprite[192], icon_color[3] = {0, 160, 0}
		
		remove_weapon_icon(id)
		
		iwpn = get_user_weapon(id, wclip, wammo)
		switch(iwpn) {
			case CSW_P228: sprite = "d_p228"
				case CSW_SCOUT: sprite = "d_scout"
				case CSW_HEGRENADE: sprite = "d_grenade"
				case CSW_XM1014: sprite = "d_xm1014"
				case CSW_C4: sprite = "d_c4"
				case CSW_MAC10: sprite = "d_mac10"
				case CSW_AUG: sprite = "d_aug"
				case CSW_SMOKEGRENADE: sprite = "d_grenade"
				case CSW_ELITE: sprite = "d_elite"
				case CSW_FIVESEVEN: sprite = "d_fiveseven"
				case CSW_UMP45: sprite = "d_ump45"
				case CSW_SG550: sprite = "d_sg550"
				case CSW_GALIL: sprite = "d_galil"
				case CSW_FAMAS: sprite = "d_famas"
				case CSW_USP: sprite = "d_usp"
				case CSW_MP5NAVY: sprite = "d_mp5navy"
				case CSW_M249: sprite = "d_m249"
				case CSW_M3: sprite = "d_m3"
				case CSW_M4A1: sprite = "d_m4a1"
				case CSW_TMP: sprite = "d_tmp"
				case CSW_G3SG1: sprite = "d_g3sg1"
				case CSW_FLASHBANG: sprite = "d_flashbang"
				case CSW_DEAGLE: sprite = "d_deagle"
				case CSW_SG552: sprite = "d_sg552"
				case CSW_AK47: sprite = "d_ak47"
				case CSW_KNIFE: sprite = "d_knife"
				case CSW_P90: sprite = "d_p90"
				case CSW_VEST: sprite = "suit_full"
				case CSW_VESTHELM: sprite = "suithelmet_full"
				case CSW_GLOCK18: sprite = "d_glock18"
				case CSW_AWP: sprite = "d_awp"
				case 0: sprite = ""
				default: sprite = ""
		}
		if (is_user_ok(id)) {
			if (equali(sprite, "") || !is_user_ok(id)) {
				remove_weapon_icon(id)
				} else {
				// draw the sprite itself (only on a human user's screen)
				// marker ////////////////////////////////////////////////////////////////////////////////
				message_begin(MSG_ONE,iconstatus,icon_origin,id);
				write_byte(1); // status (0=hide, 1=show, 2=flash)
				write_string(sprite); // sprite name
				
				/*
				4 stages - Normal, 1 Clip, No Clip + Some ammo, Completely Out
				
				*/
				
				// ammo check, this is for the color of the icon
				get_user_ammo(id, iwpn, wammo, wclip) // update vars correctly
				if (wclip == 0 && wammo == 0) icon_color = {0, 0, 255} // outta ammo!
				if (wclip == wammo || wclip > wammo) icon_color = {255, 150, 150} // last clip!
				if (wammo > 0 && wclip == 0) icon_color = {255, 100, 100} // almost out!
				// attempt at percentage max clip & % red/green color
				// 1: Get max ammo for weapon
				//maxammo = maxclip(iwpn);
				
				
				write_byte(icon_color[0]); // red
				write_byte(icon_color[1]); // green
				write_byte(icon_color[2]); // blue
				message_end();
			}
			user_icons[id] = sprite;
		}
	}
	return PLUGIN_CONTINUE
} 

public weapon_icon_toggle(id) {
	new toggle[32], players[32], num, player, status[32] = "enabled"
	read_argv(1, toggle, 1)
	
	if (equali(toggle, "1")) {
		status = "enabled"
		} else if (equali(toggle, "0")) {
		status = "disabled"
		} else if (equali(toggle, "")) {
		console_print(id, "Usage: amx_weapon_icon <1/0> - Toggles wether or not showing the user's current weapon as an icon")
		console_print(id, "Weapon Icon is currently %s", status)
		return PLUGIN_HANDLED
	}
	
	set_cvar_string("amx_show_weapon_icon", toggle)
	client_print(0, print_chat, "Weapon Icon is now %s", status)
	get_players(players, num)
	for (new i=0; i<num; i++) {
		player = players[i]
		if (!equali(user_icons[player], "") && !equali(players[i], "") && is_user_ok(id)) {
			remove_weapon_icon(i)
		}
	}
	return PLUGIN_CONTINUE
}

public remove_weapon_icon(id) {
	if (is_user_ok(id)) {
		message_begin(MSG_ONE,iconstatus,icon_origin,id);
		write_byte(0);
		write_string(user_icons[id]);
		message_end();
	}
}

public is_user_ok(id) {
	// check if the user is "ok": they are connected, not a bot, and alive
	if (is_user_connected(id) && !is_user_bot(id) && is_user_alive(id))
		return true
	return false
}

public event_death() {
	new player = read_data(2) // the dead player's ID (1-32)
	if (is_user_connected(player) && !is_user_bot(player)) { // remove icon
		message_begin(MSG_ONE,iconstatus,icon_origin,player);
		write_byte(0);
		write_string(user_icons[player]);
		message_end();
	}
}

public check_icon_loc() {
	if(!get_pcvar_num(pcv_iloc))
		return PLUGIN_CONTINUE;
	new value = get_pcvar_num(pcv_iloc);
	if (value == 0)
		iconstatus = 0;
	if (value == 1)
		iconstatus = get_user_msgid("StatusIcon");
	if (value == 2)
		iconstatus = get_user_msgid("Scenario");
	return PLUGIN_CONTINUE;
}
 
ai có plugin emotion Yahoo chat cho mình xin với :3cool_adore:
 
Mọi người cho mình xin Plugin add súng trong CS : Red với nhé :D:D:D .Mình đang cần. Cảm ơn mọi người nhiều nhé :D
 
cái đó là g4u_wpn với lại phần code lằng nhằng lắm =_='
Mà có ai biết tạo ball spawn point trong soccer jam không :)
 
cái đó là g4u_wpn với lại phần code lằng nhằng lắm =_='
Mà có ai biết tạo ball spawn point trong soccer jam không :)
Phần code có gì lằng nhằng,chẳng qua là lười làm nên mới bảo lằng nhằng
Tui dùng suốt plugin đó,cả g4u pistol nữa.nó rất là hữu ích,không quen thì mới bảo lằng nhằng.tìm hiểu kĩ là code rất dễ
 
Del........................................................................
 
Chỉnh sửa cuối:
Mọi người cho mình xin Plugin add súng trong CS : Red với nhé :D:D:D .Mình đang cần. Cảm ơn mọi người nhiều nhé :D
Cái đấy chỉ có trong CS RED, muốn dùng trong bản khác phải tách ra ;))
 
Mình đang dùng bản g4u_riffle không kèm levelup. Nhưng khi dùng nó cho CSCZKE (CS1.9) thì bị lỗi buyzone nên mới mong có phiên bản plugin mới hơn :D:D:D:D dù sao cũng cảm ơn các bạn nhiều lắm :D
 
Ai có LoadLibrary ở nhà không share em cái :D
_buiducduy_
 
ai up hộ mình plugin này được k,link trên này die hết òy @@
Plugin 06. (Bộ thêm vũ khí NST - ripcode by buiducduy_111 - Tích hợp Weapon Icon, Switch Weapon... delay, distance cho weapon knife)
 
ai up hộ mình plugin này được k,link trên này die hết òy @@
Plugin 06. (Bộ thêm vũ khí NST - ripcode by buiducduy_111 - Tích hợp Weapon Icon, Switch Weapon... delay, distance cho weapon knife)

Bạn có thể lấy trong CSCF NS nhé ! Mình del trong máy và trên mediafire mất rồi :)


Thanks tên kungfu nhé :cuteonion27:

_buiducduy111_
 
Các bác cho e hỏi em có 1 đoạn code như này
PHP:
//eCT = CT Win, g_MaxPlayers = get_maxplayers()
public eCT()
{
	ColorChat(0, GREEN, "%s ^x01Seekers has win the round, all alive players will get 1 point!", tag)
	
	for (new i=1; i<=g_MaxPlayers; i++)
	{
		if (is_user_alive(i))
		{
			new Csteams:team = get_user_team(i)
		
			if (team == 2)
				points[i]++
		}
	}
}

Cũng như trên em dùng get_players thay cho get_maxplayers thì lỗi, thế là sao nhỉ.
 
Các bác cho e hỏi em có 1 đoạn code như này
PHP:
//eCT = CT Win, g_MaxPlayers = get_maxplayers()
public eCT()
{
	ColorChat(0, GREEN, "%s ^x01Seekers has win the round, all alive players will get 1 point!", tag)
	
	for (new i=1; i<=g_MaxPlayers; i++)
	{
		if (is_user_alive(i))
		{
			new Csteams:team = get_user_team(i)
		
			if (team == 2)
				points[i]++
		}
	}
}

Cũng như trên em dùng get_players thay cho get_maxplayers thì lỗi, thế là sao nhỉ.

PHP:
for (new i=1; i<g_MaxPlayers; i++)
	{
		if (is_user_alive(i) && is_user_connected(i))
		{
			new Csteams:team = get_user_team(i)
		
			if (team == 2)
				points[i]++
		}
	}
}
 
_[G]aCon_;23272361 nói:
PHP:
for (new i=1; i<g_MaxPlayers; i++)
	{
		if (is_user_alive(i) && is_user_connected(i))
		{
			new Csteams:team = get_user_team(i)
		
			if (team == 2)
				points[i]++
		}
	}
}

is_user_alive là connect rồi cần gì check nữa bác :-/.
Mà cái code em đưa ok r, nhưng em dùng get_players vs flag là "ae" lại lỗi@@.
 
PHP:
#include < amxmodx >
#include < amxmisc >

#define PLUGIN "Simple Ranking System"
#define VERSION "1.0"
#define AUTHOR "Unknown"
#define OFFICIAL_LANG LANG_PLAYER

new Float:delay_hud[33], rank[4]

enum
{
	RANK_NONE = 0,
	RANK_FIRST,
	RANK_SECOND,
	RANK_THIRD
}

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	register_dictionary("ranking.txt")
}

public client_PostThink(id)
{
	if(!is_user_connected(id))
		return
	if(get_gametime() - 1.0 > delay_hud[id])
	{	
		// Show Stat
		show_stat(id)
		delay_hud[id] = get_gametime()
	}
}

public show_stat(id)
{
	get_stat(id)
	new temp_string_first[64], temp_string_second[64], temp_string_third[64], Player_Name[64], none[32], curid
	
	formatex(none, sizeof(none), "%L", OFFICIAL_LANG, "RANK_NONE")
	
	// Rank First
	curid = rank[RANK_FIRST]
	if(get_user_frags(curid) != 0)
	{
		get_user_name(curid, Player_Name, sizeof(Player_Name))
		formatex(temp_string_first, sizeof(temp_string_first), "%L", OFFICIAL_LANG, "RANK_FIRST", Player_Name)
	} else {
		get_user_name(curid, Player_Name, sizeof(Player_Name))
		formatex(temp_string_first, sizeof(temp_string_first), "%L", OFFICIAL_LANG, "RANK_FIRST", none)	
	}
	
	// Rank Second
	curid = rank[RANK_SECOND]
	if(get_user_frags(curid) != 0)
	{
		get_user_name(curid, Player_Name, sizeof(Player_Name))
		formatex(temp_string_second, sizeof(temp_string_second), "%L", OFFICIAL_LANG, "RANK_SECOND", Player_Name)
	} else {
		get_user_name(curid, Player_Name, sizeof(Player_Name))
		formatex(temp_string_second, sizeof(temp_string_second), "%L", OFFICIAL_LANG, "RANK_SECOND", none)	
	}
	
	// Rank Third
	curid = rank[RANK_THIRD]
	if(get_user_frags(curid) != 0)
	{
		get_user_name(curid, Player_Name, sizeof(Player_Name))
		formatex(temp_string_third, sizeof(temp_string_third), "%L", OFFICIAL_LANG, "RANK_THIRD", Player_Name)
	} else {
		get_user_name(curid, Player_Name, sizeof(Player_Name))
		formatex(temp_string_third, sizeof(temp_string_third), "%L", OFFICIAL_LANG, "RANK_THIRD", none)	
	}	

	set_hudmessage(255, 255, 255, 0.05, 0.30, 0, 2.0, 2.0)
	show_hudmessage(id, "%L^n%s^n%s^n%s", OFFICIAL_LANG, "RANK_INFO", temp_string_first, temp_string_second, temp_string_third)	
}

public get_stat(id)
{
	static highest, current
	new num, iPlayers[32]
	highest = current = 0
	get_players(iPlayers, num)
	if( !num )
	{
		return;
	}
	
	// Rank First
	for(new i = 1; i < num; i++)
	{
		id = iPlayers[i]
		if(!is_user_connected(id))
			continue
			
		if(get_user_frags(id) > highest)
		{
			current = id
			highest = get_user_frags(id)
		}
	}
	rank[RANK_FIRST] = current
	
	// Rank Second
	highest = current = 0	
	for(new i = 1; i < num; i++)
	{
		id = iPlayers[i]
		if(!is_user_connected(id))
			continue			
		if(rank[RANK_FIRST] == id)
			continue
			
		if(get_user_frags(id) > highest)
		{
			current = id
			highest = get_user_frags(id)
		}
	}
	rank[RANK_SECOND] = current		
	
	// Rank Third
	highest = current = 0	
	for(new i = 1; i < num; i++)
	{
		id = iPlayers[i]
		if(!is_user_connected(id))
			continue			
		if(rank[RANK_FIRST] == id || rank[RANK_SECOND] == id)
			continue
			
		if(get_user_frags(id) > highest)
		{
			current = id
			highest = get_user_frags(id)
		}
	}
	rank[RANK_THIRD] = current	
}

Plugin trên mình lấy từ zombie escape của dias để làm plugin ranking cho các mod khác, nhưng khi chơi, thỉnh thoảng game bị crash với lỗi: NUM_FOR_EDICT: bad pointer
Mọi người cho mình hỏi cách khắc phục lỗi trên như thế nào?
 
Rank này là rank chạy đó bác -.-
mấy mod khác thì biết là rank gì...
 
Rank này là rank chạy đó bác -.-
mấy mod khác thì biết là rank gì...

Mình chỉnh lại rank này cho zp, classic(không mod) và csdm, nhưng hình mỗi zp bị lỗi trên
 
Back
Top