View Single Post
mohanad_2022
Member
Join Date: Jan 2022
Location: Palestine
Old 04-18-2022 , 03:16   Re: Request Fix a compile Error
Reply With Quote #4

Quote:
Originally Posted by +ARUKARI- View Post
RegisterHookChain is from ReAPI.
Are you using reapi? Then "#include <reapi>" should solve the problem.

the new sma code
:

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>
#include <xs>
#include <levels>
#include <dhudmessage>
#include <engine>
#include <fun>
#include <cromchat>
#include <xs>
#include <reapi>
#include <zombieplague>

// Definitions
#define MODEL_MAX_LENGTH 64

#define Task_SetModel 1100

// Enums Colors
enum any:COLORS {
    
RED 0GREENBLUE
};

// Setting file.
new const ZE_SETTING_RESOURCES[] = {"zombie_escape.ini"};

// Default nemesis model.
new const szNemesisModel[][MODEL_MAX_LENGTH] = {
    
"ze_nemesis"
};

// Default nemesis claw.
new const szNemesisClaw[][MODEL_MAX_LENGTH] = {
    
"models/zombie_escape/ze_knife_nemesis.mdl"
};

// Default access flags.
new g_szAccessFlags[] = {"d"};

// Cvars Variables
new g_pCvarHealth,
        
g_pCvarBaseHealth,
        
g_pCvarSpeed,
        
g_pCvarGravity,
        
g_pCvarKnockback,
        
g_pCvarGlow,
        
g_pCvarGlowColors[COLORS],
        
g_pCvarDamage,
        
g_pCvarFrostNade,
        
g_pCvarFireNade;

// Global Variables
new g_iMaxPlayers,
        
g_iTaskIndex[MAX_CLIENTS+1],
        
bool:g_bIsNemesis[MAX_CLIENTS+1],
        
bool:g_bHasChosen;
        
// Dynamic Arrays
new Array:g_szNemesisModel,
        Array:
g_szNemesisClaw;

// Forward called after server activation.
public plugin_init() {
    
// Load plugin
    
register_plugin("[ZE] Class: Nemesis""1.3""z0h1r-LK");
    
    
// Hook Chain
    
RegisterHookChain(RG_CBasePlayer_TakeDamage"TakeDamagePlayer_Post"1);
    
    
// Cvars
    
g_pCvarHealth register_cvar("ze_nemesis_health""10000");
    
g_pCvarBaseHealth register_cvar("ze_nemesis_base_hp""1000");
    
g_pCvarSpeed register_cvar("ze_nemesis_speed""320");
    
g_pCvarGravity register_cvar("ze_nemesis_gravity""500");
    
g_pCvarKnockback register_cvar("ze_nemesis_knockback""160");
    
g_pCvarGlow register_cvar("ze_nemesis_glow""1");
    
g_pCvarGlowColors[RED] = register_cvar("ze_nemesis_glow_r""255");
    
g_pCvarGlowColors[GREEN] = register_cvar("ze_nemesis_glow_g""0");
    
g_pCvarGlowColors[BLUE] = register_cvar("ze_nemesis_glow_b""0");
    
g_pCvarDamage register_cvar("ze_nemesis_damage""2");
    
g_pCvarFrostNade register_cvar("ze_nemesis_frostnade""1");
    
g_pCvarFireNade register_cvar("ze_nemesis_firenade""1");
    
    
// Console commands
    
register_concmd("ze_nemesis""concmd_SetNemesis", -1"<Make player nemesis>");
    
    
// Default Values
    
g_iMaxPlayers get_member_game(m_nMaxPlayers);
}

// Forward allows register natives.
public plugin_natives() {
    
// New natives.
    
register_native("ze_is_user_nemesis""_native_ze_is_user_nemesis"1);
    
register_native("ze_set_user_nemesis""_native_ze_set_user_nemesis"1);
    
register_native("ze_remove_user_nemesis""_native_ze_remove_user_nemesis"1);
}

// Forward allows precaching game files (models, sounds, generic files)
public plugin_precache() {
    
// Initialize arrays
    
g_szNemesisModel ArrayCreate(64);
    
g_szNemesisClaw ArrayCreate(64);
    
    
// Load file path from externel file.
    
amx_load_setting_string_arr(ZE_SETTING_RESOURCES"Player Models""NEMESIS"g_szNemesisModel);
    
amx_load_setting_string_arr(ZE_SETTING_RESOURCES"Weapon Models""V_KNIFE NEMESIS"g_szNemesisClaw);
    
    
// Save default resource's.
    
new iIndex;
    if (
ArraySize(g_szNemesisModel) == 0) {
        for (
iIndex 0iIndex sizeof (szNemesisModel); iIndex++)
            
ArrayPushString(g_szNemesisModelszNemesisModel[iIndex]);

        
// Save model name in external file.
        
amx_save_setting_string_arr(ZE_SETTING_RESOURCES"Player Models""NEMESIS"g_szNemesisModel);
    }
    
    if (
ArraySize(g_szNemesisClaw) == 0) {
        for (
iIndex 0iIndex sizeof (g_szNemesisClaw); iIndex++)
            
ArrayPushString(g_szNemesisClawszNemesisClaw[iIndex]);
            
        
// Save model name in external file.
        
amx_save_setting_string_arr(ZE_SETTING_RESOURCES"Weapon Models""V_KNIFE NEMESIS"g_szNemesisClaw);
    }
    
    
// Precache models.
    
new szModel[64], szPathModel[128];
    for (
iIndex 0iIndex ArraySize(g_szNemesisModel); iIndex++) {
        
// Get model name from dynamic array.
        
ArrayGetString(g_szNemesisModeliIndexszModelcharsmax(szModel));
        
formatex(szPathModelcharsmax(szPathModel), "models/player/%s/%s.mdl"szModelszModel// Get model path.
        
precache_model(szPathModel); // Precache model's.
    
}
    
    for (
iIndex 0iIndex ArraySize(g_szNemesisClaw); iIndex++) {
        
// Get model path from dynamic arrays.
        
ArrayGetString(g_szNemesisClawiIndexszModelcharsmax(szModel));
        
precache_model(szModel); // Precache model's.
    
}
    
    
// Load access flags from external file.
    
if (amx_load_setting_string(ZE_SETTING_RESOURCES"Access Flags""Make Nemesis"g_szAccessFlagscharsmax(g_szAccessFlags)))
        
amx_save_setting_string(ZE_SETTING_RESOURCES"Access Flags""Make Nemesis"g_szAccessFlags);
}

// Function called when execute command in console
public concmd_SetNemesis(iIndex) {
    
// Is don't have access.
    
if (!(get_user_flags(iIndex) & read_flags(g_szAccessFlags))) {
        
console_print(iIndex"%L"LANG_PLAYER"CMD_NOT_ACCESS");
        return;
    }
    
    
// Zombies has chosen.
    
if (!g_bHasChosen) {
        
console_print(iIndex"%L"LANG_PLAYER"ZOMBIE_NOT_CHOSEN");
        return;
    }
    
    
// Get target name.
    
new szName[MAX_NAME_LENGTH], szAdminName[MAX_NAME_LENGTH], iTarget;
    
read_argv(1szNamecharsmax(szName));
    
iTarget cmd_target(iIndexszName, (CMDTARGET_ONLY_ALIVE CMDTARGET_ALLOW_SELF));
    
    
// Is not found.
    
if (!is_user_connected(iTarget)) {
        
console_print(iIndex"%L"LANG_PLAYER"CMD_NOT_FOUND");
        return;
    }
    
    
// Him is already nemesis.
    
if (g_bIsNemesis[iTarget]) {
        
console_print(iIndex"%L"LANG_PLAYER"ALREADY_NEMESIS");
        return;        
    }    
    
    
// Don't make the last human to nemesis.
    
if (ze_get_humans_number() == && !ze_is_user_zombie(iTarget)) {
        
console_print(iIndex"%L"LANG_PLAYER"CMD_LAST_HUMAN");
        return;        
    }    
    
    
// Set client nemesis.
    
Set_User_Nemesis(iTarget);
    
    
// Get admin name.
    
get_user_name(iIndexszAdminNamecharsmax(szAdminName));
    
    
// Get target name.
    
get_user_name(iTargetszNamecharsmax(szName));
    
    
// Sent message in chat.
    
ze_colored_print(0"%L"LANG_PLAYER"CHAT_MAKE_NEMESIS"szAdminNameszName);
}

// Forward called when zombies chosen.
public ze_zombie_appear() {
    
// Zombies has chosen.
    
g_bHasChosen true;
}

// Forward called before frostnade freeze zombie.
public ze_frost_pre(iVictim) {
    
// Block freezing the nemesis.
    
if (get_pcvar_num(g_pCvarFrostNade) && g_bIsNemesis[iVictim])
        return 
PLUGIN_HANDLED;
    return 
PLUGIN_CONTINUE;
}

// Forward called before firenade burn zombie.
public ze_fire_pre(iVictim) {
    
// Block burning the nemesis.
    
if (get_pcvar_num(g_pCvarFireNade) && g_bIsNemesis[iVictim])
        return 
PLUGIN_HANDLED;
    return 
PLUGIN_CONTINUE;
}

// Forward called every round.
public ze_game_started_pre() {
    
// Remove tasks (Set model).
    
new iIndex;
    for (
iIndex 1iIndex <= g_iMaxPlayersiIndex++)
        
remove_task(g_iTaskIndex[iIndex]); // Remove all tasks (Set model).
}

// Forward called when set human.
public ze_user_humanized(iIndex) {
    
// Player is a nemesis
    
if (g_bIsNemesis[iIndex])
        
Remove_User_Nemesis(iIndex)
}

// Forward called before infect player.
public ze_user_infected_pre(iVictimiInfectoriDamage) {
    
// Is not a nemesis.
    
if (!g_bIsNemesis[iInfector])
        return 
PLUGIN_CONTINUE;
        
    
// Damage Human.
    
if (get_pcvar_float(g_pCvarDamage) > 0)    
        
rg_multidmg_add(iInfectoriVictimfloat(iDamage) * get_pcvar_float(g_pCvarDamage), DMG_GENERIC);
    else 
        
rg_multidmg_add(iInfectoriVictimfloat(iDamage), DMG_GENERIC);
    
    
// Block infect human.
    
return PLUGIN_HANDLED;
}

// Hook called when player damaged.
public TakeDamagePlayer_Post(iVictimiInflectoriAttackerFloat:flDamagebitsDamageType) {
    
// Invalid player.
    
if (!is_user_connected(iVictim) || !is_user_connected(iAttacker))
        return;
        
    
// Attacker is not a nemesis.
    
if (!g_bIsNemesis[iAttacker])
        return;
        
    
// Remove Pain Shock.
    
set_member(iVictimm_flVelocityModifier1.0);
}

public 
Set_User_Nemesis(iIndex) {
    
// Set him zombie, If not.
    
if (!ze_is_user_zombie(iIndex))
        
ze_set_user_zombie(iIndex);
    
    
// Is already Nemesis.
    
if (!g_bIsNemesis[iIndex])
        
g_bIsNemesis[iIndex] = true;
    
    
// Set nemesis a some attributes.
    
if (get_pcvar_num(g_pCvarHealth) > 0) {
        
set_entvar(iIndexvar_healthget_pcvar_float(g_pCvarHealth));
    } else {
        if (
get_pcvar_num(g_pCvarBaseHealth) > && GetAllAlivePlayersNum() > 5) {
            
set_entvar(iIndexvar_health, (get_pcvar_float(g_pCvarBaseHealth) * GetAllAlivePlayersNum()));
        } else {
            
set_entvar(iIndexvar_healthget_pcvar_float(g_pCvarHealth));
        }
    }
    
    if (
get_pcvar_num(g_pCvarSpeed) > 0ze_set_zombie_speed(iIndexget_pcvar_num(g_pCvarSpeed)); // Set nemesis custom speed.
    
if (get_pcvar_num(g_pCvarGravity) > 0ze_set_user_gravity(iIndexget_pcvar_num(g_pCvarGravity)); // Set nemesis custom gravity.
    
if (get_pcvar_num(g_pCvarKnockback) > 0ze_set_user_knockback(iIndexget_pcvar_float(g_pCvarKnockback)); // Set nemesis custom knockback.
    
    // Set nemesis rendering "Glow Shell"
    
if (get_pcvar_num(g_pCvarGlow) > 0)
        
Set_Rendering(iIndexkRenderFxGlowShellget_pcvar_num(g_pCvarGlowColors[RED]), get_pcvar_num(g_pCvarGlowColors[GREEN]), get_pcvar_num(g_pCvarGlowColors[BLUE]), kRenderNormal20);

    
/* 
    * New Task, Delay before set nemesis model and claw nemesis.
    * When ze_resource.amxx set zombies model, After 0.1s remove old zombie model and set nemesis model.
    */
    
g_iTaskIndex[iIndex] = iIndex+Task_SetModel;
    
set_task(0.1"Set_Nemesis_Model"g_iTaskIndex[iIndex]);
}

public 
Set_Nemesis_Model(iTask) {
    new 
szModel[64], szClawModel[64], iIndex;
    
    
// Change task id to client index.
    
iIndex iTask-Task_SetModel;

    
// Get model name and claw model path from dynamic arrays
    
ArrayGetString(g_szNemesisModelrandom_num(0ArraySize(g_szNemesisModel) - 1), szModelcharsmax(szModel));
    
ArrayGetString(g_szNemesisClawrandom_num(0ArraySize(g_szNemesisClaw) - 1), szClawModelcharsmax(szClawModel));
    
    
// Set a nemesis model.
    
rg_set_user_model(iIndexszModel);
    
    
// Set a nemesis claw.
    
cs_set_player_view_model(iIndexCSW_KNIFEszClawModel);
    
cs_set_player_weap_model(iIndexCSW_KNIFE"");
}

public 
Remove_User_Nemesis(iIndex) {
    
// Is a Nemesis.
    
if (g_bIsNemesis[iIndex])
        
g_bIsNemesis[iIndex] = false;
        
    
// Remove nemesis.
    
ze_reset_zombie_speed(iIndex// Reset speed to zombie speed.
    
ze_reset_user_gravity(iIndex// Reset gravity to zombie gravity.
    
ze_reset_user_knockback(iIndex// Reset knockback to default knockback.
    
Set_Rendering(iIndex// Remove rendering (Glow Shell).
}

// Forward called when round end.
public ze_roundend(iWinTeam) {
    
g_bHasChosen false;
}

/**
 * Functions of natives
 */ 
public _native_ze_is_user_nemesis(const id) {
    
// Return true if client is nemesis, false otherwise.
    
return g_bIsNemesis[id];
}

public 
_native_ze_set_user_nemesis(const id) {
    
// Is not found.
    
if (!is_user_connected(id)) {
        
log_error(AMX_ERR_NATIVE"[ZE] Invalid player (%d)"id);
        return 
0;
    }
    
    
// Set client nemesis.
    
Set_User_Nemesis(id);
    return 
1;
}

public 
_native_ze_remove_user_nemesis(const id) {
    
// Is not found.
    
if (!is_user_connected(id)) {
        
log_error(AMX_ERR_NATIVE"[ZE] Invalid player (%d)"id);
        return 
0;
    }
    
    
// Set client nemesis.
    
Remove_User_Nemesis(id);
    return 
1;

i did it my friend but new error code
PHP Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c1997-2013 ITB CompuPhaseAMX Mod X Team

C
:\Users\Mohanad\Desktop\Darkness_ZE\Darkness ZE\addons\amxmodx\scripting\include\reapi.inc(7) : error 010invalid function or declaration
C
:\Users\Mohanad\Desktop\Darkness_ZE\Darkness ZE\addons\amxmodx\scripting\include\reapi.inc(19) : error 075input line too long (after substitutions)
C:\Users\Mohanad\Desktop\Darkness_ZE\Darkness ZE\addons\amxmodx\scripting\include\reapi.inc(29) : error 075input line too long (after substitutions)
C:\Users\Mohanad\Desktop\Darkness_ZE\Darkness ZE\addons\amxmodx\scripting\include\reapi.inc(31) : error 010invalid function or declaration
C
:\Users\Mohanad\Desktop\Darkness_ZE\Darkness ZE\addons\amxmodx\scripting\include\reapi.inc(32) : error 010invalid function or declaration
C
:\Users\Mohanad\Desktop\Darkness_ZE\Darkness ZE\addons\amxmodx\scripting\include\reapi.inc(33) : error 010invalid function or declaration
C
:\Users\Mohanad\Desktop\Darkness_ZE\Darkness ZE\addons\amxmodx\scripting\include\reapi.inc(35) : error 010invalid function or declaration
C
:\Users\Mohanad\Desktop\Darkness_ZE\Darkness ZE\addons\amxmodx\scripting\include\reapi.inc(38) : error 010invalid function or declaration
C
:\Users\Mohanad\Desktop\Darkness_ZE\Darkness ZE\addons\amxmodx\scripting\include\reapi.inc(39) : error 010invalid function or declaration
C
:\Users\Mohanad\Desktop\Darkness_ZE\Darkness ZE\addons\amxmodx\scripting\include\reapi.inc(40) : error 010invalid function or declaration
C
:\Users\Mohanad\Desktop\Darkness_ZE\Darkness ZE\addons\amxmodx\scripting\include\reapi.inc(41) : error 010invalid function or declaration
C
:\Users\Mohanad\Desktop\Darkness_ZE\Darkness ZE\addons\amxmodx\scripting\include\reapi.inc(42) : error 010invalid function or declaration
C
:\Users\Mohanad\Desktop\Darkness_ZE\Darkness ZE\addons\amxmodx\scripting\include\reapi.inc(43) : error 010invalid function or declaration
C
:\Users\Mohanad\Desktop\Darkness_ZE\Darkness ZE\addons\amxmodx\scripting\include\reapi.inc(44) : error 010invalid function or declaration
C
:\Users\Mohanad\Desktop\Darkness_ZE\Darkness ZE\addons\amxmodx\scripting\include\reapi.inc(45) : error 010invalid function or declaration
C
:\Users\Mohanad\Desktop\Darkness_ZE\Darkness ZE\addons\amxmodx\scripting\include\reapi.inc(50) : error 010invalid function or declaration
C
:\Users\Mohanad\Desktop\Darkness_ZE\Darkness ZE\addons\amxmodx\scripting\include\reapi.inc(52) : error 010invalid function or declaration
C
:\Users\Mohanad\Desktop\Darkness_ZE\Darkness ZE\addons\amxmodx\scripting\include\reapi.inc(55) : error 010invalid function or declaration
C
:\Users\Mohanad\Desktop\Darkness_ZE\Darkness ZE\addons\amxmodx\scripting\include\reapi.inc(56) : error 010invalid function or declaration
C
:\Users\Mohanad\Desktop\Darkness_ZE\Darkness ZE\addons\amxmodx\scripting\include\reapi.inc(63) : error 010invalid function or declaration
C
:\Users\Mohanad\Desktop\Darkness_ZE\Darkness ZE\addons\amxmodx\scripting\include\reapi.inc(66) : error 010invalid function or declaration
C
:\Users\Mohanad\Desktop\Darkness_ZE\Darkness ZE\addons\amxmodx\scripting\include\reapi.inc(96) : error 010invalid function or declaration
C
:\Users\Mohanad\Desktop\Darkness_ZE\Darkness ZE\addons\amxmodx\scripting\include\reapi.inc(98) : error 010invalid function or declaration
C
:\Users\Mohanad\Desktop\Darkness_ZE\Darkness ZE\addons\amxmodx\scripting\include\reapi.inc(114) : error 010invalid function or declaration
C
:\Users\Mohanad\Desktop\Darkness_ZE\Darkness ZE\addons\amxmodx\scripting\include\reapi.inc(117) : error 075input line too long (after substitutions)
C:\Users\Mohanad\Desktop\Darkness_ZE\Darkness ZE\addons\amxmodx\scripting\include\reapi.inc(121) : error 010invalid function or declaration

Compilation aborted
.
26 Errors.
Could not locate output file C:\Users\Mohanad\Desktop\ze_class_nemesis.amx (compile failed). 

Last edited by mohanad_2022; 04-18-2022 at 03:19.
mohanad_2022 is offline