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
 

Zdjęcie
Zombie Mod

Stworzenie hudu na Zombie Mod'a [HP/KLASA/KEVLAR/AP/LVL/EXP

zombie mod

  • Nie możesz napisać tematu
  • Zaloguj się, aby dodać odpowiedź
1 odpowiedź w tym temacie

#1 lewyb

    Początkujący

  • Użytkownik

Reputacja: 0
zer0.

  • Postów:19
  • Imię:Pan J
Offline

Napisano 05.08.2021 17:09

Witam bardzo serdecznie

 

Miałbym prośbę do was :)

 

Glowie się jak tutaj dodać Level oraz Exp do hudu silnika Zombie. 

Mialby ktos jakis pomysl?

show_dhudmessage(id, "[%L: %d][%L: %d][%L %s][%L %d]", id, "ZOMBIE_ATTRIB1", pev(id, pev_health), id, "ZOMBIE_ATTRIB5", pev(id, pev_armorvalue), id, "CLASS_CLASS", class, id, "AMMO_PACKS1", g_ammopacks[id])
	}

Do tego hudu chcialbym dodac info z levelem oraz expem z tego pluginu Exp:

#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <fun>
#include <fakemeta_util>
#include <hamsandwich>
#include <dhudmessage>
#include <zombieplague>

#define PLUGIN "[ZP] Level System 3.2c"
#define VERSION "3.2c"
#define AUTHOR "Re.Act!ve"

const ACCESS = ADMIN_CVAR;

new SayText;
new bool:g_FreezeTime;
new g_level[32], g_level_data, g_frags_level, g_ScreenFade;
new g_level_max, g_give_ammo, g_give_ammopacks, g_level_num, g_level_info, g_player_name, g_levels[32], g_h_damage;
new g_h_health, g_h_speed, g_z_damage, h_health[32], h_speed[32], h_damage[32], z_damage[32], level_exp[32];
new g_level_exp[32], g_exp_data, g_Players, nameid[32];
new bool:g_bonus[32], g_trime[33];
new sound_level_up[] = { "misc/zp_level_up.wav"};
new sound_health[] = { "items/medshot4.wav" };
// Zombie Classes MUST be registered on plugin_precache

public plugin_precache()
{
	precache_sound( sound_level_up );
	precache_sound( sound_health );
}

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR);

	g_frags_level = register_cvar("zp_level_frags", "40");
	g_level_max  = register_cvar("zp_level_max", "50");
	g_give_ammo = register_cvar("zp_level_give_ammo", "1");
	g_give_ammopacks = register_cvar("zp_level_ammo", "50");
	
	g_h_damage = register_cvar("zp_level_h_damage", "1");
	g_h_health = register_cvar("zp_level_h_health", "5");
	g_h_speed = register_cvar("zp_level_h_speed", "1.0");
	g_z_damage = register_cvar("zp_level_z_damage", "2");
	
	g_level_info = register_cvar("zp_level_info", "1");
	g_player_name = register_cvar("zp_player_name", "1");
	g_level_num = register_cvar("zp_level_number", "100");
	
	g_level_data = nvault_open("Leveling_Save");
	g_exp_data = nvault_open("Exp_Save");
	register_clcmd("say","say_info");
	register_clcmd("say_team","say_info");
	register_clcmd("zp_levelexp","expa_give", ADMIN_CVAR, "use to give Exp");
	register_clcmd("zp_level_is","level_give", ADMIN_CVAR, "use to give Level");
	SayText = get_user_msgid("SayText");
	g_Players = get_maxplayers();
	register_event("HLTV", "Round_Start", "a", "1=0", "2=0");
	register_event("DeathMsg", "Frags_Manager", "a", "1>0");
	RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage");
	register_event("StatusValue","show_status","be","1=2","2!0");
	register_event("StatusValue","hide_status","be","1=1","2=0");
	g_ScreenFade = get_user_msgid( "ScreenFade" );
	RegisterHam(Ham_Item_PreFrame, "player", "fw_Player_ResetMaxSpeed", 1);
	register_logevent("logevent_round_start", 2, "1=Round_Start");

}

public plugin_natives()
{
	register_native("zp_get_user_level", "native_get_level", 1);
	register_native("zp_add_user_level", "native_add_level", 1);
	register_native("zp_get_user_exp", "native_get_exp", 1);
	register_native("zp_add_user_exp", "native_add_exp", 1);
}

public native_get_level(index)
{
	return g_level[index];
}

public native_add_level(index, amount)
{
	g_level[index] += amount;
}

public native_get_exp(index)
{
	return level_exp[index];
}

public native_add_exp(index, amount)
{
	level_exp[index] += amount;
}

public Round_Start()
{
	for(new id = 0; id < g_Players; id++)
	{
		set_task(3.0, "Level", id);
	}
}

public fw_Player_ResetMaxSpeed(id)
{
	if(is_user_alive(id) && !zp_get_user_zombie(id))
	{
		fw_Player_ResetMaxSpeedVip(id);
	}
}

public logevent_round_start()
{
	g_FreezeTime = false;
}

public event_new_round()
{
	g_FreezeTime = true;
}

public fw_Player_ResetMaxSpeedVip(id)
{
	if(!g_FreezeTime)
	{
		set_user_maxspeed(id,get_user_maxspeed(id) + h_speed[id]);
	}
}

public Level(id)
{
	if( !zp_get_user_zombie(id) && is_user_alive(id) )
	{
		g_trime[id] = false;
		new n = 1;
		while( n < g_level[id] )
		{
			h_health[id] = n * get_pcvar_num(g_h_health);
			h_damage[id] = n * get_pcvar_num(g_h_damage);
			z_damage[id] = n * get_pcvar_num(g_z_damage);
			h_speed[id] = n * get_pcvar_num(g_h_speed);
			n = n + 1;
		}
		new Float:speed[32];
		speed[id] = fm_get_user_maxspeed(id) + h_speed[id];
		fm_set_user_health( id, get_user_health(id) + h_health[id] );
		set_pev(id, pev_maxspeed, speed[id] );
		//set_user_maxspeed(id, speed[id])
		emit_sound(id, CHAN_STREAM, sound_health, 1.0, ATTN_NORM, 0, PITCH_HIGH );
	}
}

public expa_give(id, level, cid)
{
	if (!cmd_access(id, level, cid, 2))
	{				
		console_print(id, "Nie mozesz uzyc tej komendy");
		return PLUGIN_HANDLED;
	}
	new target[32];
	new count[32];
	
	read_argv(1, target, charsmax(target));
	read_argv(2, count, charsmax(count));

	new target_id, name[32], nameid[32];

	target_id = find_player("bl", target);
	get_user_name(target_id, name, sizeof name - 1);
	get_user_name(id, nameid, sizeof nameid - 1);
	if(!target_id) 
	{
		console_print(id, "Nie ma takiego gracza");

		return PLUGIN_HANDLED;
	}

	if(read_argc() != 3)
	{
		return PLUGIN_HANDLED;
	}
	
	if(str_to_num(count) < (g_level_exp[target_id] - level_exp[target_id]) )
	{
		if(str_to_num(count) == 0)
		{
			console_print(id, "Exp Player %s in %i / %i", name, level_exp[target_id], g_level_exp[target_id]);
		}
		else
		{
			console_print(id, "Gracz %s otrzymal exp za %i exp, Jego maksymalny exp %i", name, str_to_num(count), g_level_exp[target_id]);
			level_exp[target_id] = level_exp[target_id] + str_to_num(count);
		}
	}
	else
	{
		console_print(id, "Minimalny exp dla gracza %i", g_level_exp[target_id]);
	}
	return PLUGIN_HANDLED;
}

public level_give(id, level, cid)
{
	if (!cmd_access(id, level, cid, 2))
	{				
		console_print(id, "Nie mozesz uzyc tej komendy");

		return PLUGIN_HANDLED;
	}

	new target[32];
	new count[32];
	
	read_argv(1, target, charsmax(target));
	read_argv(2, count, charsmax(count));

	new target_id, name[32], level_id;

	level_id = str_to_num(count);
	target_id = find_player("bl", target);
	get_user_name(target_id, name, sizeof name - 1);

	if(!target_id) 
	{
		console_print(id, "Nie ma takiego gracza");
		return PLUGIN_HANDLED;
	}

	if(read_argc() != 3)
	{
		return PLUGIN_HANDLED;
	}
	
	if( ((g_level[target_id] + level_id) <=get_pcvar_num(g_level_max)) && (level_id != 0) && ((g_level[target_id] + level_id) > 0 ) )
	{
		if(level_id > 0)
		{
			g_level[target_id] = g_level[target_id] + level_id;
			message_begin(MSG_ONE_UNRELIABLE, g_ScreenFade, _, target_id);
			write_short(1<<12); // duration
			write_short(1); // hold time
			write_short(0x0000); // fade type
			write_byte(1); // red
			write_byte(200); // green
			write_byte(0); // blue
			write_byte(205); // alpha
			message_end();
			emit_sound(target_id, CHAN_STREAM, sound_level_up, 1.0, ATTN_NORM, 0, PITCH_HIGH );
		}
		else
		{
			g_level[target_id] = g_level[target_id] + level_id;
			message_begin(MSG_ONE_UNRELIABLE, g_ScreenFade, _, target_id);
			write_short(1<<12); // duration
			write_short(1); // hold time
			write_short(0x0000); // fade type
			write_byte(200); // red
			write_byte(40); // green
			write_byte(0); // blue
			write_byte(205); // alpha
			message_end();
		}
		console_print(id, "Gracz %s otrzymal %i Level.", name, level_id);
	}
	else
	{
		console_print(id, "Operation Invalid");
	}
	return PLUGIN_HANDLED;
}

public client_putinserver(id)
{
	Level_Load(id);

	new name[32];

	g_trime[id] = false;
	g_bonus[id] = true;

	nameid[id] = get_user_name(id, name, sizeof name - 1);

	if( !zp_get_user_zombie(id) && is_user_alive(id))
	{
		g_trime[id] = false;
		new n = 1;
		while( n != g_level[id] )
		{
			h_health[id] = n * get_pcvar_num(g_h_health);
			h_damage[id] = n * get_pcvar_num(g_h_damage);
			z_damage[id] = n * get_pcvar_num(g_z_damage);
			h_speed[id] = n * get_pcvar_num(g_h_speed);
			n = n + 1;
		}
		new Float:speed[32];
		speed[id] = fm_get_user_maxspeed(id) + h_speed[id];
		fm_set_user_health( id, get_user_health(id) + h_health[id] );
		set_pev(id, pev_maxspeed, speed[id] );
		//set_user_maxspeed(id, speed[id])
		emit_sound(id, CHAN_STREAM, sound_health, 1.0, ATTN_NORM, 0, PITCH_HIGH );
	}
	
	if( g_level[id] == 0) 
	{
		g_level[id] = 1;
	}

	if( level_exp[id] == g_level[id] ) 
	{
		level_exp[id] = 0;
	}

	if(g_level[id] < get_pcvar_num(g_level_num))
	{
		g_levels[id] = get_pcvar_num(g_level_num);
	}
	else
	{
		if(g_level[id] != g_levels[id])
		{
			new x = 1;
			while( g_level[id] > ( x * get_pcvar_num(g_level_num)) )
			{
				x = x + 1;
				g_levels[id] = x * get_pcvar_num(g_level_num);
			}
		}
	}

	new y = 1;

	while( g_level[id] != y )
	{
		y = y + 1;
		g_level_exp[id] = y * get_pcvar_num(g_frags_level);
	}
}

public client_disconnect(id)
{
	new name[32], 
		player_nick[32];

	player_nick[id] = get_user_name(id, name, sizeof name - 1);

	if(player_nick[id] == nameid[id])
	{
		Level_Save(id);
	}
	
	g_trime[id] = false;
}

public hide_status(id)
{
	set_hudmessage(0,0,0,0.0,0.0,0, 0.0, 0.01, 0.0, 0.0, 4);
	show_hudmessage(id, "");
}

public show_status(id)
{
	new name[32],
		pid = read_data(2);

	get_user_name(pid, name, charsmax(name));

	if (!zp_get_user_zombie(pid) && !zp_get_user_zombie(id) && (get_pcvar_num(g_player_name) == 1) )
	{
		set_hudmessage(0,0,255,-1.0,0.60,1, 0.01, 3.0, 0.01, 0.01, 4);
		show_hudmessage(id,"", name, g_level[pid], get_user_health(pid), get_user_armor(pid), zp_get_user_ammo_packs(pid));
	}
	if(zp_get_user_zombie(id) && zp_get_user_zombie(pid) && (get_pcvar_num(g_player_name) == 1) )
	{
		set_hudmessage(255,0,0,-1.0,0.60,1, 0.01, 3.0, 0.01, 0.01, 4);
		show_hudmessage(id,"", name, g_level[pid], get_user_health(pid), zp_get_user_ammo_packs(pid));
	}
}

public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_bits)
{   
	if (!(1 <= attacker <= 23))
	{
		return;
	}
	
	if ( !zp_get_user_zombie(attacker) && is_user_alive(attacker) )
	{
		SetHamParamFloat(4, damage + h_damage[attacker]);
	}
	else
	{
		if ( zp_get_user_zombie(attacker) && is_user_alive(attacker) && !zp_get_user_nemesis(attacker))
		{
			SetHamParamFloat(4, damage + z_damage[attacker]);
		}
	}
}

public say_info(id)
{
	new text[70], arg1[32], target[32], count[32]

	read_args(text, sizeof(text)-1);

	remove_quotes(text);

	arg1[0] = '^0';
	target[0] = '^0';
	count[0] = '^0';

	parse(text, arg1, sizeof(arg1)-1, target, sizeof(target)-1, count, sizeof(count)-1);

	if ( equali(arg1, "info", 4) )
	{
		info_player(id, target);
	}

	if ( equali(arg1, "level", 7) && (get_pcvar_num(g_level_info) == 1))
	{
		expa_player(id);
	}

	return PLUGIN_CONTINUE;
}

public zp_extra_item_selected(id, itemid)
{
	Level_Save(id)
}

public zp_user_infected_pre(id, infector)
{
	if( is_user_alive(infector) && (level_exp[infector] < (g_level_exp[infector] - 1)) && zp_get_user_zombie(infector))
	{
		level_exp[infector] = level_exp[infector] + 1;
		Level_Save(infector);
	}
}

public info_player(id, target[])
{
	new target_2;

	target_2 = find_player("bl", target);

	static name[32], 
		nameid[32];

	get_user_name(target_2, name, sizeof name - 1);
	get_user_name(id, nameid, sizeof nameid - 1);

	if(!target_2)
	{
		ChatColor(id, "!g[L4D2]!y Taki nick nie zostal znaleziony na serwerze lub nie istnieje");

		return PLUGIN_HANDLED;
	}
	
	if(zp_get_user_zombie(id))
	{
		if(id != target_2)
		{
			ChatColor(id, "!g[L4D2]!y Statystyki Gracza !g%s !y| Level : !g%i !y, !yExp : !g%i !y| Posiada aktualnie : !g%i !yAmmo Packow", name, g_level[target_2], level_exp[target_2], zp_get_user_ammo_packs(target_2) );
			ChatColor(target_2, "!g[L4D2]!y Gracz %s sprawdzil twoje statystyki", nameid);
		}
		else
		{
			ChatColor(id, "!g[L4D2]!y Wiecej obrazen z lapy !tzombie!y : !g+%i", z_damage[target_2] );
		}
	}
	else
	{
		if(id != target_2)
		{
			ChatColor(id, "!g[L4D2]!y Statystyki Gracza !g%s !y| Level : !g%i !y, !yExp : !g%i !y| Posiada aktualnie : !g%i !yAmmo Packow", name, g_level[target_2], level_exp[target_2], zp_get_user_ammo_packs(target_2) );
			ChatColor(target_2, "!g[L4D2]!y Gracz %s sprawdzil twoje statystyki", nameid);
		}
		else
		{
			ChatColor(id, "!g[L4D2]!y Wiecej obrazen z !tbroni!y : !g+%i !y, !tszybkosci!y : !g+%i !y, !tHP!y : !g+%i", h_damage[target_2], h_speed[target_2], h_health[target_2] );
		}
	}
	return PLUGIN_HANDLED;
}

public expa_player(id)
{
	ChatColor(id, "!g[L4D2]!y Twoj Exp: !g%i !y/ !g%i", level_exp[id], g_level_exp[id]);

	return PLUGIN_HANDLED;
}

public level_status(id)
{
	if( is_user_alive(id))
	{
		if( !zp_get_user_zombie(id) )
		{
			set_hudmessage(200, 250, 0, -1.0, 0.90, 0, 1.0, 1.1, 0.0, 0.0, -1);
			show_hudmessage(id,"[Level: %i/60] | [Exp: %i/%i]", g_level[id], level_exp[id], g_level_exp[id]);
		}
		else
		{
			set_hudmessage(200, 250, 0, -1.0, 0.90, 0, 1.0, 1.1, 0.0, 0.0, -1);
			show_hudmessage(id,"[Level: %i/60] | Exp: %i/%i]", g_level[id], level_exp[id], g_level_exp[id]);			
		}
	}
}

public Level_Save(id)
{
	new key[64], data[256], data_exp[256], key_exp[64];
	new name[33];

	get_user_name(id,name,charsmax(name));
	
	format(key, charsmax(key), "%s-/", name);
	format(data, charsmax(data), "%i#", g_level[id]);
	
	format(key_exp, charsmax(key_exp), "%s-/", name);
	format(data_exp, charsmax(data_exp), "%i#", level_exp[id]);
	
	nvault_set(g_level_data, key, data);
	nvault_set(g_exp_data, key_exp, data_exp);

	return PLUGIN_CONTINUE;
}

public Level_Load(id)
{
	new key[64], data[256], data_exp[256], key_exp[64];
	new name[33];

	get_user_name(id,name,charsmax(name));
	
	format(key, charsmax(key), "%s-/", name);
	format(data, charsmax(data), "%i#", g_level[id]);
	
	format(key_exp, charsmax(key_exp), "%s-/", name);
	format(data_exp, charsmax(data_exp), "%i#", level_exp[id]);
	
	nvault_get(g_level_data, key, data, charsmax(data));
	nvault_get(g_exp_data, key_exp, data_exp, charsmax(data_exp));
	replace_all(data, charsmax(data), "#", " ");
	replace_all(data_exp, charsmax(data_exp), "#", " ");
	
	new givelevel[32], 
		give_exp[32];

	parse(data, givelevel, charsmax(givelevel));
	parse(data_exp, give_exp, charsmax(give_exp));

	g_level[id] = str_to_num(givelevel);
	level_exp[id] = str_to_num(give_exp);
	
	set_task(1.0, "level_status", id, _, _, "b");

	return PLUGIN_CONTINUE;
}

public Frags_Manager()
{
	new aname[32], 
		attacker,

		y; 

	attacker = read_data(1);

	get_user_name(attacker, aname, sizeof aname - 1)

	if( ( level_exp[attacker] >= (g_level_exp[attacker] - 1) ) && (g_level[attacker] <= get_pcvar_num(g_level_max)) && is_user_alive(attacker) )
	{
		g_bonus[attacker] = true;
		g_level[attacker] = g_level[attacker] + 1;
		level_exp[attacker] = 0;

		while( g_level[attacker] != y )
		{
			y = y + 1;
			g_level_exp[attacker] = y * get_pcvar_num(g_frags_level);
		}

		message_begin(MSG_ONE_UNRELIABLE, g_ScreenFade, _, attacker);
		write_short(1<<12); // duration
		write_short(1); // hold time
		write_short(0x0000); // fade type
		write_byte(1); // red
		write_byte(200); // green
		write_byte(0); // blue
		write_byte(205); // alpha
		message_end();
		emit_sound(attacker, CHAN_STREAM, sound_level_up, 1.0, ATTN_NORM, 0, PITCH_HIGH );

		set_dhudmessage(0, 200, 0, -1.0, 0.12, 0, 0.0, 3.0, 2.0, 1.0);
		show_dhudmessage(0, "%s awansowal na %i level", aname, g_level[attacker]);

		if(get_pcvar_num(g_give_ammo) == 1)
		{
			ChatColor(attacker, "!g[L4D2]!y Zdobyles bonus w postaci !g%i !yAmmo Packow za nowy level", get_pcvar_num(g_give_ammopacks) );

			zp_set_user_ammo_packs(attacker, zp_get_user_ammo_packs(attacker) + get_pcvar_num(g_give_ammopacks));
		}
		Level_Save(attacker);
	}
	else
	{
		
		if(g_level[attacker] == get_pcvar_num(g_level_max))
		{
			ChatColor(attacker, "!g[L4D2]!y Osiagneles maksymalny level:!g%i !yGratulujemy !", g_level[attacker]);
		}

		level_exp[attacker] = level_exp[attacker] + 1;

		Level_Save(attacker);
	}
}

public zp_round_ended(winteam)
{
	for(new id = 0; id < g_Players; id++)
	{
		g_trime[id] = true;
	}
}

stock ChatColor(const id, const input[], any:...) 
{
	new count = 1, 
		players[32];

	static msg[191];

	vformat(msg, charsmax(msg), input, 3);
	
	replace_all(msg, charsmax(msg), "!g", "^4"); // Green Color
	replace_all(msg, charsmax(msg), "!y", "^1"); // Default Color
	replace_all(msg, charsmax(msg), "!t", "^3"); // Team Color
	replace_all(msg, charsmax(msg), "!t2", "^0"); // Team2 Color
	
	if (id) 
	{
		players[0] = id; 
	}
	else 
	{
		get_players(players, count, "ch");
	}
	
	for (new i = 0; i < count; i++)
	{
		if (is_user_connected(players[i]))
		{
			message_begin(MSG_ONE_UNRELIABLE, SayText, _, players[i]);
			write_byte(players[i]);
			write_string(msg);
			message_end();
		}
	}
	
}

Pozdrawiam oraz dziekuje z gory za pomoc :)


  • +
  • -
  • 0

#2 OKhmm

    Nowy

  • Pijawka

Reputacja: 0
zer0.

  • Postów:2
Offline

Napisano 14.10.2021 21:08

Pomyliłem się zaktualizowane, zobacz: 

show_dhudmessage(id, "[%L: %d][%L: %d][%L %s][%L %d][Level - %i | EXP - %i ]", id, "ZOMBIE_ATTRIB1", pev(id, pev_health), id, "ZOMBIE_ATTRIB5", pev(id, pev_armorvalue), id, "CLASS_CLASS", class, id, "AMMO_PACKS1", g_ammopacks[id], zp_get_user_level(id), zp_get_user_exp(id))

Użytkownik OKhmm edytował ten post 14.10.2021 21:15

  • +
  • -
  • 0





Również z jednym lub większą ilością słów kluczowych: zombie mod

Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych


Coinsy CSGOAtse Za SMS, PSC , Przelew - CoinSell.pl