Database SQLite problems.
#1

Код:
new ClanString[ 3000 ];
    strcat( ClanString, "CREATE TABLE IF NOT EXISTS `gangs`", 3000);
    strcat( ClanString, "(`id` INT PRIMARY KEY,\
						  `name` TEXT, \
						  `owner` TEXT, \
						  `members` NUMERIC, \
						  `SpawnX` FLOAT, \
						  `SpawnY` FlOAT, \
						  `SpawnZ` FLOAT, \
						  `SpawnA` FLOAT, \
						  `Skin` NUMERIC, \
						  `BossSkin` NUMERIC, \
						  `Weap1` NUMERIC, \
						  `Weap2` NUMERIC, \
						  `Weap3` NUMERIC,", 3000);
	strcat( ClanString, "`Weap4 NUMERIC, \
						 `Weap5` NUMERIC, \
						 `Weap6` NUMERIC, \
						 `Kills` NUMERIC, \
						 `Deaths` NUMERIC, \
						 `Color` NUMERIC);", 3000);
db:Query( gDB, ClanString );
This is the database, but when i run the server it don't create, and i don't know why ... ?
Reply
#2

Sorry, my faul )
Код:
strcat( ClanString, "`Weap4 NUMERIC, \
There missing a `
Reply
#3

I have a bug very big and i don't know what to do

When i put this system on host, i don't know why, but when is in Database 7 clans, and i can create 100 clan but they don't register on database, and i don't know why
Database in OnFilterScriptInit
Код:
new ClanString[ 1024 ];
	strcat( ClanString, "CREATE TABLE IF NOT EXISTS `gangs`", 1024 );
	strcat( ClanString, "(id INT PRIMARY KEY, name varchar(50), owner varchar(50), members INT, SpawnX FLOAT, SpawnY FlOAT, SpawnZ FLOAT, SpawnA FLOAT", 1024 );
	strcat( ClanString, "Skin int DEFAULT 0, BossSkin INT DEFAULT 0, Weap1 INT DEFAULT 0, Weap2 INT DEFAULT 0, Weap3 INT DEFAULT 0,Weap4 INT DEFAULT 0,Weap5 INT DEFAULT 0,Weap6 INT DEFAULT 0, Kills INT DEFAULT 0, Deaths INT DEFAULT 0, Color INT DEFAULT 0);");
	db:Query( gDB, ClanString );
	db:Query("CREATE TABLE IF NOT EXISTS `players`(id INT PRIMARY KEY, name varchar(50), gang varchar(50), rank INT DEFAULT 0, kills INT DEFAULT 0, deaths INT DEFAULT 0);");
On player create a clan( insert dialog )

Код:
if ( dialogid == Dialog_CreateGang )
	{
	    if ( !response ) return 1;
	    if ( sscanf( inputtext, "s[128]", inputtext[ 0 ] ) ) return ShowPlayerDialog( playerid, Dialog_CreateGang, 1, "Create an clan", "{FFFFFF}So you want to create a clan?\n\nWrite below the name of your clan:", "Next", "Exit" );
	    new DBResult:R;
		register( playerid );
		R = db:Query(xFM("SELECT `owner` FROM `gangs` WHERE `name`='%s'", inputtext[ 0 ] ) );
		if ( db:num_rows( R ) )
		{
			db_get_field_assoc( R, "owner", str, sizeof( str ) );
			format( str, sizeof( str ), "ERROR: Sorry, but that name is already token by {00FF00}%s", str );
			SendClientMessage( playerid, 0xFF0000FF, str );
			db:free_result( R );
		}
		else
		{
			format( str, sizeof( str ), "You successeful created your clan, with name: {00FF00}%s", inputtext[ 0 ] );
			SendClientMessage( playerid, 0xFFFF00FF, str );
			db:free_result( R );
			new Float:X,Float:Y,Float:Z,Float:A;
			GetPlayerPos( playerid, X, Y, Z );
			GetPlayerFacingAngle( playerid, A );
			gang[ playerid ][ spawnX ] = X;
			gang[ playerid ][ spawnY ] = Y;
			gang[ playerid ][ spawnZ ] = Z;
			gang[ playerid ][ spawnA ] = A;
			R=db:Query("SELECT * FROM `gangs`");
			new id = db:num_rows( R )+1;
			db:free_result( R );
			db:Query(xFM("INSERT INTO `gangs`(id,name,owner,members,SpawnX,SpawnY,SpawnZ,SpawnA)VALUES(%d,'%s','%s','1','%.3f','%.3f','%.3f','%.3f');", id, inputtext[ 0 ], name, X, Y, Z, A ) );

			R = db:Query(xFM("SELECT * FROM `gangs` WHERE `name`='%s'", inputtext[ 0 ] ) );

			db_get_field_assoc( R, "id", str, sizeof( str ) );

			gang[ playerid ][ ID ] = strval( str );
			gang[ playerid ][ rank ] = 5;
			SendClientMessage( playerid, 0xFF0000FF, xFM("ID:%d",gang[ playerid ][ ID ] ) );
			db:free_result( R );
			db:Query(xFM("UPDATE `players` SET `gang`='%s',`rank`='5' WHERE `name`='%s'", inputtext[ 0 ], name ) );
			SetPVarInt( playerid, "CreatingGang", 1 );
			cmd_clancolor( playerid, "" );
		}
	}
... please guys help me, i told on this system all this day and i didin't make anythig , bug still exists...
Reply
#4

Cmon' boyz' help my friend
Reply
#5

Make sure your string for the query is big enough... And if that doesnt work show us your MYSQL log
Reply
#6

Ok, so i try to do more that 7 clans in my server opened in PC, and in server opened in PC i can to how much i want ...
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)