I'm trying to set up a login system but I can not assign to variables of the GM values saved in MySQL, does anyone know how to do this?
Код:
format(sqls, sizeof(sqls), "SELECT * FROM membros WHERE `username` = '%s'", playername2);
sqlconnection = mysql_query(sqls);
mysql_store_result(sqlconnection);
while(mysql_fetch_row(resultline,"|"))
{
if(mysql_num_rows(sqlconnection) == 0)
{
new hid = strval(data[0]);
if(strcmp(PlayerInfo[hid][pKey],password, true ) == 0 )
{
split(resultline, data, '|');
//format(PlayerInfo[hid][Owner], MAX_PLAYER_NAME, data[0]);
PlayerInfo[hid][pKey] = strval(data[1]);
PlayerInfo[hid][pLevel] = strval(data[2]);
PlayerInfo[hid][pAdmin] = strval(data[3]);
PlayerInfo[hid][pSocio] = strval(data[4]);
PlayerInfo[hid][pVIP] = strval(data[5]);
}
}
}
Код:
GetPlayerName(playerid, playername3, sizeof(playername3));
new querystring[250];
connection = mysql_init(LOG_ONLY_ERRORS, 1);
format(querystring, sizeof(querystring), "UPDATE `membros` SET `Key` = '%s' WHERE `username` = '%s'", PlayerInfo[playerid][pKey], playername3);
PlayerInfo[playerid][pCash] = GetPlayerMoneyEx(playerid);
mysql_query(querystring,connection);
format(querystring, sizeof(querystring), "UPDATE `membros` SET `Level` = '%d' WHERE `username` = '%s'",PlayerInfo[playerid][pLevel], playername3);
mysql_query(querystring,connection);
format(querystring, sizeof(querystring), "UPDATE `membros` SET `AdminLevel` = '%d' WHERE `username` = '%s'",PlayerInfo[playerid][pAdmin], playername3);
mysql_query(querystring,connection);
format(querystring, sizeof(querystring), "UPDATE `membros` SET `SocioLevel` = '%d' WHERE `username` = '%s'",PlayerInfo[playerid][pSocio], playername3);
mysql_query(querystring,connection);
format(querystring, sizeof(querystring), "UPDATE `membros` SET `DonateRank` = '%d' WHERE `username` = '%s'",PlayerInfo[playerid][pVIP], playername3);
mysql_query(querystring,connection);
(...)