Skocz do zawartości

Nowy szablon forum

mygo.pl

Stworzyliśmy dla Was nowy wygląd forum. Z pewnością znajdziesz rzeczy, które wg Ciebie mogą zostać zmienione - wspomnij o tym w specjalnym wątku.

Czytaj więcej

Jak założyć własną sieć

serwerów CS

Zastanawiasz się nad prowadzeniem własnej sieci serwerów? Przeczytaj podstawowe informacje, na które należy zwrócić uwagę, przy takim projekcie.

Czytaj więcej

Tworzymy spis sieci

dodaj swoją

Dodaj sieć do której należysz, pozwoli to na promocję i budowę ogólnopolskiej bazy sieci CS.

Czytaj więcej

RSSRequst edite on sma


MYGO.pl
 Udostępnij

Rekomendowane odpowiedzi

  • RSSy
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;


Przeczytaj cały wpis

Odnośnik do komentarza
Udostępnij na innych stronach

Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
 Udostępnij

  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...