public sql_start()
{
if ( !get_pcvar_num(p_Enabled) || !get_pcvar_num(save_type) )
return;
if(g_boolsqlOK) return;
new szHost[64], szUser[32], szPass[32], szDB[128];
get_pcvar_string( mysqlx_host, szHost, charsmax( szHost ) );
get_pcvar_string( mysqlx_user, szUser, charsmax( szUser ) );
get_pcvar_string( mysqlx_pass, szPass, charsmax( szPass ) );
get_pcvar_string( mysqlx_db, szDB, charsmax( szDB ) );
g_SqlTuple = SQL_MakeDbTuple(szHost, szUser, szPass, szDB);
new q_command[2048]
new iLen=0, iMax=sizeof(q_command) - 1
iLen += formatex(q_command[iLen], iMax-iLen,"CREATE TABLE IF NOT EXISTS zm_expp ( ")
iLen += formatex(q_command[iLen], iMax-iLen,"`nick` VARCHAR(48) NOT NULL, ")
iLen += formatex(q_command[iLen], iMax-iLen,"`lvl` INT(3) DEFAULT 0, ")
iLen += formatex(q_command[iLen], iMax-iLen,"`exp` INT(9) DEFAULT 0, ")
iLen += formatex(q_command[iLen], iMax-iLen,"`quest_gracza` INT(3) DEFAULT -1, ")
iLen += formatex(q_command[iLen], iMax-iLen,"`ile_juz` INT(9) DEFAULT 0, ")
iLen += formatex(q_command[iLen], iMax-iLen,"`ile_wykonano` INT(9) DEFAULT 0, ")
iLen += formatex(q_command[iLen], iMax-iLen,"`totalpoints` INT(9) DEFAULT 0, ")
iLen += formatex(q_command[iLen], iMax-iLen,"`ammopacks` INT(6) DEFAULT 0, ")
iLen += formatex(q_command[iLen], iMax-iLen,"`dam_done` INT(12) DEFAULT 0, ")
iLen += formatex(q_command[iLen], iMax-iLen,"`zm_kill` INT(6) DEFAULT 0, ")
iLen += formatex(q_command[iLen], iMax-iLen,"`hm_infkill` INT(6) DEFAULT 0, ")
iLen += formatex(q_command[iLen], iMax-iLen,"`deaths` INT(6) DEFAULT 0, ")
iLen += formatex(q_command[iLen], iMax-iLen,"`nem_kill` INT(4) DEFAULT 0, ")
iLen += formatex(q_command[iLen], iMax-iLen,"`sur_kill` INT(4) DEFAULT 0, ")
iLen += formatex(q_command[iLen], iMax-iLen,"`ass_kill` INT(4) DEFAULT 0, ")
iLen += formatex(q_command[iLen], iMax-iLen,"`sni_kill` INT(4) DEFAULT 0, ")
iLen += formatex(q_command[iLen], iMax-iLen,"`matki_kill` INT(4) DEFAULT 0, ")
iLen += formatex(q_command[iLen], iMax-iLen,"`last_hm_kill` INT(4) DEFAULT 0, ")
iLen += formatex(q_command[iLen], iMax-iLen,"`zm_win` INT(6) DEFAULT 0, ")
iLen += formatex(q_command[iLen], iMax-iLen,"`hm_win` INT(6) DEFAULT 0, ")
iLen += formatex(q_command[iLen], iMax-iLen,"`czas_online` INT(6) DEFAULT 0, ")
iLen += formatex(q_command[iLen], iMax-iLen,"`statystyka_1` INT(4) DEFAULT 0, ")
iLen += formatex(q_command[iLen], iMax-iLen,"`statystyka_2` INT(4) DEFAULT 0, ")
iLen += formatex(q_command[iLen], iMax-iLen,"`statystyka_3` INT(4) DEFAULT 0, ")
iLen += formatex(q_command[iLen], iMax-iLen,"`statystyka_4` INT(4) DEFAULT 0, ")
iLen += formatex(q_command[iLen], iMax-iLen,"`statystyka_5` INT(4) DEFAULT 0, ")
iLen += formatex(q_command[iLen], iMax-iLen,"`statystyka_6` INT(4) DEFAULT 0, ")
iLen += formatex(q_command[iLen], iMax-iLen,"PRIMARY KEY (`nick`)) ")
iLen += formatex(q_command[iLen], iMax-iLen,"DEFAULT CHARSET `utf8` COLLATE `utf8_general_ci`")
SQL_ThreadQuery(g_SqlTuple, "QueryCreateTable", q_command);
}
public QueryCreateTable( FailState, Handle:hQuery, szError[ ], Errcode, iData[ ], iDataSize, Float:fQueueTime )
{
if(FailState == TQUERY_CONNECT_FAILED) {
log_to_file("sql.log", "Could not connect to SQL database.");
return PLUGIN_CONTINUE;
}
if(Errcode) {
log_to_file("sql.log", "Error on Table query: %s", szError);
return PLUGIN_CONTINUE;
}
if(FailState == TQUERY_QUERY_FAILED) {
log_to_file("sql.log", "Table Query failed.");
return PLUGIN_CONTINUE;
}
g_boolsqlOK = 1;
log_to_file("sql.log", "Prawidlowe polaczenie");
set_task(30.0, "wczytaj_statystyki");
return PLUGIN_CONTINUE;
}
Proszę