AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Request Fix a compile Error (https://forums.alliedmods.net/showthread.php?t=337378)

mohanad_2022 04-17-2022 06:28

Request Fix a compile Error
 
1 Attachment(s)
Hello everyone , hope all are well

i have this sma code for nemesis mod and when i try compile it by the zombieplauge.inc ,, it give me some errors .. so .. i hope someone help me to fix it

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 <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;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ fbidis\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil\\ fcharset0 Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ ltrpar\\ lang1025\\ f0\\ fs16 \n\\ par }
*/ 





And Here the compile Error massage

PHP Code:

Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c1997-2013 ITB CompuPhaseAMX Mod X Team

Warning
Redefinition of constant/macro (symbol "CC_COLOR_RED"on line 22
Warning
Redefinition of constant/macro (symbol "CC_COLOR_TEAM"on line 22
Warning
Redefinition of constant/macro (symbol "CC_COLOR_BLUE"on line 23
Error
Undefined symbol "MAX_CLIENTS" on line 55
Error
Undefined symbol "RegisterHookChain" on line 69
Warning
Expression has no effect on line 69
Warning
Expression has no effect on line 69
Error
Expected token";"but found ")" on line 69
Error
Invalid expressionassumed zero on line 69
Error
Too many error messages on one line on line 69

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


i will attach the zombieplague.inc which i use

Dyaus 04-17-2022 14:58

Re: Request Fix a compile Error
 
the warning for colors comes from the include cromchat , they are already defined there no need to define them again in plugin so just remove this
Quote:

// Enums Colors
enum any:COLORS {
RED = 0, GREEN, BLUE
};
for the MAX_CLIENTS error just define it at start , put this somewhere on top:
#define MAX_CLIENTS 32

i also noticed you put #include <xs> twice on top , remove one.

for hookchain i don't have much of an idea so you'll have to wait for someone else to solve that

EDIT: for hookchain i think you're missing this .inc https://github.com/s1lentq/reapi/blo...lude/reapi.inc

+ARUKARI- 04-17-2022 20:56

Re: Request Fix a compile Error
 
RegisterHookChain is from ReAPI.
Are you using reapi? Then "#include <reapi>" should solve the problem.

mohanad_2022 04-18-2022 03:16

Re: Request Fix a compile Error
 
Quote:

Originally Posted by +ARUKARI- (Post 2777079)
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). 


raizo11 04-18-2022 08:23

Re: Request Fix a compile Error
 
1 Attachment(s)
Reapi 5.21.0.252

OciXCrom 04-18-2022 13:50

Re: Request Fix a compile Error
 
You can't just download a ReAPI plugin and use it on a server with no ReAPI module installed.
Also, cromchat is not used in that plugin so it should not be included.

mohanad_2022 04-19-2022 04:33

Re: Request Fix a compile Error
 
Quote:

Originally Posted by OciXCrom (Post 2777153)
You can't just download a ReAPI plugin and use it on a server with no ReAPI module installed.
Also, cromchat is not used in that plugin so it should not be included.

Alright Sir . i modifided it as you said , and i got new error .. i am not pro on programing ,, that why i ask for help ...

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>
#include <xs>
#include <levels>
#include <dhudmessage>
#include <engine>
#include <fun>
#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;



the compile error massage

PHP Code:

Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c1997-2013 ITB CompuPhaseAMX Mod X Team

Warning
Redefinition of constant/macro (symbol "CC_COLOR_RED"on line 23
Warning
Redefinition of constant/macro (symbol "CC_COLOR_TEAM"on line 23
Warning
Redefinition of constant/macro (symbol "CC_COLOR_BLUE"on line 24
Error
: Array index out of bounds (variable "g_pCvarGlowColors"on line 79
Error
: Array index out of bounds (variable "g_pCvarGlowColors"on line 80
Error
: Array index out of bounds (variable "g_pCvarGlowColors"on line 81
Error
Undefined symbol "amx_load_setting_string_arr" on line 108
Error
Undefined symbol "amx_load_setting_string_arr" on line 109
Error
Undefined symbol "amx_save_setting_string_arr" on line 118
Error
Undefined symbol "amx_save_setting_string_arr" on line 126
Error
Undefined symbol "amx_load_setting_string" on line 145
Error
Number of arguments does not match definition on line 145
Error
Undefined symbol "amx_save_setting_string" on line 146
Error
Undefined symbol "MAX_NAME_LENGTH" on line 164
Error
Invalid expressionassumed zero on line 164
Error
Undefined symbol "szAdminName" on line 164
Error
Too many error messages on one line on line 164

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


+ARUKARI- 04-19-2022 06:18

Re: Request Fix a compile Error
 
Do not ignore @Dyaus's post. #2
Quote:

for the MAX_CLIENTS error just define it at start , put this somewhere on top:
#define MAX_CLIENTS 32

i also noticed you put #include <xs> twice on top , remove one.
amx_load_setting_string_arr is probably due to the setting api.
#include <amx_settings_api>

mohanad_2022 04-19-2022 15:05

Re: Request Fix a compile Error
 
Quote:

Originally Posted by +ARUKARI- (Post 2777202)
Do not ignore @Dyaus's post. #2


amx_load_setting_string_arr is probably due to the setting api.
#include <amx_settings_api>

i did it .. and new problem
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 <amx_settings_api>
#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;


New Error Code :

PHP Code:

Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c1997-2013 ITB CompuPhaseAMX Mod X Team

Warning
Redefinition of constant/macro (symbol "CC_COLOR_RED"on line 24
Warning
Redefinition of constant/macro (symbol "CC_COLOR_TEAM"on line 24
Warning
Redefinition of constant/macro (symbol "CC_COLOR_BLUE"on line 25
Error
: Array index out of bounds (variable "g_pCvarGlowColors"on line 80
Error
: Array index out of bounds (variable "g_pCvarGlowColors"on line 81
Error
: Array index out of bounds (variable "g_pCvarGlowColors"on line 82
Error
Undefined symbol "MAX_NAME_LENGTH" on line 165
Error
Invalid expressionassumed zero on line 165
Error
Undefined symbol "szAdminName" on line 165
Error
Too many error messages on one line on line 165

Compilation aborted
.
7 Errors.
Done


+ARUKARI- 04-19-2022 20:55

Re: Request Fix a compile Error
 
So zombie_escape instead of zombieplague!
Delete all includes and replace with this.
PHP Code:

#include <amxmodx>
#include <zombie_escape>

#if !defined MAX_NAME_LENGTH
    #define MAX_NAME_LENGTH 32
#endif 

In addition, update amxmodx to the 1.9 transition because Warning occurs in reapi when compiling.


All times are GMT -4. The time now is 23:24.

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