- Ошибка
-
Mode_Trigger_Discipline.sma(55) : error 017: undefined symbol "MAX_PLAYERS"
Mode_Trigger_Discipline.sma(55) : error 009: invalid array size (negative or zero)
Mode_Trigger_Discipline.sma(61) : error 017: undefined symbol "specialbot"
Mode_Trigger_Discipline.sma(61) : warning 215: expression has no effect
Mode_Trigger_Discipline.sma(61) : error 001: expected token: ";", but found ")"
Mode_Trigger_Discipline.sma(61) : error 029: invalid expression, assumed zero
Mode_Trigger_Discipline.sma(61) : fatal error 107: too many error messages on one line
- Компилятор
- WEB-компилятор
- Amx Mod X
- 1.9.0
- Исходный код
-
#include <amxmodx>
#include <hamsandwich>
#include <fun>
#include <hlsdk_const>
new bool: g_bModeEnabled;
enum any: Health_settings {
HEALTH_PUNISH = -10, // How many health will be taken
HEALTH_BONUS = 50, // .. given for the kill
HEALTH_MIN = 1, // Min health points (HP) on player
HEALTH_MAX = 100 // Max HP can be on player
}
enum any: H_TYPES_s {
_TraceAttack_world,
_TraceAttack_breakable,
_TakeDamage_player,
_Killed
}
new any: Hooks[H_TYPES_s];
new Float: g_fLastDamage[MAX_PLAYERS + 1];
public plugin_init() {
register_plugin("Mode: Trigger Discipline", "0.0.1b", "wopox1337 @ Dev-CS.ru");
Hooks[_TraceAttack_world] = RegisterHam(Ham_TraceAttack, "worldspawn", "TraceAttack_World_Post", .Post = true, .specialbot = true);
Hooks[_TraceAttack_breakable] = RegisterHam(Ham_TraceAttack, "func_breakable", "TraceAttack_World_Post", .Post = true, .specialbot = true);
Hooks[_TakeDamage_player] = RegisterHam(Ham_TakeDamage, "player", "CBasePlayer_TakeDamage", .Post = true, .specialbot = true);
Hooks[_Killed] = RegisterHam(Ham_Killed, "player", "CBasePlayer_Killed_Post", .Post = true, .specialbot = true);
new pcvar = create_cvar(
.name = "mp_gamemode_Trigger_Discipline",
.string = "0",
.flags = FCVAR_PROTECTED,
.description = "Toggle Trigger Discipline mode.",
.has_min = true,
.min_val = 0.0,
.has_max = true,
.max_val = 1.0
)
hook_cvar_change(pcvar, "hookCvar_ModeChange");
bind_pcvar_num(pcvar, g_bModeEnabled);
Toggle_Mode(g_bModeEnabled);
}
public CBasePlayer_TakeDamage(pPlayer, idinflictor, iAttacker, Float:damage, damagebits) {
if(is_user_alive(iAttacker))
g_fLastDamage[iAttacker] = get_gametime();
}
public TraceAttack_World_Post(iVictim, iAttacker, Float: fDamage, Float: vDirection[3], tracehandle, damagebits) {
if(g_fLastDamage[iAttacker] != get_gametime()) {
add_user_health(iAttacker, HEALTH_PUNISH);
// Need hud ?!
Show_DamageHUD(iAttacker);
}
}
public CBasePlayer_Killed_Post(iVictim, iAttacker, shouldgib) {
add_user_health(iAttacker, HEALTH_BONUS);
// Need hud ?!
}
public hookCvar_ModeChange(pCvar) {
Toggle_Mode(g_bModeEnabled);
log_amx("== [Mode %s]", g_bModeEnabled ? "enabled" : "disabled");
}
new g_szCvars_Enabled[][] = {
"sv_restart 1"
}
new g_szCvars_Disabled[][] = {
"sv_restart 1"
}
Toggle_Mode(iStatus) {
switch(iStatus) {
case true: {
for(new i; i < H_TYPES_s; i++) {
if(Hooks[i]) {
EnableHamForward(Hooks[i]);
}
}
ExecCMDS(g_szCvars_Enabled, charsmax(g_szCvars_Enabled));
}
case false: {
for(new i; i < H_TYPES_s; i++) {
if(Hooks[i]) {
DisableHamForward(Hooks[i]);
}
}
ExecCMDS(g_szCvars_Disabled, charsmax(g_szCvars_Disabled));
}
}
}
stock ExecCMDS(szBuffer[][], const iLen) {
for(new i; i <= iLen; i++) {
server_cmd(szBuffer[i]);
}
}
stock add_user_health(const pPlayer, const iHealth)
{
if(!is_user_alive(pPlayer))
return;
// ExecuteHam - not approach
set_user_health(pPlayer, clamp(get_user_health(pPlayer) + iHealth, 1, HEALTH_MAX));
}
Show_DamageHUD(pPlayer)
{
static msgDamage;
if(!msgDamage)
msgDamage = get_user_msgid("Damage");
static vecOrigin[3];
get_user_origin(pPlayer, vecOrigin);
message_begin(MSG_ONE_UNRELIABLE, msgDamage, .player = pPlayer)
write_byte(0);
write_byte(1);
write_long(DMG_BULLET);
write_coord(vecOrigin[0]);
write_coord(vecOrigin[1]);
write_coord(vecOrigin[2]);
message_end();
}
не могу никак не скомпилировать
24 Апр 2019
В этой теме было размещено решение! Перейти к решению.