- Ошибка
-
// Already compiled.
// ----------------------------------------
//// damager.sma
//
// C:\Users\╨єёырэ\Desktop\╧ЁюуЁрьь√\amxmodx-1.9.0-git5294-windows\addons\amxmodx\scripting\damager.sma(6) : warning 216: nested comment
// C:\Users\╨єёырэ\Desktop\╧ЁюуЁрьь√\amxmodx-1.9.0-git5294-windows\addons\amxmodx\scripting\damager.sma(46) : error 017: undefined symbol "VISIBILITY_THROUGH_WALLS"
// C:\Users\╨єёырэ\Desktop\╧ЁюуЁрьь√\amxmodx-1.9.0-git5294-windows\addons\amxmodx\scripting\damager.sma(70) : error 017: undefined symbol "VISIBILITY_THROUGH_WALLS"
// C:\Users\╨єёырэ\Desktop\╧ЁюуЁрьь√\amxmodx-1.9.0-git5294-windows\addons\amxmodx\scripting\damager.sma(92) : error 017: undefined symbol "VISIBILITY_THROUGH_WALLS"
// C:\Users\╨єёырэ\Desktop\╧ЁюуЁрьь√\amxmodx-1.9.0-git5294-windows\addons\amxmodx\scripting\damager.sma(99) : error 017: undefined symbol "VISIBILITY_THROUGH_WALLS"
// C:\Users\╨єёырэ\Desktop\╧ЁюуЁрьь√\amxmodx-1.9.0-git5294-windows\addons\amxmodx\scripting\damager.sma(158) : error 017: undefined symbol "VISIBILITY_THROUGH_WALLS"
// C:\Users\╨єёырэ\Desktop\╧ЁюуЁрьь√\amxmodx-1.9.0-git5294-windows\addons\amxmodx\scripting\damager.sma(180) : error 017: undefined symbol "VISIBILITY_THROUGH_WALLS"
// C:\Users\╨єёырэ\Desktop\╧ЁюуЁрьь√\amxmodx-1.9.0-git5294-windows\addons\amxmodx\scripting\damager.sma(201) : error 017: undefined symbol "VISIBILITY_THROUGH_WALLS"
// C:\Users\╨єёырэ\Desktop\╧ЁюуЁрьь√\amxmodx-1.9.0-git5294-windows\addons\amxmodx\scripting\damager.sma(225) : error 017: undefined symbol "VISIBILITY_THROUGH_WALLS"
// C:\Users\╨єёырэ\Desktop\╧ЁюуЁрьь√\amxmodx-1.9.0-git5294-windows\addons\amxmodx\scripting\damager.sma(228) : error 017: undefined symbol "ExecuteHam"
//
// 9 Errors.
// Could not locate output file compiled\damager.amx (compile failed).
//
// Compilation Time: 0,44 sec
// ----------------------------------------
Press enter to exit ...
- Компилятор
- WEB-компилятор
- Amx Mod X
- 1.9.0
- Исходный код
-
#include <amxmodx>
#include <reapi>
#include <nvault_array>
/*#define VISIBILITY_THROUGH_WALLS 1
/* comment out if you want that players saw a loss through walls
* 1 - Players can select to see a loss through walls or not
* 2 - Players cannot select. They will not see a loss through walls
*/
#define AUTO_RESET_INACTIVE_USERS 30
/*
* 30 - days through how many to execute reset
* comment out if you want to switch off this function
*/
new const g_szColors[][] =
{
{ 255, 228, 181 },
{ 30, 144, 255 },
{ 255, 255, 0 },
{ 50, 205, 50 },
{ 144, 238, 144 },
}
#if defined VISIBILITY_THROUGH_WALLS
#include <hamsandwich>
#endif
#if AMXX_VERSION_NUM < 183
const MAX_PLAYERS = 32;
#endif
#if !defined MAX_AUTHID_LENGTH
const MAX_AUTHID_LENGTH = 64;
#endif
new const PLUGIN_NAME[] = "Damager";
new const PLUGIN_VERSION[] = "0.0.5";
enum _:eData
{
STATE,
STYLE,
TYPE,
INCOMING,
#if VISIBILITY_THROUGH_WALLS == 1
VISIBLE,
#endif
POSITION,
AUTHID[MAX_AUTHID_LENGTH]
} new g_iDamagerData[MAX_PLAYERS+1][eData];
enum _:eState
{
DISABLE = 0,
ENABLE
}
enum _:eStyle
{
NUMBERS = 0,
STARS
}
enum _:eType
{
DEFAULT = 0,
CIRCLE
}
#if VISIBILITY_THROUGH_WALLS == 1
enum _:eVisible
{
INVISIBLE = 0,
VISIBLE
}
#endif
new g_HudSyncMessage;
new g_HudSyncMessage2;
new const Float: g_szCoords[][] =
{
{ 0.50, 0.40 },
{ 0.56, 0.44 },
{ 0.60, 0.50 },
{ 0.56, 0.56 },
{ 0.50, 0.60 },
{ 0.44, 0.56 },
{ 0.40, 0.50 },
{ 0.44, 0.44 }
}
#if VISIBILITY_THROUGH_WALLS == 1
const MENU_KEYS = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_0;
#else
const MENU_KEYS = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_0;
#endif
new g_hVault;
#if VISIBILITY_THROUGH_WALLS == 1
new const VAULT_FILE[] = "damager4";
#else
new const VAULT_FILE[] = "damager5";
#endif
#define IsBot(%1) (!g_iDamagerData[%1][AUTHID][0])
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, "steelzzz");
register_clcmd("say /damager", "Command_ShowDmgMenu");
RegisterHookChain(RG_CBasePlayer_TakeDamage, "CPlayer_TakeDamage_Post", .post = true);
g_HudSyncMessage = CreateHudSyncObj();
g_HudSyncMessage2 = CreateHudSyncObj();
register_menucmd(register_menuid("Command_ShowDmgMenu"), MENU_KEYS, "DmgMenu_Handler");
g_hVault = nvault_open(VAULT_FILE);
if(g_hVault == INVALID_HANDLE)
{
set_fail_state("[!] Opening nVault failed!");
}
#if defined AUTO_RESET_INACTIVE_USERS
else
{
nvault_prune(g_hVault, 0, get_systime() - (86400 * AUTO_RESET_INACTIVE_USERS));
}
#endif
register_dictionary("damager.txt");
}
public plugin_end()
{
if(g_hVault != INVALID_HANDLE)
{
nvault_close(g_hVault);
}
}
public client_authorized(iPlayer)
{
nVaultSaveData(iPlayer);
}
public client_putinserver(iPlayer)
{
g_iDamagerData[iPlayer][AUTHID][0] = 0;
if(is_user_bot(iPlayer) || is_user_hltv(iPlayer))
{
return;
}
get_user_authid(iPlayer, g_iDamagerData[iPlayer][AUTHID], MAX_AUTHID_LENGTH - 1);
if(nvault_get_array(g_hVault, g_iDamagerData[iPlayer][AUTHID], g_iDamagerData[iPlayer], eData) <= 0)
{
g_iDamagerData[iPlayer][STATE] = ENABLE;
g_iDamagerData[iPlayer][STYLE] = NUMBERS;
#if VISIBILITY_THROUGH_WALLS == 1
g_iDamagerData[iPlayer][VISIBLE] = VISIBLE;
#endif
g_iDamagerData[iPlayer][TYPE] = DEFAULT;
g_iDamagerData[iPlayer][INCOMING] = DISABLE;
}
}
public Command_ShowDmgMenu(iPlayer)
{
new szMenu[512];
new iLen;
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "%L^n^n", iPlayer, "MENU_TITLE");
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "%L^n", iPlayer, "MENU_ITEM1", iPlayer, g_iDamagerData[iPlayer][STATE] ? "ENABLED" : "DISABLED");
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "%L^n", iPlayer, "MENU_ITEM2", iPlayer, g_iDamagerData[iPlayer][STYLE] ? "STARS" : "NUMBERS");
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "%L^n", iPlayer, "MENU_ITEM3", iPlayer, g_iDamagerData[iPlayer][TYPE] ? "CIRCLE" : "DEFAULT");
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "%L^n", iPlayer, "MENU_ITEM4", iPlayer, g_iDamagerData[iPlayer][INCOMING] ? "ENABLED" : "DISABLED");
#if VISIBILITY_THROUGH_WALLS == 1
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "%L^n", iPlayer, "MENU_ITEM5", iPlayer, g_iDamagerData[iPlayer][VISIBLE] ? "ENABLED" : "DISABLED");
#endif
formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n%L", iPlayer, "MENU_EXIT");
#if AMXX_VERSION_NUM < 183
set_member(iPlayer, m_iMenu, Menu_OFF);
#endif
show_menu(iPlayer, MENU_KEYS, szMenu, -1, "Command_ShowDmgMenu");
return PLUGIN_CONTINUE;
}
public DmgMenu_Handler(iPlayer, iKey)
{
if(iKey == 9)
{
nVaultSaveData(iPlayer);
return PLUGIN_HANDLED;
}
#if VISIBILITY_THROUGH_WALLS == 1
new const iPtr[] = {STATE, STYLE, TYPE, INCOMING, VISIBLE};
#else
new const iPtr[] = {STATE, STYLE, TYPE, INCOMING};
#endif
iKey = iPtr[iKey];
g_iDamagerData[iPlayer][iKey] = !g_iDamagerData[iPlayer][iKey];
Command_ShowDmgMenu(iPlayer);
return PLUGIN_HANDLED;
}
public CPlayer_TakeDamage_Post(iVictim, iInflictor, iAttacker, Float:flDamage, iBitsDamageType)
{
if(!is_user_connected(iAttacker) || flDamage <= 0.0 || !rg_is_player_can_takedamage(iVictim, iAttacker) || iVictim == iAttacker)
{
return;
}
if(iBitsDamageType & DMG_BLAST)
{
return;
}
#if VISIBILITY_THROUGH_WALLS == 1
if(!g_iDamagerData[iAttacker][STATE] || (!g_iDamagerData[iAttacker][VISIBLE] && !ExecuteHam(Ham_FVisible, iAttacker, iVictim)))
#else
if(!g_iDamagerData[iAttacker][STATE] || (!ExecuteHam(Ham_FVisible, iAttacker, iVictim)))
#endif
{
return;
}
new iColor = random_num(0, sizeof(g_szColors) - 1);
if(g_iDamagerData[iAttacker][TYPE])
{
new iPos = ++g_iDamagerData[iAttacker][POSITION];
if(iPos == sizeof(g_szCoords))
{
iPos = g_iDamagerData[iAttacker][POSITION] = 0;
}
if(g_iDamagerData[iVictim][INCOMING])
{
set_hudmessage(255, 0, 0, g_szCoords[iPos][0], g_szCoords[iPos][1]+0.06, 0, 0.1, 2.5, 0.02, 0.02, -1);
ShowSyncHudMsg(iVictim, g_HudSyncMessage2, (g_iDamagerData[iVictim][STYLE]) ? "*" : "%.0f", flDamage);
}
set_hudmessage(g_szColors[iColor][0], g_szColors[iColor][1], g_szColors[iColor][2], g_szCoords[iPos][0], g_szCoords[iPos][1], 0, 0.1, 2.5, 0.02, 0.02, -1);
ShowSyncHudMsg(iAttacker, g_HudSyncMessage, (g_iDamagerData[iAttacker][STYLE]) ? "*" : "%.0f", flDamage);
}
else
{
if(g_iDamagerData[iVictim][INCOMING])
{
set_hudmessage(255, 0, 0, -1.0, 0.45, 2, 0.1, 4.0, 0.02, 0.02, -1);
ShowSyncHudMsg(iVictim, g_HudSyncMessage2, (g_iDamagerData[iVictim][STYLE]) ? "*" : "%.0f", flDamage);
}
set_hudmessage(g_szColors[iColor][0], g_szColors[iColor][1], g_szColors[iColor][2], -1.0, 0.55, 2, 0.1, 4.0, 0.02, 0.02, -1);
ShowSyncHudMsg(iAttacker, g_HudSyncMessage, (g_iDamagerData[iAttacker][STYLE]) ? "*" : "%.0f", flDamage);
}
}
public nVaultSaveData(iPlayer)
{
if(!IsBot(iPlayer))
{
nvault_set_array(g_hVault, g_iDamagerData[iPlayer][AUTHID], g_iDamagerData[iPlayer], eData);
}
}
-
В этой теме было размещено решение! Перейти к решению.