Участник
Пользователь
- Сообщения
- 93
- Реакции
- 12
- Ошибка
-
// H:\Ёрсюўшщ ёЄюы\scripting\gamecms_flags.sma(111) : error 035: argument type mismatch (argument 2)
// H:\Ёрсюўшщ ёЄюы\scripting\gamecms_flags.sma(122) : error 021: symbol already defined: "client_print_color"
// H:\Ёрсюўшщ ёЄюы\scripting\gamecms_flags.sma(124) : error 021: symbol already defined: "vformat"
// H:\Ёрсюўшщ ёЄюы\scripting\gamecms_flags.sma(126) : error 025: function heading differs from prototype
// H:\Ёрсюўшщ ёЄюы\scripting\gamecms_flags.sma(126) : error 001: expected token: ")", but found "sizeof"
// H:\Ёрсюўшщ ёЄюы\scripting\gamecms_flags.sma(126) : error 021: symbol already defined: "replace_all"
// H:\Ёрсюўшщ ёЄюы\scripting\gamecms_flags.sma(126) : fatal error 107: too many error messages on one line
- Компилятор
- Локальный
- Amx Mod X
- 1.9.0
- Исходный код
-
#include <amxmodx>
#include <sqlx>
#define VERSION "1.2f"
#define TASK_INDEX_MYSQL 1337
#define TASK_INDEX_INFO 2337
#define CVAR_HOSTNAME 0
#define CVAR_USERNAME 1
#define CVAR_PASSWORD 2
#define CVAR_DATABASE 3
#define CVAR_TABLE_USERS 4
#define CVAR_FLAGS 5
#define CVAR_GIVE 6
#define CVAR_TIME 7
static g_iCvars[8];
static Handle:iSql, Handle:iConnect, szTable[64];
static iMaxPlayers, iSayText;
public plugin_init() {
register_plugin("GameCMS Flags", VERSION, "OverGame");
register_dictionary("gcms_flags.txt");
g_iCvars[CVAR_FLAGS] = register_cvar("gcms_rf_flags", "");
g_iCvars[CVAR_GIVE] = register_cvar("gcms_rf_info", "");
g_iCvars[CVAR_TIME] = register_cvar("gcms_rf_time", "");
g_iCvars[CVAR_HOSTNAME] = register_cvar("gcms_hostname", ""); /* Адрес базы данных */
g_iCvars[CVAR_USERNAME] = register_cvar("gcms_username", ""); /* Пользователь базы данных */
g_iCvars[CVAR_PASSWORD] = register_cvar("gcms_password", ""); /* Пароль пользователя */
g_iCvars[CVAR_DATABASE] = register_cvar("gcms_database", ""); /* Имя базы данных */
g_iCvars[CVAR_TABLE_USERS] = register_cvar("gcms_table_users", ""); /* Таблица */
iSayText = get_user_msgid("SayText");
iMaxPlayers = get_maxplayers();
}
public plugin_cfg() {
new szConfigs[64];
get_localinfo("amxx_configsdir", szConfigs, charsmax(szConfigs));
server_cmd("exec %s/gamecms_flags.cfg", szConfigs);
set_task(1.0, "task_mysql_connect", TASK_INDEX_MYSQL);
}
public task_mysql_connect(task) {
new iError, szError[128];
copy(szTable, charsmax(szTable), cvar_string(g_iCvars[CVAR_TABLE_USERS]));
iSql = SQL_MakeDbTuple(
cvar_string(g_iCvars[CVAR_HOSTNAME]),
cvar_string(g_iCvars[CVAR_USERNAME]),
cvar_string(g_iCvars[CVAR_PASSWORD]),
cvar_string(g_iCvars[CVAR_DATABASE])
);
if((iConnect = SQL_Connect(iSql, iError, szError, charsmax(szError))) == Empty_Handle) {
set_fail_state(szError);
}
SQL_FreeHandle(iConnect);
}
public client_putinserver(id) {
new szSteamId[35], iClient[1], szQuery[512];
get_user_authid(id, szSteamId, charsmax(szSteamId));
iClient[0] = id;
formatex(szQuery, charsmax(szQuery), "SELECT * FROM `%s` WHERE (`%s`.`steam_id` = '%s')", szTable, szTable, szSteamId);
SQL_ThreadQuery(iSql, "SQL_Handler", szQuery, iClient, sizeof(iClient));
}
public SQL_Handler(iFailState, Handle:iQuery, szError[], iError, szData[], iDataLen) {
switch(iFailState) {
case TQUERY_CONNECT_FAILED: return log_amx("No connect database: %s", szError);
case TQUERY_QUERY_FAILED: return log_amx("Query error: %s", szError);
}
new id = szData[0];
if(SQL_NumResults(iQuery)) {
new szRegDate[32], szCurrent[32], iTime_1, iTime_2;
SQL_ReadResult(iQuery, SQL_FieldNameToNum(iQuery, "regdate"), szRegDate, charsmax(szRegDate));
get_time("%Y:%m:%d %H:%M:%S", szCurrent, charsmax(szCurrent));
iTime_1 = parse_time(szRegDate, "%Y:%m:%d %H:%M:%S");
iTime_2 = parse_time(szCurrent, "%Y:%m:%d %H:%M:%S");
client_print(0, print_chat, "%d %d %d", iTime_1, iTime_2, get_pcvar_num(g_iCvars[CVAR_TIME]));
if(iTime_1 + get_pcvar_num(g_iCvars[CVAR_TIME]) > iTime_2) {
if(get_pcvar_num(g_iCvars[CVAR_GIVE])) {
set_task(5.0, "task_info", TASK_INDEX_INFO + id);
}
set_user_flags(id, read_flags(cvar_string(g_iCvars[CVAR_FLAGS])));
}
}
return true;
}
public task_info(task) {
new id = task - TASK_INDEX_INFO;
client_print_color(id, "%L", id, "GCMS_FLAGS_GIVE_INFO");
remove_task(task);
}
stock cvar_string(iCvar) {
new szResult[128];
get_pcvar_string(iCvar, szResult, charsmax(szResult));
return szResult;
}
stock client_print_color(id, const szText[], any:...) {
new szMessage[128];
vformat(szMessage, charsmax(szMessage), szText, 3);
replace_all(szMessage, charsmax(szMessage), "!g", "^x04");
replace_all(szMessage, charsmax(szMessage), "!n", "^x01");
replace_all(szMessage, charsmax(szMessage), "!t", "^x03");
switch(id) {
case 0: for(new i = 1; i <= iMaxPlayers; i++) {
if(is_user_connected(i)) {
message_begin(MSG_ONE_UNRELIABLE, iSayText, _, i);
write_byte(i);
write_string(szMessage);
message_end();
}
}
default: if(is_user_connected(id)) {
message_begin(MSG_ONE_UNRELIABLE, iSayText, _, id);
write_byte(id);
write_string(szMessage);
message_end();
}
}
}
Парни помогите, не нашел решение самостоятельно *(
В этой теме было размещено решение! Перейти к решению.