Help [INC] db_parse.inc
#1

Hello,
I currently really a problem with the include: https://sampforum.blast.hk/showthread.php?tid=477550

Does anyone know why is with me no account stored properly ie in (.ini) but only as (Accounts Data Base File)


Quote:

new DB:AccountDB;

stock SQL_RegisterAccount(name[], password[])
{
new query[256];
format(query, sizeof(query), "INSERT INTO `Accounts` (`Username`, `Password`) VALUES('%s', '%s')", name, password);
db_query(AccountDB, query);
return 1;
}


stock SQL_DeleteAccount(name[])
{
new query[128];
format(query, sizeof(query), "DELETE FROM `Accounts` WHERE `Username` = '%s'", name);
db_query(AccountDB, query);
return 1;
}


public OnGameModeInit()
{
AccountDB = db_open("Accounts.db");

stock SQL_FetchString(name[], field[], dest[], size = sizeof(dest))
{
new query[128], DBResult:result;
format(query, sizeof(query), "SELECT `%s` FROM `Accounts` WHERE `Username` = '%s'", field, name);
result = db_query(AccountDB, query);
if (db_num_rows(result) != 0)
{
db_get_field_assoc(result, field, dest, size);
}
db_free_result(result);
return 1;
}

stock bool:SQL_AccountExists(name[])
{
new query[128], DBResult:result, bool:exists;
format(query, sizeof(query), "SELECT `Username` FROM `Accounts` WHERE `Username` = '%s'", name);
result = db_query(AccountDB, query);
exists = (db_num_rows(result)) ? (true) : (false);
db_free_result(result);
return exists;
}

public GameModeExitFunc()
{
db_close(AccountDB);

stock OnPlayerLogin(playerid, password[])
{
new
data[256],
string[128],
playername[24],
DBResult:result;

GetPlayerName(playerid, playername, sizeof(playername));
if (!gPlayerLogged[playerid])
{
Encrypt(password);
format(string, sizeof(string), "SELECT * FROM `Accounts` WHERE `Username` = '%s' AND `Password` = '%s'", playername, password);
result = db_query(AccountDB, string);

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)