SA-MP Forums Archive
login with MySQL - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: login with MySQL (/showthread.php?tid=176507)



login with MySQL - Ribber - 13.09.2010

I need a code where I can get my saved variables from the database.
I made the register code, but I don't know how I can get the vars into my account.
That is what I done atm:

Код:
CMD:login(playerid, params[])
{
	new string[128];
if(strlen(params))==0) return SendClientMessage(playerid, _COLOR_RED, "false pw.");
  	format(string, 128, "SELECT * FROM users WHERE name = '%s'", PlayerName(playerid));
    mysql_query(string);
    mysql_store_result();

	if(mysql_num_rows() != 0)
	{

	    format(string, 128, "SELECT `pass` FROM `users` WHERE `name` = '%s'", PlayerName(playerid));
    	mysql_query(string);
    	
	    GivePlayerMoney(playerid,);
		mysql_free_result();
	
	}
	else
	{
	
		SendClientMessage(playerid, _COLOR_RED, "error.");
		return 1;
	
 	}
 	return 1;
}