Ошибка при компиляции плагина

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
102
Реакции
16
Ошибка
//// injection.sma
//
// C:\Users\User\Desktop\╒ырь\╩юьяшы ЄюЁ\injection.sma(35) : error 001: expected token: ",", but found "("
// C:\Users\User\Desktop\╒ырь\╩юьяшы ЄюЁ\injection.sma(35) : warning 215: expression has no effect
// C:\Users\User\Desktop\╒ырь\╩юьяшы ЄюЁ\injection.sma(35) : error 001: expected token: ";", but found ")"
// C:\Users\User\Desktop\╒ырь\╩юьяшы ЄюЁ\injection.sma(35) : error 029: invalid expression, assumed zero
// C:\Users\User\Desktop\╒ырь\╩юьяшы ЄюЁ\injection.sma(35) : fatal error 107: too many error messages on one line
//
// Compilation aborted.
// 4 Errors.
// Could not locate output file C:\Users\User\Desktop\╒ырь\╩юьяшы ЄюЁ\compiled\injection.amx (compile failed).
//
// Compilation Time: 0,7 sec
// ----------------------------------------

Press enter to exit ...
Компилятор
Локальный
Amx Mod X
1.10.0
Исходный код
#include <amxmodx>
#include <hamsandwich>
#include <reapi>

public stock const VERSION[] = "1.1.2";

enum _:CVARS
{
ACCESS[32],
ROUND,
Float:HEALTH,
Float:HEALTH_PERCENT,
USE_METHOD,
SEQUENCE,
VIP,
DIFF,
ONE_ROUND,
KILL,
V_MODEL[MAX_RESOURCE_PATH_LENGTH],
P_MODEL[MAX_RESOURCE_PATH_LENGTH],
SAMPLE[MAX_RESOURCE_PATH_LENGTH],

}; new CVAR[CVARS];


new g_iAccess;
new g_bHasInjection;
new Float:g_flAnimationLength;


public plugin_precache()
{
register_plugin("Injection Med-Kit", VERSION, "Emma Jule");

bind_pcvar_string(create_cvar("inj_access", "d", .description = "Флаг доступа к шприцу"), CVAR[ACCESS] charsmax(CVAR[ACCESS]));
bind_pcvar_num(create_cvar("inj_round", "2", .description = "С какого раунда доступен шприц"), CVAR[ROUND]);
bind_pcvar_float(create_cvar("inj_health", "50.0", .description = "Кол-во пополняемого здоровья", .has_max = true, .max_val = 100.0), CVAR[HEALTH]);
bind_pcvar_float(create_cvar("inj_health_percent", "80.0", .description = "Использовать шприц можно, только если у игрока меньше # здоровья", .has_min = true, .min_val = 1.0, .has_max = true, .max_val = 100.0), CVAR[HEALTH_PERCENT]);
bind_pcvar_num(create_cvar("inj_use_method", "3", .description = "Метод использования:^n0 - через Z (radio1)^n1 - через X (radio2)^n2 - через C (radio3)^n3 - через G (drop)", .has_max = true, .max_val = 3.0), CVAR[USE_METHOD]);
bind_pcvar_num(create_cvar("inj_sequence", "0", .description = "Индекс анимации модели шприца"), CVAR[SEQUENCE]);
bind_pcvar_num(create_cvar("inj_vip", "0", .description = "Запрет VIP игроку использовать шприц (на as_* картах)"), CVAR[VIP]);
bind_pcvar_num(create_cvar("inj_win_diff", "5", .description = "Разница между победами команд, для блокировки шприца"), CVAR[DIFF]);
bind_pcvar_num(create_cvar("inj_only_round", "1", .description = "Использовать шприц игрок сможет только один раз за раунд"), CVAR[ONE_ROUND]);
bind_pcvar_num(create_cvar("inj_kill_reset", "1", .description = "Убирать у игрока шприц если он умер"), CVAR[KILL]);
bind_pcvar_string(create_cvar("inj_v_model", "models/legendarycs/injectorX/v_injectorX.mdl", .description = "V модель шприца (обязательно)"), CVAR[V_MODEL], charsmax(CVAR[V_MODEL]));
bind_pcvar_string(create_cvar("inj_p_model", "models/legendarycs/injectorX/p_injectorX.mdl", .description = "P модель шприца (опционально)"), CVAR[P_MODEL], charsmax(CVAR[P_MODEL]));
bind_pcvar_string(create_cvar("inj_sample", "items/medshot4.wav", .description = "Звук после иньекции (опционально)"), CVAR[SAMPLE], charsmax(CVAR[SAMPLE]));

precache_model(CVAR[V_MODEL]);
{
if (!(g_flAnimationLength = UTIL_CalculateAnimationLength(CVAR[V_MODEL], CVAR[SEQUENCE])))
set_fail_state("Модель или анимация шприца не подходит :P");
}

if (!file_exists(CVAR[P_MODEL]))
CVAR[P_MODEL][0] = '^0';
else
precache_model(CVAR[P_MODEL]);

if (!file_exists(fmt("sound/%s", CVAR[SAMPLE])))
CVAR[SAMPLE][0] = '^0';
else
precache_sound(CVAR[SAMPLE]);

switch (CVAR[USE_METHOD])
{
case 0:
register_clcmd("radio1", "@use_injection");

case 1:
register_clcmd("radio2", "@use_injection");

case 2:
register_clcmd("radio3", "@use_injection");

case 3:
register_clcmd("drop", "@use_injection");
}

g_iAccess = read_flags(CVAR[ACCESS]);

AutoExecConfig(.name = "injection");
}

public plugin_init()
{
register_dictionary("injection.txt");

RegisterHam(Ham_Item_Holster, "weapon_knife", "CBaseWeapon_Holster", true);
RegisterHam(Ham_Item_Deploy, "weapon_knife", "CBaseWeapon_Deploy", true);

RegisterHookChain(RG_CBasePlayer_OnSpawnEquip, "CBasePlayer_OnSpawnEquip", true);

if (CVAR[KILL])
RegisterHookChain(RG_CBasePlayer_Killed, "CBasePlayer_Killed", true);
}

public GiveUserInjection(id)
{
if (get_member_game(m_iTotalRoundsPlayed) + 1 < CVAR[ROUND])
client_print_color(id, print_team_red, "%L %L", LANG_PLAYER, "INJ_PREFIX", LANG_PLAYER, "INJ_ROUND", CVAR[ROUND]);
else if (!is_user_alive(id))
client_print_color(id, print_team_red, "%L %L", LANG_PLAYER, "INJ_PREFIX", LANG_PLAYER, "INJ_ALIVE");
else if (CVAR[VIP] && get_member(id, m_bIsVIP))
client_print_color(id, print_team_red, "%L %L", LANG_PLAYER, "INJ_PREFIX", LANG_PLAYER, "INJ_VIP");
else if (CVAR[ONE_ROUND] && get_member(id, m_iNumSpawns) > 1)
client_print_color(id, print_team_red, "%L %L", LANG_PLAYER, "INJ_PREFIX", LANG_PLAYER, "INJ_PER_ROUND");
else if (get_member(id, m_iTeam) == UTIL_GetTeamDominate())
client_print(id, print_center, "%L", LANG_PLAYER, "INJ_DOMINA");
else if (flag_get(g_bHasInjection, id))
client_print(id, print_center, "%L", LANG_PLAYER, "INJ_ALREADY");
else
{
flag_set(g_bHasInjection, id);

client_print_color(id, print_team_default, "%L %L", LANG_PLAYER, "INJ_PREFIX", LANG_PLAYER, "INJ_NOTIFY");
}

return PLUGIN_HANDLED;
}

public CBasePlayer_OnSpawnEquip(id)
{
if (get_member_game(m_iTotalRoundsPlayed) + 1 < CVAR[ROUND])
{
flag_unset(g_bHasInjection, id);
return;
}

if (CVAR[ONE_ROUND] && get_member(id, m_iNumSpawns) > 1)
return;

if (~get_user_flags(id) & g_iAccess)
return;

flag_set(g_bHasInjection, id);
}

public CBasePlayer_Killed(id)
{
flag_unset(g_bHasInjection, id);
}

public CBaseWeapon_Deploy(const pWeapon)
{
new id = get_member(pWeapon, m_pPlayer);

if (!flag_get(g_bHasInjection, id))
return;

if (get_user_health(id) > 35)
return;

client_print(id, print_center, "%L", LANG_PLAYER, "INJ_LOW_HP");
}

public CBaseWeapon_Holster(const pWeapon)
{
SetThink(pWeapon, "");
}

public client_disconnected(id)
{
flag_unset(g_bHasInjection, id);
}

@use_injection(id)
{
if (get_member_game(m_bRoundTerminating))
return PLUGIN_CONTINUE;

if (!is_user_alive(id))
return PLUGIN_CONTINUE;

if (!flag_get(g_bHasInjection, id))
return PLUGIN_CONTINUE;

if (CVAR[VIP] && get_member(id, m_bIsVIP))
return PLUGIN_CONTINUE;

new pWeapon = get_member(id, m_pActiveItem);
if (is_nullent(pWeapon) || get_member(pWeapon, m_iId) != CSW_KNIFE)
return PLUGIN_CONTINUE;

if (get_member(id, m_iTeam) == UTIL_GetTeamDominate())
{
client_print(id, print_center, "%L", LANG_PLAYER, "INJ_DOMINA");
return PLUGIN_HANDLED;
}

if ((Float:get_entvar(id, var_health) * 100.0 / Float:get_entvar(id, var_max_health)) >= CVAR[HEALTH_PERCENT])
{
client_print(id, print_center, "%L", LANG_PLAYER, "INJ_FULL_HP");
return PLUGIN_HANDLED;
}

ExecuteHam(Ham_Weapon_PrimaryAttack, pWeapon);

set_member(id, m_flNextAttack, g_flAnimationLength);
set_member(id, m_szAnimExtention, "c4");

set_entvar(id, var_viewmodel, CVAR[V_MODEL]);
if (CVAR[P_MODEL][0])
set_entvar(id, var_weaponmodel, CVAR[P_MODEL]);

UTIL_SendWeaponAnim(id, CVAR[SEQUENCE]);

SetThink(pWeapon, "CWeapon__Think");

set_entvar(pWeapon, var_nextthink, get_gametime() + g_flAnimationLength);

return PLUGIN_HANDLED;
}

public CWeapon__Think(pWeapon)
{
if (is_nullent(pWeapon))
return;

new id = get_entvar(pWeapon, var_owner);

ExecuteHamB(Ham_TakeHealth, id, CVAR[HEALTH], DMG_GENERIC);

flag_unset(g_bHasInjection, id);
rg_switch_weapon(id, pWeapon);
UTIL_ScreenFade(id);

if (CVAR[SAMPLE][0])
rh_emit_sound2(id, 0, CHAN_ITEM, CVAR[SAMPLE]);

client_print_color(id, print_team_blue, "%L %L", LANG_PLAYER, "INJ_PREFIX", LANG_PLAYER, "INJ_SUCCESFULLY_INJECTED");

SetThink(pWeapon, "");
}

stock TeamName:UTIL_GetTeamDominate(&diff = 0)
{
if (!CVAR[DIFF])
return TEAM_UNASSIGNED;

new TeamName:team = TEAM_UNASSIGNED;

if ((diff = get_member_game(m_iNumTerroristWins) - get_member_game(m_iNumCTWins)) > 0)
team = TEAM_TERRORIST;
else if (diff < 0)
team = TEAM_CT;

return (
abs(diff) < CVAR[DIFF] ? TEAM_UNASSIGNED : team
);
}

stock UTIL_SendWeaponAnim(const id, const sequence)
{
set_entvar(id, var_weaponanim, sequence);

message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, .player = id);
write_byte(sequence);
write_byte(0);
message_end();
}

stock UTIL_BlinkAccount(id, const times = 2, bool:bShowMessage = false)
{
if (bShowMessage)
client_printex(id, print_center, "#Not_Enough_Money");

static iMsgBlinkAcct;
if (iMsgBlinkAcct || (iMsgBlinkAcct = get_user_msgid("BlinkAcct")))
{
message_begin(MSG_ONE_UNRELIABLE, iMsgBlinkAcct, .player = id);
write_byte(times);
message_end();
}
}

stock UTIL_ScreenFade(const id, const Float:fxtime = 1.0, const Float:holdtime = 0.3, const color[3] = { 0, 200, 0 }, const alpha = 150)
{
if (Float:get_member(id, m_blindUntilTime) > get_gametime())
return;

static iMsgScreenFade;
if (iMsgScreenFade || (iMsgScreenFade = get_user_msgid("ScreenFade")))
{
message_begin(MSG_ONE_UNRELIABLE, iMsgScreenFade, .player = id);
write_short(clamp(floatround(fxtime * (1 << 12)), 0, 0xFFFF));
write_short(clamp(floatround(holdtime * (1 << 12)), 0, 0xFFFF));
write_short(0x0000);
write_byte(color[0]);
write_byte(color[1]);
write_byte(color[2]);
write_byte(alpha);
message_end();
}
}

stock Float:UTIL_CalculateAnimationLength(const szModel[], const sequence)
{
new file = fopen(szModel, "rb");

if (!file)
return 0.0;

new aData[32], i, seqs, frames, Float:FPS;

fseek(file, 164, SEEK_SET);
{
fread(file, seqs, BLOCK_INT);
fread(file, i, BLOCK_INT);

if (!(0 <= sequence < seqs))
return 0.0;
}

fseek(file, i + 176 * sequence, SEEK_SET);
fread_blocks(file, aData, 32, BLOCK_CHAR);

if (aData[0] == '^0')
return 0.0;

fread(file, _:FPS, BLOCK_INT);
fseek(file, 20, SEEK_CUR);
fread(file, frames, BLOCK_INT);

fclose(file);

return Float:(
frames / FPS
);
}
Всем привет! Помогите скомпилировать плагин
 
В этой теме было размещено решение! Перейти к решению.
Сообщения
1,304
Реакции
2,303
Помог
57 раз(а)
fix
 

Вложения

  • 10.1 KB Просмотры: 132
Статус
В этой теме нельзя размещать новые ответы.

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу