Approved Best Infector

Plug-ins compatibility with Zombie Escape 1.x only!


Post Reply
User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

Best Infector

#1

Post by Raheem » 7 years ago

Zombies Best Infector
Description:
  • This plugin will get the best infector in Zombies teams based on the infects made by zombie. It will compare all players infects and the highest infects is the best infector. Best infector will be awarded double jumb and will be printed at the new round that he was best infector in the previous round.
Cvars:
  • ze_give_best_infector_multijump 1 Enable or Disable MultiJump Award? 1 = Enable | 0 = Disable
  • ze_best_infc_chat_notice 1 Enable or Disable Chat Notice? 1 = Enable | 0 = Disable
  • ze_best_infc_give_xp 40 XP amount to be given For Best Infector? If you make it 0 he won't get anything.
  • ze_best_infc_give_ec 20 Escape Coins amount to be given For Best Infector? If you make it 0 he won't get anything.
  • ze_show_best_infec_stats 1 State Message: 0 = Disabled | 1 = Chat Message | 2 = Hud Message | 3 = DHud Message
Commands:
  • say /myinfects Show player his infects and how much infections needed to became Best Infector.
Installation & Instructions:
Changelog:
  • Spoiler!
    Version: 1.0
    • First Release.
    Version: 1.1
    • New Algorithm used to detect Highest one infect Humans.
    • New Cvar Added so you can give Best Infector some XP.
    • New Cvar Added so you can give Best Infector Some Escape Coins.
    • Chat Notice Message Updated with XP, EC Amounts.
    • Some Problems in Spawn Event has been fixed.
    Version: 1.2
    • Fixed chat message problem it was show wrong values.
    • Fixed problem related to resting infections at new round.
    • Fixed If no one make infections. Message won't appear and No one will be awarded.
    • Added New Chat/Hud/DHud message for stats by command.
    Version: 1.3 [Current Version]
    • Fixed some problems in code, I don't know how i make these mistakes.
    • Add infects to show to the best infector when he say /myinfects
Screenshots:
  • ImageImageImageImageImageImageImage
Downloads:
He who fails to plan is planning to fail

User avatar
OxiCorm
Member
Member
Posts: 33
Joined: 7 years ago
Contact:

#2

Post by OxiCorm » 7 years ago

Bro ihave problem with that plugin didnt worked in my server and time present plugin also didnt worked any solution bro

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#3

Post by Raheem » 7 years ago

Bro, Can you tell me the error you get? Or how it not works? I tested this plugin and it's working for me. So try get the error and post it here so i can help you.
He who fails to plan is planning to fail

User avatar
OxiCorm
Member
Member
Posts: 33
Joined: 7 years ago
Contact:

#4

Post by OxiCorm » 7 years ago

No raheem there is no error its didnt worked didnt show the best infector like u descripte it
and also time present plugin to didnt worked

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#5

Post by Raheem » 7 years ago

-The best infector works for me this photo:
  • Working.png
Simply try follow these steps so it may help solving the problem:
  • you need to make sure that you run the Multi-Jump Plugin or the plugin won't work.
  • You need to set the ze_best_infc_chat_notice 1 to 1
Also you need to test the plugin with more than 2 players and someone should infect others so the plugin works correctly. Just try and give me what happens.
He who fails to plan is planning to fail

User avatar
OxiCorm
Member
Member
Posts: 33
Joined: 7 years ago
Contact:

#6

Post by OxiCorm » 7 years ago

Raheem wrote: 7 years ago -The best infector works for me this photo:
  • Working.png
Simply try follow these steps so it may help solving the problem:
  • you need to make sure that you run the Multi-Jump Plugin or the plugin won't work.
  • You need to set the ze_best_infc_chat_notice 1 to 1
Also you need to test the plugin with more than 2 players and someone should infect others so the plugin works correctly. Just try and give me what happens.
Ok bro

1 multi jump installed and work fine

and itest servers with 4 players mode work great no errors no lags non

but this plugin and time present didnt worked

ididnt find even cvars to edit it

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#7

Post by Raheem » 7 years ago

Hmm, So you tested the best defender and also not works?
Go to your server console and write amx_plugins and see if the best infector plugin works or not. Also give me your server ip i'll test it my self.
He who fails to plan is planning to fail

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#8

Post by Raheem » 7 years ago

New version Released.
Current Version Now: 1.1
He who fails to plan is planning to fail

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#9

Post by johnnysins2000 » 7 years ago

Nice i will test it right away bro :)

Ok i try to compile it This is the Error :-

Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team

Error: Undefined symbol "g_fDamage" on line 92
Warning: Expression has no effect on line 92
Error: Expected token: ";", but found "]" on line 92
Error: Invalid expression, assumed zero on line 92
Error: Too many error messages on one line on line 92

Compilation aborted.
4 Errors.

Fix this
Nobody Is That Busy If They Make Time :roll:

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#10

Post by Raheem » 7 years ago

johnnysins2000 wrote: 7 years ago Nice i will test it right away bro :)

Ok i try to compile it This is the Error :-

Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team

Error: Undefined symbol "g_fDamage" on line 92
Warning: Expression has no effect on line 92
Error: Expected token: ";", but found "]" on line 92
Error: Invalid expression, assumed zero on line 92
Error: Too many error messages on one line on line 92

Compilation aborted.
4 Errors.

Fix this
Fixed bro thanks for reporting this.
He who fails to plan is planning to fail

User avatar
sam_bhosale4
Mod Tester
Mod Tester
India
Posts: 109
Joined: 7 years ago
Location: INDIA
Contact:

#11

Post by sam_bhosale4 » 7 years ago

Good plugins but needs some fixes raheem bro!
It Gives xp and coins even if no one infected not a single infection and shows 0 infection awards!
Please fix the values like minimum 3 or 5 infections needed for best infector otherwise it keeps giving free xp and coins!
thanks!
-=SeRious-GaminG|Zombie Escape[Alien vs. Predator]|Asia=-
206.189.132.169:40000
Image

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#12

Post by Raheem » 7 years ago

To stop giving rewards if the infections == 0 or <= Anynumber just change:
  • Code: Select all

    	if (get_pcvar_num(cvar_give_xp) != 0 || get_pcvar_num(cvar_give_escape_coins) != 0)
    	{
    		if (iBestInfecIndex == 0 || iBestInfecIndex != id)
    			return
    		
    		ze_set_escape_coins(iBestInfecIndex, get_pcvar_num(cvar_give_escape_coins) + ze_get_escape_coins(iBestInfecIndex))
    		ze_set_user_xp(iBestInfecIndex, get_pcvar_num(cvar_give_xp) + ze_get_user_xp(iBestInfecIndex))
    	}
TO
  • Code: Select all

    	if (get_pcvar_num(cvar_give_xp) != 0 || get_pcvar_num(cvar_give_escape_coins) != 0)
    	{
    		if (iBestInfecIndex == 0 || iBestInfecIndex != id || g_iKills[id] <= 0)
    			return
    		
    		ze_set_escape_coins(iBestInfecIndex, get_pcvar_num(cvar_give_escape_coins) + ze_get_escape_coins(iBestInfecIndex))
    		ze_set_user_xp(iBestInfecIndex, get_pcvar_num(cvar_give_xp) + ze_get_user_xp(iBestInfecIndex))
    	}
-g_iKills[id] <= 0 Chage the 0 to any value you need. If you need it 1 then: g_iKills[id] <= 1 and so on.
He who fails to plan is planning to fail

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#13

Post by Raheem » 6 years ago

Version 1.2 Out.
He who fails to plan is planning to fail

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#14

Post by Raheem » 6 years ago

New version released. Some important fixes inserted. Please if you run this plugin to update it.
He who fails to plan is planning to fail

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 598
Joined: 7 years ago
Contact:

#15

Post by czirimbolo » 5 years ago

I got every day this error. Jack, can you fix it?

L 11/06/2018 - 07:19:20: [ZE] Invalid Player id (2)
L 11/06/2018 - 07:19:20: [AMXX] Displaying debug trace (plugin "ze_best_infector.amxx", version "1.3")
L 11/06/2018 - 07:19:20: [AMXX] Run time error 10: native error (native "ze_get_escape_coins")
L 11/06/2018 - 07:19:20: [AMXX] [0] ze_best_infector.sma::Fw_PlayerSpawn_Post (line 121)

Code: Select all

#include <zombie_escape>
#include <ze_multijump>
#include <ze_levels>

// Variables
new g_iKills[33], g_iBestInfecIndex

// Cvars
new cvar_give_multijump, cvar_show_chat_notice, cvar_give_xp, cvar_give_escape_coins, cvar_show_stats

public plugin_init()
{
	register_plugin("[ZE] Best Infector", "1.3", "Raheem")
	
	// Hook Chains
	RegisterHookChain(RG_CBasePlayer_Spawn, "Fw_PlayerSpawn_Post", 1)
	
	// Cvars
	cvar_give_multijump = register_cvar("ze_give_best_infector_multijump", "1")
	cvar_show_chat_notice = register_cvar("ze_best_infc_chat_notice", "1")
	cvar_give_xp = register_cvar("ze_best_infc_give_xp", "40")
	cvar_give_escape_coins = register_cvar("ze_best_infc_give_ec", "20")
	cvar_show_stats = register_cvar("ze_show_best_infec_stats", "1")
	
	// Commands
	register_clcmd("say /myinfects", "Cmd_BestInfectorStats")
}

public ze_roundend()
{
	Get_Best_Infector()
}

public ze_user_infected(iVictim, iInfector)
{
	if (iInfector == 0)
		return

	g_iKills[iInfector]++
}

public Cmd_BestInfectorStats(id)
{
	Get_Best_Infector()
	
	switch (get_pcvar_num(cvar_show_stats))
	{
		case 1:
		{
			if (id == g_iBestInfecIndex)
			{
				ze_colored_print(id, "!tYou are now Best Infector !y[!g%d!y] !y:)", g_iKills[g_iBestInfecIndex])
			}
			else
			{
				ze_colored_print(id, "!tYour Infects !g%d!y, !tYou need !g%d !tInfects To be Best Infector!y.", g_iKills[id], g_iKills[g_iBestInfecIndex] - g_iKills[id])
			}
		}
		case 2:
		{
			if (id == g_iBestInfecIndex)
			{
				set_hudmessage(random(256), random(256), random(256), -1.0, 0.3, 2, 3.0, 5.0)
				show_hudmessage(id, "You are now Best Infector [%d] :)", g_iKills[g_iBestInfecIndex])
			}
			else
			{
				set_hudmessage(random(256), random(256), random(256), -1.0, 0.3, 2, 3.0, 5.0)
				show_hudmessage(id, "Your Infects %d, You need %d Infects To be Best Infector.", g_iKills[id], g_iKills[g_iBestInfecIndex] - g_iKills[id])
			}
		}
		case 3:
		{
			if (id == g_iBestInfecIndex)
			{
				set_dhudmessage(random(256), random(256), random(256), -1.0, 0.3, 2, 3.0, 5.0)
				show_dhudmessage(id, "You are now Best Infector [%d] :)", g_iKills[g_iBestInfecIndex])
			}
			else
			{
				set_dhudmessage(random(256), random(256), random(256), -1.0, 0.3, 2, 3.0, 5.0)
				show_dhudmessage(id, "Your Infects %d, You need %d Infects To be Best Infector.", g_iKills[id], g_iKills[g_iBestInfecIndex] - g_iKills[id])
			}
		}
	}
}

public Fw_PlayerSpawn_Post(id)
{
	if (get_pcvar_num(cvar_show_chat_notice) != 0)
	{
		if (g_iBestInfecIndex == 0 || g_iKills[g_iBestInfecIndex] == 0)
			return
		
		new szName[32]
		get_user_name(g_iBestInfecIndex, szName, charsmax(szName))
		
		if (get_pcvar_num(cvar_give_multijump) == 0)
		{
			ze_colored_print(id, "!tBest Infector: !g%s. !tInfects: !g%i. !tAwards: !g%d XP, %d EC!y.", szName, g_iKills[g_iBestInfecIndex], get_pcvar_num(cvar_give_xp), get_pcvar_num(cvar_give_escape_coins))
		}
		else
		{
			ze_colored_print(id, "!tBest Infector: !g%s. !tInfects: !g%i. !tAwards: !g%d XP, %d EC, Multi-Jump!y.", szName, g_iKills[g_iBestInfecIndex], get_pcvar_num(cvar_give_xp), get_pcvar_num(cvar_give_escape_coins))
		}
	}
	
	if (get_pcvar_num(cvar_give_multijump) != 0)
	{
		if (g_iBestInfecIndex == 0 || g_iBestInfecIndex != id || g_iKills[g_iBestInfecIndex] == 0)
			return
		
		ze_give_user_multijump(g_iBestInfecIndex)
	}
	
	if (get_pcvar_num(cvar_give_xp) != 0 || get_pcvar_num(cvar_give_escape_coins) != 0)
	{
		if (g_iBestInfecIndex == 0 || g_iBestInfecIndex != id || g_iKills[g_iBestInfecIndex] == 0)
			return
		
		ze_set_escape_coins(g_iBestInfecIndex, get_pcvar_num(cvar_give_escape_coins) + ze_get_escape_coins(g_iBestInfecIndex))
		ze_set_user_xp(g_iBestInfecIndex, get_pcvar_num(cvar_give_xp) + ze_get_user_xp(g_iBestInfecIndex))
	}
}

public ze_game_started()
{
	set_task(5.0, "RestKills")
}

public RestKills()
{
	for (new i = 1; i <= get_member_game(m_nMaxPlayers); i++)
	{
		g_iKills[i] = 0
	}
}

public Get_Best_Infector()
{
	new iTemp = 0
	
	for (new i = 1; i <= get_member_game(m_nMaxPlayers); i++)
	{
		if (!is_user_connected(i))
			continue
		
		if (g_iKills[i] > iTemp)
		{
			iTemp = g_iKills[i]
			g_iBestInfecIndex = i
		}
	}
}
Image

User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

#16

Post by Night Fury » 5 years ago

Try:

Code: Select all

#include <zombie_escape>
#include <ze_multijump>
#include <ze_levels>

// Variables
new g_iKills[33], g_iBestInfecIndex

// Cvars
new cvar_give_multijump, cvar_show_chat_notice, cvar_give_xp, cvar_give_escape_coins, cvar_show_stats

public plugin_init()
{
	register_plugin("[ZE] Best Infector", "1.3", "Raheem")
	
	// Hook Chains
	RegisterHookChain(RG_CBasePlayer_Spawn, "Fw_PlayerSpawn_Post", 1)
	
	// Cvars
	cvar_give_multijump = register_cvar("ze_give_best_infector_multijump", "1")
	cvar_show_chat_notice = register_cvar("ze_best_infc_chat_notice", "1")
	cvar_give_xp = register_cvar("ze_best_infc_give_xp", "40")
	cvar_give_escape_coins = register_cvar("ze_best_infc_give_ec", "20")
	cvar_show_stats = register_cvar("ze_show_best_infec_stats", "1")
	
	// Commands
	register_clcmd("say /myinfects", "Cmd_BestInfectorStats")
}

public ze_roundend()
{
	Get_Best_Infector()
}

public ze_user_infected(iVictim, iInfector)
{
	if (iInfector == 0)
		return

	g_iKills[iInfector]++
}

public Cmd_BestInfectorStats(id)
{
	Get_Best_Infector()
	
	switch (get_pcvar_num(cvar_show_stats))
	{
		case 1:
		{
			if (id == g_iBestInfecIndex)
			{
				ze_colored_print(id, "!tYou are now Best Infector !y[!g%d!y] !y:)", g_iKills[g_iBestInfecIndex])
			}
			else
			{
				ze_colored_print(id, "!tYour Infects !g%d!y, !tYou need !g%d !tInfects To be Best Infector!y.", g_iKills[id], g_iKills[g_iBestInfecIndex] - g_iKills[id])
			}
		}
		case 2:
		{
			if (id == g_iBestInfecIndex)
			{
				set_hudmessage(random(256), random(256), random(256), -1.0, 0.3, 2, 3.0, 5.0)
				show_hudmessage(id, "You are now Best Infector [%d] :)", g_iKills[g_iBestInfecIndex])
			}
			else
			{
				set_hudmessage(random(256), random(256), random(256), -1.0, 0.3, 2, 3.0, 5.0)
				show_hudmessage(id, "Your Infects %d, You need %d Infects To be Best Infector.", g_iKills[id], g_iKills[g_iBestInfecIndex] - g_iKills[id])
			}
		}
		case 3:
		{
			if (id == g_iBestInfecIndex)
			{
				set_dhudmessage(random(256), random(256), random(256), -1.0, 0.3, 2, 3.0, 5.0)
				show_dhudmessage(id, "You are now Best Infector [%d] :)", g_iKills[g_iBestInfecIndex])
			}
			else
			{
				set_dhudmessage(random(256), random(256), random(256), -1.0, 0.3, 2, 3.0, 5.0)
				show_dhudmessage(id, "Your Infects %d, You need %d Infects To be Best Infector.", g_iKills[id], g_iKills[g_iBestInfecIndex] - g_iKills[id])
			}
		}
	}
}

public Fw_PlayerSpawn_Post(id)
{
	if (!is_user_connected(id))
		return
		
	if (get_pcvar_num(cvar_show_chat_notice) != 0)
	{
		if (g_iBestInfecIndex == 0 || g_iKills[g_iBestInfecIndex] == 0)
			return
		
		new szName[32]
		get_user_name(g_iBestInfecIndex, szName, charsmax(szName))
		
		if (get_pcvar_num(cvar_give_multijump) == 0)
		{
			ze_colored_print(id, "!tBest Infector: !g%s. !tInfects: !g%i. !tAwards: !g%d XP, %d EC!y.", szName, g_iKills[g_iBestInfecIndex], get_pcvar_num(cvar_give_xp), get_pcvar_num(cvar_give_escape_coins))
		}
		else
		{
			ze_colored_print(id, "!tBest Infector: !g%s. !tInfects: !g%i. !tAwards: !g%d XP, %d EC, Multi-Jump!y.", szName, g_iKills[g_iBestInfecIndex], get_pcvar_num(cvar_give_xp), get_pcvar_num(cvar_give_escape_coins))
		}
	}
	
	if (get_pcvar_num(cvar_give_multijump) != 0)
	{
		if (g_iBestInfecIndex == 0 || g_iBestInfecIndex != id || g_iKills[g_iBestInfecIndex] == 0)
			return
		
		ze_give_user_multijump(g_iBestInfecIndex)
	}
	
	if (get_pcvar_num(cvar_give_xp) != 0 || get_pcvar_num(cvar_give_escape_coins) != 0)
	{
		if (g_iBestInfecIndex == 0 || g_iBestInfecIndex != id || g_iKills[g_iBestInfecIndex] == 0)
			return
		
		ze_set_escape_coins(g_iBestInfecIndex, get_pcvar_num(cvar_give_escape_coins) + ze_get_escape_coins(g_iBestInfecIndex))
		ze_set_user_xp(g_iBestInfecIndex, get_pcvar_num(cvar_give_xp) + ze_get_user_xp(g_iBestInfecIndex))
	}
}

public ze_game_started()
{
	set_task(5.0, "RestKills")
}

public RestKills()
{
	for (new i = 1; i <= get_member_game(m_nMaxPlayers); i++)
	{
		g_iKills[i] = 0
	}
}

public Get_Best_Infector()
{
	new iTemp = 0
	
	for (new i = 1; i <= get_member_game(m_nMaxPlayers); i++)
	{
		if (!is_user_connected(i))
			continue
		
		if (g_iKills[i] > iTemp)
		{
			iTemp = g_iKills[i]
			g_iBestInfecIndex = i
		}
	}
}
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 0 guests