Code: Select all
#include <sqlx> new const szTables[][] = { "CREATE TABLE IF NOT EXISTS `client_pult` (`ip` varchar(32), `model` int(32), `skin` int(32), `jumps` int(32), `foot` int(32), `status`int(32), `bullet` int(32), `camera` int(32))"} new Handle:g_hTuple;new mysqlx_host, mysqlx_user, mysqlx_db, mysqlx_pass; mysqlx_host = register_cvar ("gxm_host", "localhost"); // The host from the db mysqlx_user = register_cvar ("gxm_user", "root"); // The username from the db login mysqlx_pass = register_cvar ("gxm_pass", "pass"); // The password from the db login mysqlx_db = register_cvar ("gxm_dbname", "database"); // The database name MySQLx_Init() public MySQLx_Init(){ 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_hTuple = SQL_MakeDbTuple( szHost, szUser, szPass, szDB ); for ( new i = 0; i < sizeof szTables; i++ ) { SQL_ThreadQuery( g_hTuple, "QueryCreateTable", szTables[i]) }} public client_connect(id){ new szName[32] get_user_ip(id, szName, 31, 1) static query[ 300 ]; formatex(query, 299, "SELECT * FROM `client_pult` WHERE `ip`='%s'",szName); SQL_ThreadQuery( g_hTuple, "QuerySetData", query); new modelis[39] = SQL_FieldNameToNum(query, "model") new skinas[39] = SQL_FieldNameToNum(query, "skin") new jumpai[39] = SQL_FieldNameToNum(query, "jumps") new footai[39] = SQL_FieldNameToNum(query, "foot") new cam[39] = SQL_FieldNameToNum(query, "camera") new damage[39] = SQL_FieldNameToNum(query, "bullet") new vip_stat[39] = SQL_FieldNameToNum(query, "status") new g_model[44],g_skin[44],g_jumps[44],g_foots[44],g_bullet[44],g_status[44], g_camera[44] while (SQL_MoreResults(query)) { SQL_ReadResult(query, modelis, g_model, sizeof(g_model)-1) SQL_ReadResult(query, skinas, g_skin, sizeof(g_skin)-1) SQL_ReadResult(query, footai, g_foots, sizeof(g_foots)-1) SQL_ReadResult(query, jumpai, g_jumps, sizeof(g_jumps)-1) SQL_ReadResult(query, damage, g_bullet, sizeof(g_bullet)-1) SQL_ReadResult(query, cam, g_camera, sizeof(g_camera)-1) SQL_ReadResult(query, vip_stat, g_status, sizeof(g_status)-1) } g_status[id][1] = g_jumps g_status[id][2] = g_foots g_status[id][3] = g_bullet g_status[id][4] = g_model g_status[id][5] = g_status g_status[id][6] = g_skin g_status[id][7] = g_camera }public QueryCreateTable( iFailState, Handle:hQuery, szError[ ], iError, iData[ ], iDataSize, Float:fQueueTime ) { if( iFailState == TQUERY_CONNECT_FAILED || iFailState == TQUERY_QUERY_FAILED ) { log_amx( "%s", szError ); return;} } public QuerySetData( iFailState, Handle:hQuery, szError[ ], iError, iData[ ], iDataSize, Float:fQueueTime ) { if( iFailState == TQUERY_CONNECT_FAILED || iFailState == TQUERY_QUERY_FAILED ) { log_amx( "%s", szError ); return;} }
Errorai:

Ir dar, kodėl į mysql visur įrašo reikšmę 0, o reikėtų, kad būtų true arba false