30.03.2016, 18:36
This is the stock im using on gamemodeinit();
This code fails to load some things, the connection some how drops down or something happens.
The logs of mysql and server prints:
PHP код:
stock LoadFirms()
{
new string[61], string2[61];
printf("LOADING");
mysql_format(dbHandle,g_szBuffer, 500,"SELECT * FROM `firms`");
new Cache:result=mysql_query(dbHandle,g_szBuffer);
printf("%d\n",cache_get_row_count());
for(new i; i < cache_get_row_count(); i++){
firma[ i ][ idas ] = cache_get_field_content_int(i, "ID");
cache_get_field_content(i,"name", string, dbHandle, 60);
format(firma[ i ][ name ], 59,"%s", string);
printf("%s 1\n", string);
cache_get_field_content(i,"place", string2, dbHandle, 60);
format(firma[ i ][ place ], 59,"%s", string2);
printf("%s 2\n", string2);
firma[ i ][ pos ][ 0 ] = cache_get_field_content_float(i,"x");
firma[ i ][ pos ][ 1 ] = cache_get_field_content_float(i,"y");
firma[ i ][ pos ][ 2 ] = cache_get_field_content_float(i,"z");
firma[ i ][ Owned ] = cache_get_field_content_int(i, "owned");
printf("%i OWNED\n", firma[ i ][ Owned ]);
cache_get_field_content(i,"owner",firma[ i ][Owner], dbHandle, 25);
printf("%s OWNER\n", firma[ i ][Owner]);
firma[ i ][ price ] = cache_get_field_content_int(i, "price");
printf("%i KAINA\n", firma[ i ][ price ]);
firma[ i ][ workers ][ 0 ] = cache_get_field_content_int(i, "workers");
printf("%i DARBUOTOJAI\n", firma[ i ][ workers ][ 0 ]);
firma[ i ][ workers ][ 1 ] = cache_get_field_content_int(i, "workerslimit");
printf("%i DARBUOTOJAI 1\n", firma[ i ][ workers ][ 1 ]);
firma[ i ][ workers ][ 2 ] = cache_get_field_content_int(i, "workersAccepting");
printf("%i ISIDARBINIMAS\n", firma[ i ][ workers ][ 2 ]);
firma[ i ][ profit ] = cache_get_field_content_int(i, "profit");
printf("%i PROFIT\n", firma[ i ][ profit ]);
firma[ i ][ contractTime ] = cache_get_field_content_int(i, "contract");
printf("%i KONTRAKT\n", firma[ i ][ contractTime ]);
if(firma[ i ][ Owned ])
{
new priemimas[70];
switch(firma[ i ][ workers ][ 2 ]){
case 0: format(priemimas, sizeof(priemimas), "{69B86E}įsidarbinimas leidћiamas{B89769}");
case 1: format(priemimas, sizeof(priemimas), "{B87669}įsidarbinimas draudћiamas{B89769}");
}
format( g_szBuffer, 600,"{B89769}%s{ffffff} firma,\n \n{B89769}%s{ffffff}\n{B89769}%s{ffffff} firmos savininkas\n{B89769}%i ( ){ffffff} laisvos darbo vietos\n{B89769}%s{ffffff} darbo kontrakto laikas",firma[ i ][ name ],firma[ i ][ place ],firma[ i ][Owner],(firma[ i ][ workers ][ 1 ]-firma[ i ][ workers ][ 0 ]), priemimas, ConvertSeconds(firma[ i ][ contractTime ]));
firma[ i ][ firmLabel ] = Create3DTextLabel( g_szBuffer, 0xFFFFFFF, firma[ i ][ pos ][ 0 ],firma[ i ][ pos ][ 1 ],firma[ i ][ pos ][ 2 ], 30, 0, 1 ) ;
firma[ i ][ pickup ] = CreateDynamicPickup( 1275, 1, firma[ i ][ pos ][ 0 ],firma[ i ][ pos ][ 1 ],firma[ i ][ pos ][ 2 ]);
}
else
{
format( g_szBuffer, 600,"{B89769}%s{ffffff} firma,\n \n{B89769}%s{ffffff}\n{B89769}%i "EURAS"{ffffff} firmos kaina\n \nNorėdami pirkti firmą spauskite {B89769}ENTER",firma[ i ][ name ],firma[ i ][ place ],firma[ i ][ price ]);
firma[ i ][ firmLabel ] = Create3DTextLabel( g_szBuffer, 0xFFFFFFF, firma[ i ][ pos ][ 0 ],firma[ i ][ pos ][ 1 ],firma[ i ][ pos ][ 2 ], 30, 0, 1 ) ;
firma[ i ][ pickup ] = CreateDynamicPickup( 1275, 1, firma[ i ][ pos ][ 0 ],firma[ i ][ pos ][ 1 ],firma[ i ][ pos ][ 2 ]);
}
printf("%s %s uћkrauta\n", firma[ i ][ name ],firma[ i ][ place ]);
printf("X : %0.3f Y : %0.3f Z : %0.3f uћkrauta\n", firma[ i ][ pos ][ 0 ],firma[ i ][ pos ][ 1 ],firma[ i ][ pos ][ 2 ]);
cache_delete(result);
}
}
The logs of mysql and server prints:
PHP код:
[21:30:32] [DEBUG] CMySQLQuery::Execute - query was successfully executed within 0.458 milliseconds
[21:30:32] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[21:30:32] [DEBUG] CMySQLHandle::SaveActiveResult - cache saved (id: 1)
[21:30:32] [DEBUG] cache_get_row_count - connection: 1
[21:30:32] [DEBUG] cache_get_row_count - connection: 1
[21:30:32] [DEBUG] cache_get_field_content_int - row: 0, field_name: "ID", connection: 1
[21:30:32] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "ID", data: "0"
[21:30:32] [DEBUG] cache_get_field_content - row: 0, field_name: "name", connection: 1, max_len: 60
[21:30:32] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "name", data: "Blueberry transport shipping"
[21:30:32] [DEBUG] cache_get_field_content - row: 0, field_name: "place", connection: 1, max_len: 60
[21:30:32] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "place", data: "Blueberry village"
[21:30:32] [DEBUG] cache_get_field_content_float - row: 0, field_name: "x", connection: 1
[21:30:32] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "x", data: "-49.8717"
[21:30:32] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
1
[21:30:32] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "y", data: "-269.363"
[21:30:32] [DEBUG] cache_get_field_content_float - row: 0, field_name: "z", connection: 1
[21:30:32] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "z", data: "6.6332"
[21:30:32] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
n: 1
[21:30:32] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[21:30:32] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "owned", data: "0"
[21:30:32] [DEBUG] cache_get_field_content - row: 0, field_name: "village", connection: 1, max_len: 25
[21:30:32] [WARNING] CMySQLResult::GetRowDataByName - field not found ("village")
[21:30:32] [DEBUG] cache_get_field_content_int - row: 0, field_name: "price", connection: 1
[21:30:32] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "price", data: "5000"
[21:30:32] [DEBUG] cache_get_field_content_int - row: 0, field_name: "workers", connection: 1
[21:30:32] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "workers", data: "0"
[21:30:32] [DEBUG] cache_get_field_content_int - row: 0, field_name: "ULL", connection: 1
[21:30:32] [WARNING] CMySQLResult::GetRowDataByName - field not found ("ULL")
[21:30:32] [ERROR] cache_get_field_content_int - invalid datatype
[21:30:32] [DEBUG] cache_get_field_content_int - row: 0, field_name: "workersAccepting", connection: 1
[21:30:32] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "workersAccepting", data: "0"
[21:30:32] [DEBUG] cache_get_field_content_int - row: 0, field_name: "profit", connection: 1
[21:30:32] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "profit", data: "0"
[21:30:32] [DEBUG] cache_get_field_content_int - row: 0, field_name: "contract", connection: 1
[21:30:32] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "contract", data: "36000"
[21:30:32] [DEBUG] CMySQLConnection::Connect - connection was successful
[21:30:32] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[21:30:32] [DEBUG] CMySQLConnection::Connect - connection was successful
[21:30:32] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[21:30:32] [DEBUG] CMySQLConnection::Connect - connection was successful
[21:30:32] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[21:30:32] [DEBUG] cache_delete - cache_id: 1, connection: 1
[21:30:32] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[21:30:32] [DEBUG] CMySQLHandle::DeleteSavedResult - result deleted
[21:30:32] [DEBUG] cache_get_row_count - connection: 1
[21:30:32] [WARNING] cache_get_row_count - no active cache
[21:30:32] LOADING
[21:30:32] 1
[21:30:32] ing
[21:30:32] Blueberry village 2
[21:30:32] Blueberry village
[21:30:32] e
[21:30:32] 5000 KAINA
[21:30:32] 0 DARBUOTŸw-I
[21:30:32] 0 DARBUOTOˆ
[21:30:32] 0 ISIDARBINIMAS
[21:30:32] 0 PROFIT
[21:30:32] 36000 KONTRAKT
[21:30:32] Blueberry transport shipping Blueberry village uћkrauta
[21:30:32] X : -49.871 Y : -269.363 Z : 6.633 uћkrauta
[21:30:32]
[21:31:19] [DEBUG] mysql_connect - host: "localhost", user: "root", database: "truckmania", password: "****", port: 3306, autoreconnect: true, pool_size: 2
[21:31:19] [DEBUG] CMySQLHandle::Create - creating new connection..
[21:31:19] [DEBUG] CMySQLHandle::CMySQLHandle - constructor called
[21:31:19] [DEBUG] CMySQLHandle::Create - connection created (id: 1)
[21:31:19] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[21:31:19] [DEBUG] CMySQLConnection::Connect - connection was successful
[21:31:19] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[21:31:19] [DEBUG] mysql_format - connection: 1, len: 500, format: "SELECT * FROM `firms`"
[21:31:19] [DEBUG] mysql_query - connection: 1, query: "SELECT * FROM `firms`", use_cache: true
[21:31:19] [DEBUG] CMySQLQuery::Execute - starting query execution
[21:31:19] [DEBUG] CMySQLQuery::Execute - query was successfully executed within 0.438 milliseconds
[21:31:19] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[21:31:19] [DEBUG] CMySQLHandle::SaveActiveResult - cache saved (id: 1)
[21:31:19] [DEBUG] cache_get_row_count - connection: 1
[21:31:19] [DEBUG] cache_get_row_count - connection: 1
[21:31:19] [DEBUG] cache_get_field_content_int - row: 0, field_name: "ID", connection: 1
[21:31:19] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "ID", data: "0"
[21:31:19] [DEBUG] cache_get_field_content - row: 0, field_name: "name", connection: 1, max_len: 60
[21:31:19] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "name", data: "Blueberry transport shipping"
[21:31:19] [DEBUG] cache_get_field_content - row: 0, field_name: "place", connection: 1, max_len: 60
[21:31:19] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "place", data: "Blueberry village"
[21:31:19] [DEBUG] cache_get_field_content_float - row: 0, field_name: "x", connection: 1
[21:31:19] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[21:31:19] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[21:31:19] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "x", data: "-49.8717"
[21:31:19] [DEBUG] cache_get_field_content_float - row: 0, field_name: "y", connection: 1
[21:31:19] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "y", data: "-269.363"
[21:31:19] [DEBUG] cache_get_field_content_float - row: 0, field_name: "z", connection: 1
[21:31:19] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "z", data: "6.6332"
[21:31:19] [DEBUG] cache_get_field_content_int - row: 0, field_name: "owned", connection: 1
[21:31:19] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "owned", data: "0"
[21:31:19] [DEBUG] cache_get_field_content - row: 0, field_name: "village", connection: 1, max_len: 25
[21:31:19] [WARNING] CMySQLResult::GetRowDataByName - field not found ("village")
[21:31:19] [DEBUG] cache_get_field_content_int - row: 0, field_name: "price", connection: 1
[21:31:19] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "price", data: "5000"
[21:31:19] [DEBUG] cache_get_field_content_int - row: 0, field_name: "workers", connection: 1
[21:31:19] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "workers", data: "0"
[21:31:19] [DEBUG] cache_get_field_content_int - row: 0, field_name: "ULL", connection: 1
[21:31:19] [WARNING] CMySQLResult::GetRowDataByName - field not found ("ULL")
[21:31:19] [ERROR] cache_get_field_content_int - invalid datatype
[21:31:19] [DEBUG] cache_get_field_content_int - row: 0, field_name: "workersAccepting", connection: 1
[21:31:19] [DEBUG] CMySQLConnection::Connect - connection was successful
ersAccepting", data: "0"
[21:31:19] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[21:31:19] [DEBUG] cache_get_field_content_int - row: 0, field_name: "profit", connection: 1
[21:31:19] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "profit", data: "0"
[21:31:19] [DEBUG] cache_get_field_content_int - row: 0, field_name: "contract", connection: 1
[21:31:19] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "contract", data: "36000"
[21:31:19] [DEBUG] cache_delete - cache_id: 1, connection: 1
[21:31:19] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[21:31:19] [DEBUG] CMySQLHandle::DeleteSavedResult - result deleted
[21:31:19] [DEBUG] cache_get_row_count - connection: 1
[21:31:19] [WARNING] cache_get_row_count - no active cache
[21:31:19] [DEBUG] CMySQLConnection::Connect - connection was successful
[21:31:19] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[21:31:19] [DEBUG] CMySQLConnection::Connect - connection was successful
[21:31:19] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[21:31:19] LOADING
[21:31:19] 1
[21:31:19] ing
[21:31:19] Blueberry village 2
[21:31:19] Blueberry village
[21:31:19] e
[21:31:19] 5000 KAINA
[21:31:19] 0 DARBUOTw-I
[21:31:19] 0 DARBUOTO
[21:31:19] 0 ISIDARBINIMAS
[21:31:19] 0 PROFIT
[21:31:19] 36000 KONTRAKT
[21:31:19] Blueberry transport shipping Blueberry village uћkrauta
[21:31:19] X : -49.871 Y : -269.363 Z : 6.633 uћkrauta
[21:31:19]