Last Human Kill ( I don't know last human forward)help!

Coding Help/Re-API Supported
Post Reply
pirate228
Member
Member
India
Posts: 18
Joined: 5 years ago
Contact:

Last Human Kill ( I don't know last human forward)help!

#1

Post by pirate228 » 4 years ago

/* Plugin generated by AMXX-Studio */
#include <zombieplague>
#include <amxmodx>
#include <hamsandwich>

#define PLUGIN "lasthumankill"
#define VERSION "0.1"
#define AUTHOR "Barney"

public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR);
RegisterHam(Ham_TakeDamage, "player", "fw_killlasthuman");
}

public client_putinserver(id)
{
new g_Ham_Bot
if(!g_Ham_Bot && is_user_bot(id))
{
g_Ham_Bot = 1
set_task(0.1, "Do_RegisterHam_Bot", id)
}
}

public Do_RegisterHam_Bot(id)
{
RegisterHamFromEntity(Ham_TakeDamage, id, "fw_killlasthuman")
}

public fw_killlasthuman(victim, inflictor, attacker, Float:damage)
{
if(victim != attacker && is_user_connected(attacker) && zp_get_user_last_human(victim) && zp_get_user_zombie(attacker))
{
ExecuteHamB(Ham_Killed, victim, attacker, 0)
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/

Muhammet20
Veteran Member
Veteran Member
Posts: 408
Joined: 5 years ago
Contact:

#2

Post by Muhammet20 » 4 years ago

pirate228 wrote: 4 years ago /* Plugin generated by AMXX-Studio */
#include <zombieplague>
#include <amxmodx>
#include <hamsandwich>

#define PLUGIN "lasthumankill"
#define VERSION "0.1"
#define AUTHOR "Barney"

public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR);
RegisterHam(Ham_TakeDamage, "player", "fw_killlasthuman");
}

public client_putinserver(id)
{
new g_Ham_Bot
if(!g_Ham_Bot && is_user_bot(id))
{
g_Ham_Bot = 1
set_task(0.1, "Do_RegisterHam_Bot", id)
}
}

public Do_RegisterHam_Bot(id)
{
RegisterHamFromEntity(Ham_TakeDamage, id, "fw_killlasthuman")
}

public fw_killlasthuman(victim, inflictor, attacker, Float:damage)
{
if(victim != attacker && is_user_connected(attacker) && zp_get_user_last_human(victim) && zp_get_user_zombie(attacker))
{
ExecuteHamB(Ham_Killed, victim, attacker, 0)
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/

i converted it for you, give a try:

Code: Select all

#include <zombie_escape>

#define PLUGIN "[ZE] lasthumankill"
#define VERSION "0.1"
#define AUTHOR "Barney"


public plugin_init() 
{
	register_plugin(PLUGIN, VERSION, AUTHOR);
	RegisterHam(Ham_TakeDamage, "player", "fw_killlasthuman");
}
public client_putinserver(id)
{
	new g_Ham_Bot
	if(!g_Ham_Bot && is_user_bot(id))
	{
		g_Ham_Bot = 1
		set_task(0.1, "Do_RegisterHam_Bot", id)
	}
}
public Do_RegisterHam_Bot(id)
{
	RegisterHamFromEntity(Ham_TakeDamage, id, "fw_killlasthuman")
}

public fw_killlasthuman(victim, inflictor, attacker, Float:damage) 
{
	if(victim != attacker && is_user_connected(attacker) && ze_get_humans_number() == 1 && ze_is_user_zombie(attacker)) 
	{
		ExecuteHamB(Ham_Killed, victim, attacker, 0)
	}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/
Note: i used this command: ze_get_humans_number() == 1 to get the last human number

Enjoy :)

Muhammet20
Veteran Member
Veteran Member
Posts: 408
Joined: 5 years ago
Contact:

#3

Post by Muhammet20 » 4 years ago

also if you will type an code here on this forum you should type this

[code]
<Your Code>
[/code]

but don't use this symbols "< >"

User avatar
sPe3doN
Senior Member
Senior Member
Algeria
Posts: 258
Joined: 7 years ago
Contact:

#4

Post by sPe3doN » 4 years ago

Muhammet20 wrote: 4 years ago
pirate228 wrote: 4 years ago /* Plugin generated by AMXX-Studio */
#include <zombieplague>
#include <amxmodx>
#include <hamsandwich>

#define PLUGIN "lasthumankill"
#define VERSION "0.1"
#define AUTHOR "Barney"

public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR);
RegisterHam(Ham_TakeDamage, "player", "fw_killlasthuman");
}

public client_putinserver(id)
{
new g_Ham_Bot
if(!g_Ham_Bot && is_user_bot(id))
{
g_Ham_Bot = 1
set_task(0.1, "Do_RegisterHam_Bot", id)
}
}

public Do_RegisterHam_Bot(id)
{
RegisterHamFromEntity(Ham_TakeDamage, id, "fw_killlasthuman")
}

public fw_killlasthuman(victim, inflictor, attacker, Float:damage)
{
if(victim != attacker && is_user_connected(attacker) && zp_get_user_last_human(victim) && zp_get_user_zombie(attacker))
{
ExecuteHamB(Ham_Killed, victim, attacker, 0)
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/

i converted it for you, give a try:

Code: Select all

#include <zombie_escape>

#define PLUGIN "[ZE] lasthumankill"
#define VERSION "0.1"
#define AUTHOR "Barney"


public plugin_init() 
{
	register_plugin(PLUGIN, VERSION, AUTHOR);
	RegisterHam(Ham_TakeDamage, "player", "fw_killlasthuman");
}
public client_putinserver(id)
{
	new g_Ham_Bot
	if(!g_Ham_Bot && is_user_bot(id))
	{
		g_Ham_Bot = 1
		set_task(0.1, "Do_RegisterHam_Bot", id)
	}
}
public Do_RegisterHam_Bot(id)
{
	RegisterHamFromEntity(Ham_TakeDamage, id, "fw_killlasthuman")
}

public fw_killlasthuman(victim, inflictor, attacker, Float:damage) 
{
	if(victim != attacker && is_user_connected(attacker) && ze_get_humans_number() == 1 && ze_is_user_zombie(attacker)) 
	{
		ExecuteHamB(Ham_Killed, victim, attacker, 0)
	}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/
Note: i used this command: ze_get_humans_number() == 1 to get the last human number

Enjoy :)
it will work wrong like that
first: when you use ze_get_humans_number() == 1 it will not kill the last human this will kill penultimate human use 0 to kill last human
seconde: it will killed and inf the last human in the same time
Image

pirate228
Member
Member
India
Posts: 18
Joined: 5 years ago
Contact:

#5

Post by pirate228 » 4 years ago

alright , let me give both of them a try

pirate228
Member
Member
India
Posts: 18
Joined: 5 years ago
Contact:

#6

Post by pirate228 » 4 years ago

not working I tried ze_get_humans_number() == 1 and 0
KICKED :
error : you killed 1 and 2 teammate
error : you killed 2 and 3 teammate
error : you killed 3 and 4 teammate

User avatar
sPe3doN
Senior Member
Senior Member
Algeria
Posts: 258
Joined: 7 years ago
Contact:

#7

Post by sPe3doN » 4 years ago

pirate228 wrote: 4 years ago not working I tried ze_get_humans_number() == 1 and 0
KICKED :
error : you killed 1 and 2 teammate
error : you killed 2 and 3 teammate
error : you killed 3 and 4 teammate
cuz when you killed last human its killed him and infcted him in the same time, Ask @Raheem or @Mohamed Alaa maybe they can fix it.
Image

Muhammet20
Veteran Member
Veteran Member
Posts: 408
Joined: 5 years ago
Contact:

#8

Post by Muhammet20 » 4 years ago

sPe3doN wrote: 4 years ago
pirate228 wrote: 4 years ago not working I tried ze_get_humans_number() == 1 and 0
KICKED :
error : you killed 1 and 2 teammate
error : you killed 2 and 3 teammate
error : you killed 3 and 4 teammate
cuz when you killed last human its killed him and infcted him in the same time, Ask @Raheem or @Mohamed Alaa maybe they can fix it.
yes this is true
maybe should edit the ze_core

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

#9

Post by Night Fury » 4 years ago

Try this:

Code: Select all

#include <zombie_escape>

#define TASK 1100
 
new g_iLastHumanIndex
 
public plugin_init()
{
    register_plugin("[ZE] Addons: Kill last human", "1.0", "Barney")
}

public ze_game_started()
{
    set_task(0.1, "Check_Humans", TASK, _, _, "b")
}
 
public Check_Humans(TaskID)
{
    if (ze_is_game_started() && (ze_get_humans_number() == 1))
    {
        for (new id = 1; id <= get_member_game(m_nMaxPlayers); id++)
        {
            if (ze_is_user_zombie(id) || !is_user_alive(id))
                continue
 
            g_iLastHumanIndex = id
            remove_task(TASK)
            break
        }
    }
}
 
public ze_user_infected_pre(iVictim, iInfector, iDamage)
{
    if (iVictim == g_iLastHumanIndex && is_user_alive(iVictim) && is_user_alive(iInfector))
    {
        ExecuteHamB(Ham_Killed, iVictim, iInfector, 0)
        return PLUGIN_HANDLED
    }

    return PLUGIN_CONTINUE
}
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 4 guests