Raised This Month: $ Target: $400
 0% 

Requst edite on sma


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mohanad_2022
Member
Join Date: Jan 2022
Location: Palestine
Old 01-28-2022 , 14:31   Requst edite on sma
Reply With Quote #1

Hello guys , hope all are well !!

i have this sma file of "Zombie Escape mod" and it have bug which on last human the zombies damage the human player as the normal knife damage untill kill the last human
but i need on last human , zombie kill the last human with only 2 hits , not on 5 or 6 hits !

so hope anyone fix that plz

PHP Code:
/*================================================================================
    
    ------------------------
    -*- [ZP] Core/Engine -*-
    ------------------------
    
    This plugin is part of Zombie Plague Mod and is distributed under the
    terms of the GNU General Public License. Check ZP_ReadMe.txt for details.
    
================================================================================*/

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>
#include <cs_ham_bots_api>
#include <zp50_core_const>

#define MAXPLAYERS 32

// Custom Forwards
enum _:TOTAL_FORWARDS
{
    
FW_USER_INFECT_PRE 0,
    
FW_USER_INFECT,
    
FW_USER_INFECT_POST,
    
FW_USER_CURE_PRE,
    
FW_USER_CURE,
    
FW_USER_CURE_POST,
    
FW_USER_LAST_ZOMBIE,
    
FW_USER_LAST_HUMAN,
    
FW_USER_SPAWN_POST
}

#define flag_get(%1,%2) (%1 & (1 << (%2 & 31)))
#define flag_get_boolean(%1,%2) (flag_get(%1,%2) ? true : false)
#define flag_set(%1,%2) %1 |= (1 << (%2 & 31))
#define flag_unset(%1,%2) %1 &= ~(1 << (%2 & 31))

new g_MaxPlayers
new g_IsZombie
new g_IsFirstZombie
new g_IsLastZombie
new g_LastZombieForwardCalled
new g_IsLastHuman
new g_LastHumanForwardCalled
new g_RespawnAsZombie
new g_ForwardResult
new g_Forwards[TOTAL_FORWARDS]

public 
plugin_init()
{
    
register_plugin("[ZP] Core/Engine"ZP_VERSION_STRING"ZP Dev Team")
    
register_dictionary("zombie_escape.txt")
    
register_dictionary("zombie_escape50.txt")
    
    
g_Forwards[FW_USER_INFECT_PRE] = CreateMultiForward("zp_fw_core_infect_pre"ET_CONTINUEFP_CELLFP_CELL)
    
g_Forwards[FW_USER_INFECT] = CreateMultiForward("zp_fw_core_infect"ET_IGNOREFP_CELLFP_CELL)
    
g_Forwards[FW_USER_INFECT_POST] = CreateMultiForward("zp_fw_core_infect_post"ET_IGNOREFP_CELLFP_CELL)
    
    
g_Forwards[FW_USER_CURE_PRE] = CreateMultiForward("zp_fw_core_cure_pre"ET_CONTINUEFP_CELLFP_CELL)
    
g_Forwards[FW_USER_CURE] = CreateMultiForward("zp_fw_core_cure"ET_IGNOREFP_CELLFP_CELL)
    
g_Forwards[FW_USER_CURE_POST] = CreateMultiForward("zp_fw_core_cure_post"ET_IGNOREFP_CELLFP_CELL)
    
    
g_Forwards[FW_USER_LAST_ZOMBIE] = CreateMultiForward("zp_fw_core_last_zombie"ET_IGNOREFP_CELL)
    
g_Forwards[FW_USER_LAST_HUMAN] = CreateMultiForward("zp_fw_core_last_human"ET_IGNOREFP_CELL)
    
    
g_Forwards[FW_USER_SPAWN_POST] = CreateMultiForward("zp_fw_core_spawn_post"ET_IGNOREFP_CELL)
    
    
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn_Post"1)
    
RegisterHamBots(Ham_Spawn"fw_PlayerSpawn_Post"1)
    
RegisterHam(Ham_Killed"player""fw_PlayerKilled_Post"1)
    
RegisterHamBots(Ham_Killed"fw_PlayerKilled_Post"1)
    
register_forward(FM_ClientDisconnect"fw_ClientDisconnect_Post"1)
    
    
g_MaxPlayers get_maxplayers()
    
    
// To help players find ZP servers
    
register_cvar("zp_version"ZP_VERSION_STR_LONGFCVAR_SERVER|FCVAR_SPONLY)
    
set_cvar_string("zp_version"ZP_VERSION_STR_LONG)
}

public 
plugin_cfg()
{
    
// Get configs dir
    
new cfgdir[32]
    
get_configsdir(cfgdircharsmax(cfgdir))
    
    
// Execute config file (zombie_escape.cfg)
    
server_cmd("exec %s/zombie_escape.cfg"cfgdir)
}

public 
plugin_natives()
{
    
register_library("zp50_core")
    
register_native("zp_core_is_zombie""native_core_is_zombie")
    
register_native("zp_core_is_first_zombie""native_core_is_first_zombie")
    
register_native("zp_core_is_last_zombie""native_core_is_last_zombie")
    
register_native("zp_core_is_last_human""native_core_is_last_human")
    
register_native("zp_core_get_zombie_count""native_core_get_zombie_count")
    
register_native("zp_core_get_human_count""native_core_get_human_count")
    
register_native("zp_core_infect""native_core_infect")
    
register_native("zp_core_cure""native_core_cure")
    
register_native("zp_core_force_infect""native_core_force_infect")
    
register_native("zp_core_force_cure""native_core_force_cure")
    
register_native("zp_core_respawn_as_zombie""native_core_respawn_as_zombie")
}

public 
fw_ClientDisconnect_Post(id)
{
    
// Reset flags AFTER disconnect (to allow checking if the player was zombie before disconnecting)
    
flag_unset(g_IsZombieid)
    
flag_unset(g_RespawnAsZombieid)
    
    
// This should be called AFTER client disconnects (post forward)
    
CheckLastZombieHuman()
}

public 
fw_PlayerSpawn_Post(id)
{
    
// Not alive or didn't join a team yet
    
if (!is_user_alive(id) || !cs_get_user_team(id))
        return;
    
    
// ZP Spawn Forward
    
ExecuteForward(g_Forwards[FW_USER_SPAWN_POST], g_ForwardResultid)
    
    
// Set zombie/human attributes upon respawn
    
if (flag_get(g_RespawnAsZombieid))
        
InfectPlayer(idid)
    else
        
CurePlayer(id)
    
    
// Reset flag afterwards
    
flag_unset(g_RespawnAsZombieid)
}

// Ham Player Killed Post Forward
public fw_PlayerKilled_Post()
{
    
CheckLastZombieHuman()
}

InfectPlayer(idattacker 0)
{
    
ExecuteForward(g_Forwards[FW_USER_INFECT_PRE], g_ForwardResultidattacker)
    
    
// One or more plugins blocked infection
    
if (g_ForwardResult >= PLUGIN_HANDLED)
        return;
    
    
ExecuteForward(g_Forwards[FW_USER_INFECT], g_ForwardResultidattacker)
    
    
flag_set(g_IsZombieid)
    
    if (
GetZombieCount() == 1)
        
flag_set(g_IsFirstZombieid)
    else
        
flag_unset(g_IsFirstZombieid)
    
    
ExecuteForward(g_Forwards[FW_USER_INFECT_POST], g_ForwardResultidattacker)
    
    
CheckLastZombieHuman()
}

CurePlayer(idattacker 0)
{
    
ExecuteForward(g_Forwards[FW_USER_CURE_PRE], g_ForwardResultidattacker)
    
    
// One or more plugins blocked cure
    
if (g_ForwardResult >= PLUGIN_HANDLED)
        return;
    
    
ExecuteForward(g_Forwards[FW_USER_CURE], g_ForwardResultidattacker)
    
    
flag_unset(g_IsZombieid)
    
    
ExecuteForward(g_Forwards[FW_USER_CURE_POST], g_ForwardResultidattacker)
    
    
CheckLastZombieHuman()
}

// Last Zombie/Human Check
CheckLastZombieHuman()
{
    new 
idlast_zombie_idlast_human_id
    
new zombie_count GetZombieCount()
    new 
human_count GetHumanCount()
    
    if (
zombie_count == 1)
    {
        for (
id 1id <= g_MaxPlayersid++)
        {
            
// Last zombie
            
if (is_user_alive(id) && flag_get(g_IsZombieid))
            {
                
flag_set(g_IsLastZombieid)
                
last_zombie_id id
            
}
            else
                
flag_unset(g_IsLastZombieid)
        }
    }
    else
    {
        
g_LastZombieForwardCalled false
        
        
for (id 1id <= g_MaxPlayersid++)
            
flag_unset(g_IsLastZombieid)
    }
    
    
// Last zombie forward
    
if (last_zombie_id && !g_LastZombieForwardCalled)
    {
        
ExecuteForward(g_Forwards[FW_USER_LAST_ZOMBIE], g_ForwardResultlast_zombie_id)
        
g_LastZombieForwardCalled true
    
}
    
    if (
human_count == 1)
    {
        for (
id 1id <= g_MaxPlayersid++)
        {
            
// Last human
            
if (is_user_alive(id) && !flag_get(g_IsZombieid))
            {
                
flag_set(g_IsLastHumanid)
                
last_human_id id
            
}
            else
                
flag_unset(g_IsLastHumanid)
        }
    }
    else
    {
        
g_LastHumanForwardCalled false
        
        
for (id 1id <= g_MaxPlayersid++)
            
flag_unset(g_IsLastHumanid)
    }
    
    
// Last human forward
    
if (last_human_id && !g_LastHumanForwardCalled)
    {
        
ExecuteForward(g_Forwards[FW_USER_LAST_HUMAN], g_ForwardResultlast_human_id)
        
g_LastHumanForwardCalled true
    
}
}

public 
native_core_is_zombie(plugin_idnum_params)
{
    new 
id get_param(1)
    
    if (!
is_user_connected(id))
    {
        
log_error(AMX_ERR_NATIVE"[ZP] Invalid Player (%d)"id)
        return -
1;
    }
    
    return 
flag_get_boolean(g_IsZombieid);
}

public 
native_core_is_first_zombie(plugin_idnum_params)
{
    new 
id get_param(1)
    
    if (!
is_user_connected(id))
    {
        
log_error(AMX_ERR_NATIVE"[ZP] Invalid Player (%d)"id)
        return -
1;
    }
    
    return 
flag_get_boolean(g_IsFirstZombieid);
}

public 
native_core_is_last_zombie(plugin_idnum_params)
{
    new 
id get_param(1)
    
    if (!
is_user_connected(id))
    {
        
log_error(AMX_ERR_NATIVE"[ZP] Invalid Player (%d)"id)
        return -
1;
    }
    
    return 
flag_get_boolean(g_IsLastZombieid);
}

public 
native_core_is_last_human(plugin_idnum_params)
{
    new 
id get_param(1)
    
    if (!
is_user_connected(id))
    {
        
log_error(AMX_ERR_NATIVE"[ZP] Invalid Player (%d)"id)
        return -
1;
    }
    
    return 
flag_get_boolean(g_IsLastHumanid);
}

public 
native_core_get_zombie_count(plugin_idnum_params)
{
    return 
GetZombieCount();
}

public 
native_core_get_human_count(plugin_idnum_params)
{
    return 
GetHumanCount();
}

public 
native_core_infect(plugin_idnum_params)
{
    new 
id get_param(1)
    
    if (!
is_user_alive(id))
    {
        
log_error(AMX_ERR_NATIVE"[ZP] Invalid Player (%d)"id)
        return 
false;
    }
    
    if (
flag_get(g_IsZombieid))
    {
        
log_error(AMX_ERR_NATIVE"[ZP] Player already infected (%d)"id)
        return 
false;
    }
    
    new 
attacker get_param(2)
    
    if (
attacker && !is_user_alive(attacker))
    {
        
log_error(AMX_ERR_NATIVE"[ZP] Invalid Player (%d)"attacker)
        return 
false;
    }
    
    
InfectPlayer(idattacker)
    return 
true;
}

public 
native_core_cure(plugin_idnum_params)
{
    new 
id get_param(1)
    
    if (!
is_user_alive(id))
    {
        
log_error(AMX_ERR_NATIVE"[ZP] Invalid Player (%d)"id)
        return 
false;
    }
    
    if (!
flag_get(g_IsZombieid))
    {
        
log_error(AMX_ERR_NATIVE"[ZP] Player not infected (%d)"id)
        return 
false;
    }
    
    new 
attacker get_param(2)
    
    if (
attacker && !is_user_alive(attacker))
    {
        
log_error(AMX_ERR_NATIVE"[ZP] Invalid Player (%d)"attacker)
        return 
false;
    }
    
    
CurePlayer(idattacker)
    return 
true;
}

public 
native_core_force_infect(plugin_idnum_params)
{
    new 
id get_param(1)
    
    if (!
is_user_alive(id))
    {
        
log_error(AMX_ERR_NATIVE"[ZP] Invalid Player (%d)"id)
        return 
false;
    }
    
    
InfectPlayer(id)
    return 
true;
}

public 
native_core_force_cure(plugin_idnum_params)
{
    new 
id get_param(1)
    
    if (!
is_user_alive(id))
    {
        
log_error(AMX_ERR_NATIVE"[ZP] Invalid Player (%d)"id)
        return 
false;
    }
    
    
CurePlayer(id)
    return 
true;
}

public 
native_core_respawn_as_zombie(plugin_idnum_params)
{
    new 
id get_param(1)
    
    if (!
is_user_connected(id))
    {
        
log_error(AMX_ERR_NATIVE"[ZP] Invalid Player (%d)"id)
        return 
false;
    }
    
    new 
respawn_as_zombie get_param(2)
    
    if (
respawn_as_zombie)
        
flag_set(g_RespawnAsZombieid)
    else
        
flag_unset(g_RespawnAsZombieid)
    
    return 
true;
}

// Get Zombie Count -returns alive zombies number-
GetZombieCount()
{
    new 
iZombiesid
    
    
for (id 1id <= g_MaxPlayersid++)
    {
        if (
is_user_alive(id) && flag_get(g_IsZombieid))
            
iZombies++
    }
    
    return 
iZombies;
}

// Get Human Count -returns alive humans number-
GetHumanCount()
{
    new 
iHumansid
    
    
for (id 1id <= g_MaxPlayersid++)
    {
        if (
is_user_alive(id) && !flag_get(g_IsZombieid))
            
iHumans++
    }
    
    return 
iHumans;

mohanad_2022 is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 01-28-2022 , 15:05   Re: Requst edite on sma
Reply With Quote #2

Open up zombieplague.cfg and set this cvar to 0

Code:
zp_human_last_health_bonus 0
__________________








CrazY. is offline
mohanad_2022
Member
Join Date: Jan 2022
Location: Palestine
Old 01-29-2022 , 01:24   Re: Requst edite on sma
Reply With Quote #3

Quote:
Originally Posted by CrazY. View Post
Open up zombieplague.cfg and set this cvar to 0

Code:
zp_human_last_health_bonus 0
still same problem , the problem is that i want change the damage of zombies hit to be 2 hits and the last human will be dead !
but here the bug that i have to hit him more than 4 hits , as i am doing mouse1 on anormal player by knife !

Last edited by mohanad_2022; 01-29-2022 at 02:01.
mohanad_2022 is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 01-29-2022 , 07:58   Re: Requst edite on sma
Reply With Quote #4

Try this, change the value of the cvar zp_zombie_last_human_damage to increase or decrease the damage.

Code:
#include <amxmodx>
#include <hamsandwich>
#include <hlsdk_const>
#include <zp50_core>

new cv_last_human_damage

public plugin_init()
{
	register_plugin("plugin", "version", "author")
	cv_last_human_damage = register_cvar("zp_zombie_last_human_damage", "15.0")
	RegisterHamPlayer(Ham_TraceAttack, "OnTraceAttack")
}

public OnTraceAttack(this, idattacker, Float:damage, Float:direction[3], tracehandle, damagebits)
{
	if (!(1 <= idattacker <= MaxClients) || !(damagebits & DMG_BULLET))
	{
		return HAM_IGNORED
	}

	if (!zp_core_is_last_human(this))
	{
		return HAM_IGNORED
	}

	SetHamParamFloat(3, damage * get_pcvar_float(cv_last_human_damage))
	
	return HAM_HANDLED
}
Use this if your server is running amxx 182

Code:
#include <amxmodx>
#include <hamsandwich>
#include <hlsdk_const>
#include <zp50_core>
#include <cs_ham_bots_api>

new cv_last_human_damage

public plugin_init()
{
	register_plugin("plugin", "version", "author")
	cv_last_human_damage = register_cvar("zp_zombie_last_human_damage", "15.0")
	RegisterHam(Ham_TraceAttack, "player", "OnTraceAttack")
	RegisterHamBots(Ham_TraceAttack, "OnTraceAttack")
}

public OnTraceAttack(this, idattacker, Float:damage, Float:direction[3], tracehandle, damagebits)
{
	if (!is_user_connected(idattacker) || !(damagebits & DMG_BULLET))
	{
		return HAM_IGNORED
	}

	if (!zp_core_is_last_human(this))
	{
		return HAM_IGNORED
	}

	SetHamParamFloat(3, damage * get_pcvar_float(cv_last_human_damage))

	return HAM_HANDLED
}
__________________









Last edited by CrazY.; 01-29-2022 at 08:02.
CrazY. is offline
mohanad_2022
Member
Join Date: Jan 2022
Location: Palestine
Old 01-29-2022 , 15:19   Re: Requst edite on sma
Reply With Quote #5

Quote:
Originally Posted by CrazY. View Post
Try this, change the value of the cvar zp_zombie_last_human_damage to increase or decrease the damage.

Code:
#include <amxmodx>
#include <hamsandwich>
#include <hlsdk_const>
#include <zp50_core>

new cv_last_human_damage

public plugin_init()
{
	register_plugin("plugin", "version", "author")
	cv_last_human_damage = register_cvar("zp_zombie_last_human_damage", "15.0")
	RegisterHamPlayer(Ham_TraceAttack, "OnTraceAttack")
}

public OnTraceAttack(this, idattacker, Float:damage, Float:direction[3], tracehandle, damagebits)
{
	if (!(1 <= idattacker <= MaxClients) || !(damagebits & DMG_BULLET))
	{
		return HAM_IGNORED
	}

	if (!zp_core_is_last_human(this))
	{
		return HAM_IGNORED
	}

	SetHamParamFloat(3, damage * get_pcvar_float(cv_last_human_damage))
	
	return HAM_HANDLED
}
Use this if your server is running amxx 182

Code:
#include <amxmodx>
#include <hamsandwich>
#include <hlsdk_const>
#include <zp50_core>
#include <cs_ham_bots_api>

new cv_last_human_damage

public plugin_init()
{
	register_plugin("plugin", "version", "author")
	cv_last_human_damage = register_cvar("zp_zombie_last_human_damage", "15.0")
	RegisterHam(Ham_TraceAttack, "player", "OnTraceAttack")
	RegisterHamBots(Ham_TraceAttack, "OnTraceAttack")
}

public OnTraceAttack(this, idattacker, Float:damage, Float:direction[3], tracehandle, damagebits)
{
	if (!is_user_connected(idattacker) || !(damagebits & DMG_BULLET))
	{
		return HAM_IGNORED
	}

	if (!zp_core_is_last_human(this))
	{
		return HAM_IGNORED
	}

	SetHamParamFloat(3, damage * get_pcvar_float(cv_last_human_damage))

	return HAM_HANDLED
}
Thank You so much my friend , always i find the help here , u r the best guys !
mohanad_2022 is offline
Reply



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 01:01.


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