Raised This Month: $51 Target: $400
 12% 

Can Someone fix that code ?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
allame61
Member
Join Date: Feb 2017
Location: Turkey
Old 11-22-2019 , 18:33   Can Someone fix that code ?
#1

I've decompiled a plugin , when i did this it gave me complicated code. can someone fix it ?

Code:
 
 
 
 
 new g_maxplayers;
new g_msgSayText;
new g_killzmoneround[33];
new g_survivelikehuman[33];
new g_infecthumoneround[33];
new g_killzmoneround1[33];
new g_infecthumoneround1[33];
new g_survivelikezombie[33];
new g_killzmoneround2[33];
new g_infecthumoneround2[33];
new g_zmkillinfectrowcount[33];
public plugin_init()
{
	register_plugin("[ZP] Mission System", "1.0", "ArtaNN");
	register_clcmd("say /missions", "menu_mission_system", -1, 1456, -1);
	register_clcmd("say /mission", "menu_mission_system", -1, 1456, -1);
	register_logevent("roundstart", 2, "1=Round_Start");
	register_event("DeathMsg", "DeathMsg", 1764, 1772);
	g_maxplayers = get_maxplayers();
	g_msgSayText = get_user_msgid("SayText");
	return 0;
}

public menu_mission_system(id)
{
	new missionmenu = menu_create("\r[ZP]\y Choose your mission", "missionmenu_handler", g_maxplayers);
	new menu[100];
	if (8 <= g_killzmoneround[id])
	{
		formatex(menu, 99, "\r[Unlocked]\w Kill 8 Zombies in round\y [50AP]");
	}
	else
	{
		formatex(menu, 99, "\r[EASY]\w Kill 8 zombies in round\y [50AP]");
	}
	menu_additem(missionmenu, menu, 2372, g_maxplayers, -1);
	if (g_survivelikehuman[id])
	{
		formatex(menu, 99, "\r[Unlocked]\w Survive round like human\y [50AP]");
	}
	else
	{
		formatex(menu, 99, "\r[EASY]\w Survive round like human\y [50AP]");
	}
	menu_additem(missionmenu, menu, 2756, g_maxplayers, -1);
	if (8 <= g_infecthumoneround[id])
	{
		formatex(menu, 99, "\r[Unlocked]\w Infect 8 humans in round\y [50AP]");
	}
	else
	{
		formatex(menu, 99, "\r[EASY]\w Infect 8 humans in round\y [50AP]");
	}
	menu_additem(missionmenu, menu, 3140, g_maxplayers, -1);
	if (12 <= g_killzmoneround1[id])
	{
		formatex(menu, 99, "\r[Unlocked]\w Kill 12 Zombies in round \y[100AP]");
	}
	else
	{
		formatex(menu, 99, "\r[MEDIUM]\w Kill 12 Zombies in round \y[100AP]");
	}
	menu_additem(missionmenu, menu, 3540, g_maxplayers, -1);
	if (g_survivelikezombie[id])
	{
		formatex(menu, 99, "\r[Unlocked]\w Survive round like zombie\y [100AP]");
	}
	else
	{
		formatex(menu, 99, "\r[MEDIUM]\w Survive round like zombie\y [100AP]");
	}
	menu_additem(missionmenu, menu, 3948, g_maxplayers, -1);
	if (12 <= g_infecthumoneround1[id])
	{
		formatex(menu, 99, "\r[Unlocked]\w Infect 12 humans in round\y [100AP]");
	}
	else
	{
		formatex(menu, 99, "\r[MEDIUM]\w Infect 12 humans in round\y [100AP]");
	}
	menu_additem(missionmenu, menu, 4356, g_maxplayers, -1);
	if (20 <= g_killzmoneround2[id])
	{
		formatex(menu, 99, "\r[Unlocked]\w Kill 20 zombies in round\y [200AP]");
	}
	else
	{
		formatex(menu, 99, "\r[HARD]\w Kill 20 zombies in round\y [200AP]");
	}
	menu_additem(missionmenu, menu, 4748, g_maxplayers, -1);
	if (20 <= g_infecthumoneround2[id])
	{
		formatex(menu, 99, "\r[Unlocked]\w Infect 20 humans in round\y [200AP]");
	}
	else
	{
		formatex(menu, 99, "\r[HARD]\w Infect 20 humans in round\y [200AP]");
	}
	menu_additem(missionmenu, menu, 5148, g_maxplayers, -1);
	if (10 <= g_zmkillinfectrowcount[id])
	{
		formatex(menu, 99, "\r[Unlocked]\w Kill 10 zombies and infect 10 humans\y [200AP]");
	}
	else
	{
		formatex(menu, 99, "\r[HARD]\w Kill 10 zombies and infect 10 humans\y [200AP]");
	}
	menu_additem(missionmenu, menu, 5636, g_maxplayers, -1);
	menu_setprop(missionmenu, 6, 1);
	menu_setprop(missionmenu, 1, 7);
	menu_display(id, missionmenu, g_maxplayers);
	return 0;
}

public missionmenu_handler(id, menu, item)
{
	return 0;
}

public roundstart()
{
	new players[32];
	new n;
	new playerid;
	get_players(players, n, 5644, 5648);
	new i;
	while (i < n)
	{
		playerid = players[i];
		if (g_infecthumoneround[playerid] != 8)
		{
			g_infecthumoneround[playerid] = 0;
		}
		if (g_killzmoneround[playerid] != 8)
		{
			g_killzmoneround[playerid] = 0;
		}
		if (g_infecthumoneround1[playerid] != 12)
		{
			g_infecthumoneround1[playerid] = 0;
		}
		if (g_killzmoneround1[playerid] != 12)
		{
			g_killzmoneround1[playerid] = 0;
		}
		if (g_killzmoneround2[playerid] != 20)
		{
			g_killzmoneround2[playerid] = 0;
		}
		if (g_infecthumoneround2[playerid] != 20)
		{
			g_infecthumoneround2[playerid] = 0;
		}
		if (g_zmkillinfectrowcount[playerid] != 10)
		{
			g_zmkillinfectrowcount[playerid] = 0;
		}
		i++;
	}
	return 0;
}

public DeathMsg()
{
	new killer = read_data(1);
	new victim = read_data(2);
	if (victim == killer)
	{
		return 1;
	}
	new var1;
	if (1 <= killer <= 32 && 1 <= victim <= 32)
	{
		if (human_mission_rewards(killer, victim))
		{
			if (g_killzmoneround[killer] != 8)
			{
				g_killzmoneround[killer]++;
				if (g_killzmoneround[killer] == 8)
				{
					zp_set_user_ammo_packs(killer, zp_get_user_ammo_packs(killer) + 50);
					set_hudmessage(255, 20, 20, 1025758986, 1061997773, g_maxplayers, 1086324736, 1094713344, 1036831949, 1045220557, g_msgSayText);
					show_hudmessage(killer, "Your mission: Kill 8 zombies in round\nMission reward: 50 Ammo Packs");
					zp_colored_print(killer, "\x04[ZP]\x01 Your mission:\x03 Kill 8 zombies in round.\x01 Mission reward: 50 Ammo Packs");
				}
			}
			if (g_killzmoneround1[killer] != 12)
			{
				g_killzmoneround1[killer]++;
				if (g_killzmoneround1[killer] == 12)
				{
					zp_set_user_ammo_packs(killer, zp_get_user_ammo_packs(killer) + 100);
					set_hudmessage(255, 20, 20, 1025758986, 1061997773, g_maxplayers, 1086324736, 1094713344, 1036831949, 1045220557, g_msgSayText);
					show_hudmessage(killer, "Your mission: Kill 12 zombies in round\nMission reward: 100 Ammo Packs");
					zp_colored_print(killer, "\x04[ZP]\x01 Your mission:\x03 Kill 12 zombies in round.\x01 Mission reward: 100 Ammo Packs");
				}
			}
			if (g_killzmoneround2[killer] != 20)
			{
				g_killzmoneround2[killer]++;
				if (g_killzmoneround2[killer] == 20)
				{
					zp_set_user_ammo_packs(killer, zp_get_user_ammo_packs(killer) + 200);
					set_hudmessage(255, 20, 20, 1025758986, 1061997773, g_maxplayers, 1086324736, 1094713344, 1036831949, 1045220557, g_msgSayText);
					show_hudmessage(killer, "Your mission: Kill 20 zombies in round\nMission reward: 200 Ammo Packs");
					zp_colored_print(killer, "\x04[ZP]\x01 Your mission:\x03 Kill 20 zombies in round.\x01 Mission reward: 200 Ammo Packs");
				}
			}
			if (g_zmkillinfectrowcount[killer] != 10)
			{
				g_zmkillinfectrowcount[killer]++;
				if (g_zmkillinfectrowcount[killer] == 10)
				{
					zp_set_user_ammo_packs(killer, zp_get_user_ammo_packs(killer) + 200);
					set_hudmessage(255, 20, 20, 1025758986, 1061997773, g_maxplayers, 1086324736, 1094713344, 1036831949, 1045220557, g_msgSayText);
					show_hudmessage(killer, "Your mission: Kill 10 zombies and infect 10 humans\nMission reward: 200 Ammo Packs");
					zp_colored_print(killer, "\x04[ZP]\x01 Your mission:\x03 Kill 10 zombies and infect 10 humans.\x01 Mission reward: 200 Ammo Packs");
				}
			}
		}
	}
	return 0;
}

public zp_user_infected_pre(infected, infector, nemesis)
{
	new var1;
	if (1 <= infected <= 32 && 1 <= infector <= 32)
	{
		if (zombie_mission_rewards(infected, infector, nemesis))
		{
			if (g_infecthumoneround[infector] != 8)
			{
				g_infecthumoneround[infector]++;
				if (g_infecthumoneround[infector] == 8)
				{
					set_hudmessage(255, 20, 20, 1025758986, 1061997773, g_maxplayers, 1086324736, 1094713344, 1036831949, 1045220557, g_msgSayText);
					show_hudmessage(infector, "Your mission: Infect 8 humans in round\nMission reward: 50 Ammo Packs");
					zp_colored_print(infector, "\x04[ZP]\x01 Your mission:\x03 Infect 8 humans in round.\x01 Mission reward: 50 Ammo Packs");
					zp_set_user_ammo_packs(infector, zp_get_user_ammo_packs(infector) + 50);
				}
			}
			if (g_infecthumoneround1[infector] != 12)
			{
				g_infecthumoneround1[infector]++;
				if (g_infecthumoneround1[infector] == 12)
				{
					set_hudmessage(255, 20, 20, 1025758986, 1061997773, g_maxplayers, 1086324736, 1094713344, 1036831949, 1045220557, g_msgSayText);
					show_hudmessage(infector, "Your mission: Infect 12 humans in round\nMission reward: 100 Ammo Packs");
					zp_colored_print(infector, "\x04[ZP]\x01 Your mission:\x03 Infect 12 humans in round.\x01 Mission reward: 100 Ammo Packs");
					zp_set_user_ammo_packs(infector, zp_get_user_ammo_packs(infector) + 100);
				}
			}
			if (g_infecthumoneround2[infector] != 20)
			{
				g_infecthumoneround2[infector]++;
				if (g_infecthumoneround2[infector] == 20)
				{
					set_hudmessage(255, 20, 20, 1025758986, 1061997773, g_maxplayers, 1086324736, 1094713344, 1036831949, 1045220557, g_msgSayText);
					show_hudmessage(infector, "Your mission: Infect 20 humans in round\nMission reward: 200 Ammo Packs");
					zp_colored_print(infector, "\x04[ZP]\x01 Your mission:\x03 Infect 20 humans in round.\x01 Mission reward: 200 Ammo Packs");
					zp_set_user_ammo_packs(infector, zp_get_user_ammo_packs(infector) + 200);
				}
			}
			if (g_zmkillinfectrowcount[infector] != 10)
			{
				g_zmkillinfectrowcount[infector]++;
				if (g_zmkillinfectrowcount[infector] == 10)
				{
					zp_set_user_ammo_packs(infector, zp_get_user_ammo_packs(infector) + 200);
					set_hudmessage(255, 20, 20, 1025758986, 1061997773, g_maxplayers, 1086324736, 1094713344, 1036831949, 1045220557, g_msgSayText);
					show_hudmessage(infector, "Your mission: Kill 10 zombies and infect 10 humans\nMission reward: 200 Ammo Packs");
					zp_colored_print(infector, "\x04[ZP]\x01 Your mission:\x03 Kill 10 zombies and infect 10 humans.\x01 Mission reward: 200 Ammo Packs");
				}
			}
		}
	}
	return 0;
}

public zp_round_ended(winteam)
{
	static id;
	id = 1;
	while (id <= g_maxplayers)
	{
		if (winteam)
		{
		}
		else
		{
			if (zp_get_user_zombie(id))
			{
				set_hudmessage(255, 20, 20, 1025758986, 1061997773, g_maxplayers, 1086324736, 1094713344, 1036831949, 1045220557, g_msgSayText);
				show_hudmessage(id, "Your mission: Survive round like Zombie\nMission reward: 100 Ammo Packs");
				zp_colored_print(id, "\x04[ZP]\x01 Your mission:\x03 Survive round like Zombie.\x01 Mission reward: 100 Ammo Packs");
				zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 100);
			}
			set_hudmessage(255, 20, 20, 1025758986, 1061997773, g_maxplayers, 1086324736, 1094713344, 1036831949, 1045220557, g_msgSayText);
			show_hudmessage(id, "Your mission: Survive round like Human\nMission reward: 50 Ammo Packs");
			zp_colored_print(id, "\x04[ZP]\x01 Your mission:\x03 Survive round like Human.\x01 Mission reward: 50 Ammo Packs");
			zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 50);
		}
		id += 1;
	}
	return 0;
}

public zombie_mission_rewards(infected, infector, turnedtonemesis)
{
	new var1;
	if (zp_get_user_zombie(infector) && !turnedtonemesis)
	{
		return 1;
	}
	return 0;
}

public human_mission_rewards(killer, victim)
{
	new var1;
	if (!zp_get_user_zombie(killer) && !zp_get_user_survivor(killer) && !zp_get_user_nemesis(victim) && zp_get_user_zombie(victim) && !zp_is_nemesis_round() && !zp_is_survivor_round())
	{
		return 1;
	}
	return 0;
}

public client_disconnect(id)
{
	g_killzmoneround[id] = 0;
	g_infecthumoneround[id] = 0;
	g_survivelikehuman[id] = 0;
	g_killzmoneround1[id] = 0;
	g_infecthumoneround1[id] = 0;
	g_survivelikezombie[id] = 0;
	g_killzmoneround2[id] = 0;
	g_infecthumoneround2[id] = 0;
	g_zmkillinfectrowcount[id] = 0;
	return 0;
}

zp_colored_print(target, message[])
{
	static argscount;
	static i;
	static buffer[512];
	argscount = numargs();
	if (!target)
	{
		static player;
		player = 1;
		while (player <= g_maxplayers)
		{
			if (is_user_connected(player))
			{
				static changedcount;
				static changed[5];
				changedcount = 0;
				i = 2;
				while (i < argscount)
				{
					if (getarg(i, g_maxplayers) == -1)
					{
						setarg(i, g_maxplayers, player);
						changed[changedcount] = i;
						changedcount += 1;
					}
					i += 1;
				}
				vformat(buffer, 511, message, 3);
				message_begin(g_killzmoneround, g_msgSayText, 13924, player);
				write_byte(player);
				write_string(buffer);
				message_end();
				i = 0;
				while (i < changedcount)
				{
					setarg(changed[i], g_maxplayers, -1);
					i += 1;
				}
			}
			player += 1;
		}
	}
	else
	{
		vformat(buffer, 511, message, 3);
		message_begin(1, g_msgSayText, 13924, target);
		write_byte(target);
		write_string(buffer);
		message_end();
	}
	return 0;
}

Last edited by asherkin; 11-24-2019 at 11:26. Reason: Restore to previous version.
allame61 is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:51.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode