06.07.2013, 22:08
(
Последний раз редактировалось Konstantinos; 07.07.2013 в 09:31.
)
pawn Код:
#define FILTERSCRIPT
#include < a_samp >
new
DB: Database
;
public OnFilterScriptInit( )
{
Database = db_open( "DatabaseBLRP.db" );
new
DBResult: Result
;
Result = db_query( Database, "SELECT * FROM users WHERE name = 'Danijel_Glupan' AND password = 'dado123'" );
if( db_num_rows( Result ) )
{
new
Field[ 2 ],
admin = 0
;
db_get_field_assoc( Result, "admin", Field, 2 );
admin = strval( Field );
printf( "Danijel_Glupan's admin level is %d", admin );
}
db_free_result( Result );
return 1;
}
public OnFilterScriptExit( )
{
db_close( Database );
return 1;
}
pawn Код:
// Output:
[01:13:14] Danijel_Glupan's admin level is 1
EDIT: I think I didn't see that in your database and you must add that. It's about COLLATE NOCASE. When creating the table, set the name to:
pawn Код:
"CREATE TABLE IF NOT EXISTS users (name VARCHAR(24) COLLATE NOCASE, ... blabla.."