Another SQLite Problem... -
aRoach - 16.04.2012
Well.. I have this command:
pawn Код:
CMD:freeze( playerid, params[ ] )
{
new u_P;
if( unformat( params, "u", u_P ) ) return Send_Usage( playerid, "[PlayerID]", "Will freeze a specified player, he will cannot freeze-evade!" );
if( u_P == ( 0xFFFF ) ) return eInfo( playerid, "Player not connected" );
if( u_P == playerid ) return eInfo( playerid, "You cannot freeze yourself" );
if( Bit1_Get( g_iBit1_p_DATA[ p_Frozen ], u_P ) ) return eInfo( playerid, "Player is already frozen" );
FreezePlayer( u_P );
return ( 1 );
}
And this function:
pawn Код:
FreezePlayer( playerid )
{
new Query[ 256 ];
format( Query, sizeof Query, "INSERT INTO `Frozen` VALUES('%s', '%s')", GetPlayerIpEx( playerid ), pName( playerid ) );
DB::query( g_dbKeptAlive, Query );
Bit1_Set( g_iBit1_p_DATA[ p_Frozen ], playerid, 1 );
TogglePlayerControllable( playerid, false );
return ( 1 );
}
And the command doesn't write in the Database, any ideas why ?
Re: Another SQLite Problem... -
[MG]Dimi - 16.04.2012
You must define Colums in which to write.
Ex.
pawn Код:
format( Query, sizeof Query, "INSERT INTO `Frozen` (`IP`,`Name`) VALUES('%s', '%s')", GetPlayerIpEx( playerid ), pName( playerid ) );
Re: Another SQLite Problem... -
aRoach - 16.04.2012
Same thing...
Re: Another SQLite Problem... -
SuperViper - 16.04.2012
If you have a primary key in 'Frozen' you need to make sure it's set to auto increment.
Re: Another SQLite Problem... -
aRoach - 16.04.2012
I don't have any Primary Key...
pawn Код:
db_query(g_dbKeptAlive, "CREATE TABLE IF NOT EXISTS `Frozen` (`IP` TEXT,`Name` TEXT)")
Re: Another SQLite Problem... -
aRoach - 16.04.2012
Hmm, guys ?
Re: Another SQLite Problem... -
iggy1 - 16.04.2012
If the database already has that player in frozen table, you will need to run an "UPDATE" query instead of "INSERT". I'm no expert in SQL but i think that might be your problem.
EDIT: I thought you was setting values in the DB not just adding entries sorry.
Re: Another SQLite Problem... -
aRoach - 16.04.2012
... I'm not so 'newbie' in SQLite, and no, it doesn't write it in the Database...
The player isn't in the *.db
Re: Another SQLite Problem... -
iggy1 - 16.04.2012
Yeah i edited my post i should have read your code properly.
Re: Another SQLite Problem... -
aRoach - 16.04.2012
No problem, but I'm going mad because this snippet of code doesn't work...