05.05.2012, 13:37
Hi all
.
I created a function what load automaticlly gang zone's from SQL database. Here is the code:
And here are 2 problems ...:
1. In database i have 2 gang zone's and when i start the console, it shows me just: "1 teritories loaded".
2. When i enter the game, don't show's me any teritory
PS. - Sorry for my bad english.

I created a function what load automaticlly gang zone's from SQL database. Here is the code:
Код:
SetupTeritories( ) { new DBResult:r, pField[ 56 ]; r = db_query( DBGangWar, "SELECT * FROM `teritories`" ); for ( new i = 1; i < db_num_rows( r ); i++ ) { db_get_field_assoc( r, "minx", pField, 56 ); Teritories[ i ][ minx ] = floatstr( pField ); db_get_field_assoc( r, "miny", pField, 56 ); Teritories[ i ][ miny ] = floatstr( pField ); db_get_field_assoc( r, "maxx", pField, 56 ); Teritories[ i ][ maxx ] = floatstr( pField ); db_get_field_assoc( r, "maxy", pField, 56 ); Teritories[ i ][ maxy ] = floatstr( pField ); db_get_field_assoc( r, "owner", pField, 56 ); Teritories[ i ][ owner ] = strval( pField ); Teritories[ i ][ ID ] = GangZoneCreate( Teritories[ i ][ minx ], Teritories[ i ][ miny ], Teritories[ i ][ maxx ], Teritories[ i ][ maxy ] ); db_next_row( r ); printf( "%d teritories loaded", i ); } db_free_result( r ); return 1; }
1. In database i have 2 gang zone's and when i start the console, it shows me just: "1 teritories loaded".
2. When i enter the game, don't show's me any teritory

PS. - Sorry for my bad english.