SA-MP Forums Archive
MySQL: StrickenKid > BlueG - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MySQL: StrickenKid > BlueG (/showthread.php?tid=654340)



MySQL: StrickenKid > BlueG - KamilPolska - 26.05.2018

What to change from StrickenKid to the new BlueG MySQL
Код:
bool:AccountExists(szAccount[])
{
	if(strlen(szAccount) > MAX_PLAYER_NAME) return false;

	new escaped_nick[MAX_PLAYER_NAME+16];
	mysql_real_escape_string(szAccount, escaped_nick);

	m_query("SELECT 1 FROM players WHERE nick = '%s' LIMIT 1", escaped_nick);

	new bool:exists = false;
	mysql_store_result();
	if(mysql_num_rows()) exists = true;
	mysql_free_result();

	return exists;
}
Код:
GetAccountID(szName[])
{
	new buffer[128], escapedNick[32];

	mysql_real_escape_string(szName, escapedNick);
	m_query("SELECT id FROM players WHERE nick = '%s' LIMIT 1", escapedNick);

	mysql_store_result();
	mysql_fetch_field("id", buffer);
	mysql_free_result();

	return strval(buffer);
}



Re: MySQL: StrickenKid > BlueG - NaS - 27.05.2018

Nice. Good luck.


If you tell us what's wrong, or what problems you have, it would make it easier to actually help you.