Не могу скомпилировать плагин

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
22
Реакции
8
Основная информация

Проблема: Не могу скомпилировать плагин

Ошибка:
error 020: invalid symbol name ""
Дополнительная информация

Amx Mod X: ReAMXX

Компилятор: Локальный

Исходник:
Код:

// Required admin access level
#define ADMIN_VOICE ADMIN_CHAT
// Delay before a connected player see the text announce
#define ANNOUNCE_TASK_DELAY 30.0
// Comment this out if you don't want that a "no sound" player can hear admins using +adminvoice
// All other player settings are respected whatever this is commented or not.
// #define SUPER_ADMIN_PRIORITY
/* ** END OF EDITABLE ** */
/* Changelog
*
* v1.1.0 (10/23/13)
* -cleaned up code
*
* v1.0.2 (04/19/08)
* -few code corrections
* -updated player spawn detection
* -added HLTV & BOT checks
*
* v1.0.1 (03/31/08)
* -added colored chat
* -added chat command /vm that display voices settings
* -inform new players about /vm command
* -display adminlisten status when toggle_adminlisten command is used
* -added support for amx_show_activity cvar on amx_(un)mute command
*
* v1.0.0 (03/26/08)
* First release
*
*/
/*
Flags :
1 : hear dead terrorists
2 : hear alive terrorists
4 : hear dead cts
8 : hear alive cts
16 : hear specs
*/
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#pragma semicolon 1
#define VERSION "1.1.alpha"
#define cm(%0) ( sizeof(%0) - 1 )
#define MaskPlayerVoice(%0) ( 1<<((%0-1) & 31) )
enum _:mStates
{
DEAD_T,
ALIVE_T,
DEAD_CT,
ALIVE_CT,
SPEC
}
enum _:mStatesFlags ( <<= 1 )
{
FL_DEAD_T = 1,
FL_ALIVE_T,
FL_DEAD_CT,
FL_ALIVE_CT,
FL_SPEC
}
const MAX_PLAYERS = 32;
const m_iTeam = 114;
const TEAM_T = 1;
const TEAM_CT = 2;
new g_bHasVoicesOn[33 char];
new g_bitBannedClients[33];
#define CanPlayerHearPlayer(%0,%1) ( ~g_bitBannedClients[%0] & MaskPlayerVoice(%1) )
new g_iAdminVoice;
new g_bAdmin[33 char];
new g_bInterAdminVoice[33 char];
new g_bAdminListen[33 char];
new g_bMuted[33 char];
new g_szClientsIp[MAX_PLAYERS+1][22];
new Trie:g_tMutedPlayersIps;
new g_iMaxPlayers;
new g_pcvarVoicesRules[mStates];
new g_amx_show_activity;
public plugin_init()
{
register_plugin("Voices Management", VERSION, "ConnorMcLeod");
register_dictionary("voicesmanagement.txt");
register_dictionary("common.txt");
g_pcvarVoicesRules[DEAD_T] = register_cvar("amx_vm_dead_t", "abcde");
g_pcvarVoicesRules[ALIVE_T] = register_cvar("amx_vm_alive_t", "bd");
g_pcvarVoicesRules[DEAD_CT] = register_cvar("amx_vm_dead_ct", "abcde");
g_pcvarVoicesRules[ALIVE_CT] = register_cvar("amx_vm_alive_ct", "bd");
g_pcvarVoicesRules[SPEC] = register_cvar("amx_vm_spec", "abcde");
register_forward(FM_Voice_SetClientListening, "OnVoice_SetClientListening");
register_clcmd("VModEnable", "ClCmd_VModEnable");
register_clcmd("vban", "ClCmd_vban");
register_clcmd("+adminvoice", "AdminCommand_VoiceOn");
register_clcmd("-adminvoice", "AdminCommand_VoiceOff");
register_clcmd("+interadminvoice", "AdminCommand_InterAdminOn");
register_clcmd("-interadminvoice", "AdminCommand_InterAdminOff");
register_clcmd("+adminlisten", "AdminCommand_ListenOn");
register_clcmd("-adminlisten", "AdminCommand_ListenOff");
register_clcmd("toggle_adminlisten", "AdminCommand_ListenToggle");
register_concmd("amx_mute", "AdminCommand_Mute", ADMIN_VOICE, "<name/#userid>");
register_concmd("amx_unmute", "AdminCommand_UnMute", ADMIN_VOICE, "<name/#userid>");
// register_clcmd("say /vm", "ClCmd_SayStatus");
// register_clcmd("say_team /vm", "ClCmd_SayStatus");
}
public plugin_cfg()
{
g_iMaxPlayers = get_maxplayers();
g_tMutedPlayersIps = TrieCreate();
g_amx_show_activity = get_cvar_pointer("amx_show_activity");
if( g_amx_show_activity )
{
g_amx_show_activity = register_cvar("amx_show_activity", "2");
}
}
// public ClCmd_SayStatus(id)
// {
// new iDeads = get_pcvar_num(g_pcvarDeadsHear),
// iAlives = get_pcvar_num(g_pcvarAlivesHear);
// new szDeadsStatus[18], szAlivesStatus[19];
// switch( iAlives )
// {
// case 0:szAlivesStatus = "VM_ALIVES_TEAMATES";
// case 1:szAlivesStatus = "VM_ALIVES";
// case 2:szAlivesStatus = "VM_ALL";
// }
// switch( iDeads )
// {
// case 0:szDeadsStatus = "VM_DEADS_TEAMATES";
// case 1:szDeadsStatus = "VM_DEADS";
// case 2:szDeadsStatus = "VM_ALL";
// }
// client_print_color(id, id, "%L", id, "VM_ALIVES_STATUS", id, szAlivesStatus);
// client_print_color(id, id, "%L", id, "VM_DEADS_STATUS", id, szDeadsStatus);
// }
// public taskAnnounce(id)
// {
// if( is_user_connected(id) )
// {
// client_print_color(id, id, "%L", id, "VM_ANNOUCE");
// }
// }
public client_authorized(id)
{
g_bAdmin{ id } = bool:(get_user_flags(id) & ADMIN_VOICE);
}
public client_putinserver(id)
{
g_bAdminListen{ id } = false;
g_bInterAdminVoice{ id } = false;
if(is_user_bot(id) || is_user_hltv(id))
return;
static szIp[22];
get_user_ip(id, szIp, cm(szIp));
g_szClientsIp[id] = szIp;
if( TrieKeyExists(g_tMutedPlayersIps, szIp) )
{
g_bMuted{ id } = true;
TrieDeleteKey(g_tMutedPlayersIps, szIp);
}
// set_task(ANNOUNCE_TASK_DELAY, "taskAnnounce", id);
}
public client_disconnected(id)
{
if(g_iAdminVoice == id)
{
g_iAdminVoice = 0;
}
if(g_bMuted{ id })
{
TrieSetCell(g_tMutedPlayersIps, g_szClientsIp[id], 1);
g_bMuted{ id } = false;
}
}
public ClCmd_VModEnable(id)
{
if( read_argc() >= 2 )
{
new arg[32];
read_argv(1, arg, cm(arg));
g_bHasVoicesOn{ id } = !!str_to_num(arg);
}
}
public ClCmd_vban(id)
{
if( read_argc() >= 2 )
{
new arg[32];
read_argv(1, arg, cm(arg));
g_bitBannedClients[id] = strtol(arg, .base = 16);
}
}
public OnVoice_SetClientListening(id, iSender, bool:bListen)
{
if( !is_user_connected(iSender) )
{
return FMRES_IGNORED;
}
static bool:bShouldListen;
bShouldListen = false;
#if defined SUPER_ADMIN_PRIORITY
if(g_iAdminVoice)
{
bShouldListen = (g_iAdminVoice == iSender);
}
else if( !g_bHasVoicesOn{ id } || CanPlayerHearPlayer(id, iSender) )
{
return FMRES_IGNORED;
}
#else
if( !g_bHasVoicesOn{ id } || CanPlayerHearPlayer(id, iSender) )
{
return FMRES_IGNORED;
}
else if(g_iAdminVoice)
{
bShouldListen = (g_iAdminVoice == iSender);
}
#endif
else if( !g_bMuted{ iSender } )
{
if( g_bInterAdminVoice{ iSender } )
{
bShouldListen = !!g_bAdmin{ id };
}
else if(g_bAdminListen{ id })
{
bShouldListen = true;
}
else
{
static pcvar;
switch( get_pdata_int(id, m_iTeam) )
{
case TEAM_T:
{
pcvar = g_pcvarVoicesRules[ is_user_alive(id) ? ALIVE_T : DEAD_T];
}
case TEAM_CT:
{
pcvar = g_pcvarVoicesRules[ is_user_alive(id) ? ALIVE_CT : DEAD_CT];
}
default:
{
pcvar = g_pcvarVoicesRules[SPEC];
}
}
static szRules[6], iRules;
get_pcvar_string(pcvar, szRules, cm(szRules));
iRules = read_flags(szRules);
switch( get_pdata_int(iSender, m_iTeam) )
{
case TEAM_T:
{
bShouldListen = !!(iRules & ( is_user_alive(iSender) ? FL_ALIVE_T : FL_DEAD_T ));
}
case TEAM_CT:
{
bShouldListen = !!(iRules & ( is_user_alive(iSender) ? FL_ALIVE_CT : FL_DEAD_CT ));
}
default:
{
bShouldListen = !!(iRules & FL_SPEC);
}
}
}
}
if( bShouldListen != bListen )
{
forward_return
(
FMV_CELL,
engfunc(EngFunc_SetClientListening, id, iSender, bShouldListen)
);
return FMRES_SUPERCEDE;
}
return FMRES_IGNORED;
}
public AdminCommand_ListenOn(id)
{
if( !g_bAdmin{ id } )
{
return PLUGIN_HANDLED;
}
g_bAdminListen{ id } = true;
return PLUGIN_HANDLED;
}
public AdminCommand_ListenOff(id)
{
if( g_bAdminListen{ id } )
{
g_bAdminListen{ id } = false;
}
return PLUGIN_HANDLED;
}
public AdminCommand_ListenToggle(id)
{
if( !g_bAdmin{ id } )
{
return PLUGIN_HANDLED;
}
g_bAdminListen{ id } = !g_bAdminListen{ id };
client_print_color(id, id, "%L", id, "VM_LISTEN_STATUS", g_bAdminListen{ id } ? "ON" : "OFF");
return PLUGIN_HANDLED;
}
public AdminCommand_VoiceOn(id)
{
if( !g_bAdmin{ id } )
{
return PLUGIN_HANDLED;
}
if(g_iAdminVoice)
{
client_print_color(id, id, "%L", id, "VM_ALREADY_INUSE");
return PLUGIN_HANDLED;
}
g_iAdminVoice = id;
new name[32];
pev(id, pev_netname, name, cm(name));
for(new player = 1; player <= g_iMaxPlayers; player++)
{
if( is_user_connected(player) && !is_user_hltv(player) && !is_user_bot(player) )
{
client_print_color(player, id, "%L", player, "VM_ADMIN_TALK", name);
}
}
client_cmd(id, "+voicerecord");
return PLUGIN_HANDLED;
}
public AdminCommand_VoiceOff(id)
{
if( !g_bAdmin{ id } )
{
return PLUGIN_HANDLED;
}
if(g_iAdminVoice != id)
{
client_cmd(id, "-voicerecord");
return PLUGIN_HANDLED;
}
client_cmd(id, "-voicerecord");
g_iAdminVoice = 0;
return PLUGIN_HANDLED;
}
public AdminCommand_InterAdminOn(id)
{
if( !g_bAdmin{ id } )
{
return PLUGIN_HANDLED;
}
g_bInterAdminVoice{ id } = true;
client_cmd(id, "+voicerecord");
new name[32];
get_user_name(id, name, cm(name));
for(new i=1; i<=g_iMaxPlayers; i++)
{
if( !g_bAdmin{ i } || !is_user_connected(i) )
{
continue;
}
client_print_color(i, id, "%L", i, "VM_INTER_START", name);
}
return PLUGIN_HANDLED;
}
public AdminCommand_InterAdminOff(id)
{
if( !g_bInterAdminVoice{ id } )
return PLUGIN_HANDLED;
g_bInterAdminVoice{ id } = false;
client_cmd(id, "-voicerecord");
new name[32];
get_user_name(id, name, cm(name));
for(new i=1; i<=g_iMaxPlayers; i++)
{
if( !g_bAdmin{ i } || !is_user_connected(i) )
{
continue;
}
client_print_color(i, id, "%L", i, "VM_INTER_STOP", name);
}
return PLUGIN_HANDLED;
}
public AdminCommand_Mute(id, level, cid)
{
if( !cmd_access(id, level, cid, 2, true) )
{
return PLUGIN_HANDLED;
}
new szPlayer[32];
read_argv(1, szPlayer, cm(szPlayer));
new iPlayer = cmd_target(id, szPlayer, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_NO_BOTS);
if( !iPlayer )
{
return PLUGIN_HANDLED;
}
if( g_bAdmin{ iPlayer } )
{
client_print(id, print_console, "%L", id ? id : LANG_SERVER, "VM_MUTE_ADMIN");
return PLUGIN_HANDLED;
}
if( g_bMuted{ iPlayer } )
{
client_print(id, print_console, "%L", id ? id : LANG_SERVER, "VM_AR_MUTED");
return PLUGIN_HANDLED;
}
g_bMuted{ iPlayer } = true;
client_print(id, print_console, "%L", id ? id : LANG_SERVER, "VM_MUTED");
if(g_amx_show_activity)
{
new name[32], name2[32];
get_user_name(id, name, cm(name));
get_user_name(iPlayer, name2, cm(name2));
// show_activity_col(id, name, name2, "VM_MUTE_ACTIVITY");
show_activity_key_color(id, "VM_MUTE_ACTIVITY_NO_NAME", "VM_MUTE_ACTIVITY_NAME", name, name2);
}
return PLUGIN_HANDLED;
}
public AdminCommand_UnMute(id, level, cid)
{
if( !cmd_access(id, level, cid, 2, true) )
{
return PLUGIN_HANDLED;
}
new szPlayer[32], iPlayer;
read_argv(1, szPlayer, cm(szPlayer));
iPlayer = cmd_target(id, szPlayer, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_NO_BOTS);
if( !iPlayer )
{
return PLUGIN_HANDLED;
}
if( !g_bMuted{ iPlayer } )
{
client_print(id, print_console, "%L", id ? id : LANG_SERVER, "VM_NOT_MUTED");
return PLUGIN_HANDLED;
}
g_bMuted{ iPlayer } = false;
client_print(id, print_console, "%L", id ? id : LANG_SERVER, "VM_UNMUTED");
if(g_amx_show_activity)
{
new name[32], name2[32];
get_user_name(id, name, cm(name));
get_user_name(iPlayer, name2, cm(name2));
// show_activity_col(id, name, name2, "VM_UNMUTE_ACTIVITY");
show_activity_key_color(id, "VM_UNMUTE_ACTIVITY_NO_NAME", "VM_UNMUTE_ACTIVITY_NAME", name, name2);
}
return PLUGIN_HANDLED;
}
show_activity_key_color(sender, const KeyWithoutName[], const KeyWithName[], const ___AdminName[], any:...)
{
// The variable gets used via vformat, but the compiler doesn't know that, so it still cries.
#pragma unused ___AdminName
static activity;
activity = get_show_activity_value();
if( !activity )
{
return;
}
new buffer[512];
new keyfmt[256];
new id;
new players[32];
new num;
new isadmin;
new activityBit = 1<<activity;
get_players(players, num, "ch");
for(--num; num>=0; num--)
{
id = players[num];
isadmin = is_user_admin(id);
if( activity == 2 || (activityBit & 0b1100 && isadmin) ) // show name
{
LookupLangKey(keyfmt, charsmax(keyfmt), KeyWithName, id);
vformat(buffer, charsmax(buffer), keyfmt, 4);
client_print_color(id, sender, "%s", buffer);
}
else if( activity == 1 || (activityBit & 12 /* 0b1100 */ && !isadmin) || (activity == 5 && isadmin ) ) // show without name
{
LookupLangKey(keyfmt, charsmax(keyfmt), KeyWithoutName, id);
// skip the "adminname" argument if not showing name
vformat(buffer, charsmax(buffer), keyfmt, 5);
client_print_color(id, sender, "%s", buffer);
}
}
}
get_show_activity_value()
{
static amx_show_activity;
static const string_amx_show_activity[] = "amx_show_activity";
if (amx_show_activity == 0)
{
amx_show_activity = get_cvar_pointer(string_amx_show_activity);
// if still not found, then register the cvar as a dummy
if (amx_show_activity == 0)
{
amx_show_activity = register_cvar(string_amx_show_activity, "2");
}
}
return get_pcvar_num(amx_show_activity);
}


Комментарий:
Больше добавить нечего
 
В этой теме было размещено решение! Перейти к решению.

Вложения

Сообщения
1,032
Реакции
828
Помог
10 раз(а)
Вот это имеется ввиду:
const MAX_PLAYERS = 32;
>>
// const MAX_PLAYERS = 32;

Или на это:
#if !defined MAX_PLAYERS
const MAX_PLAYERS = 32;
#endif
 
Сообщения
2,751
Реакции
3,016
Помог
61 раз(а)
Anonymous, раз тебе это помогло исправить, то есть является решением - отметь сообщение как решение проблемы. Не забываем об этом!
 
Статус
В этой теме нельзя размещать новые ответы.

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

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