SA-MP Forums Archive
Problem with loading SQL - 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: Problem with loading SQL (/showthread.php?tid=647091)



Problem with loading SQL - GlorifiedPig - 29.12.2017

So saving my SQL works perfectly fine. But when I load it in it adds the number 48 to each var (except the password, username and money vars). For the money, it makes it some random number, most noticeably 57. I don't understand what I did wrong. They're all integers.

Code:
stock LoginPlayer( playerid )
{
	new query[128], pName[MAX_PLAYER_NAME];
	GetPlayerName( playerid, pName, sizeof( pName ) );
	
	format( query, sizeof( query ), "SELECT * FROM accounts WHERE Name = '%s'", pName );
	mysql_query( query );
	mysql_store_result();
	
	while( mysql_fetch_row_format( query, "|" ) ) {
	    mysql_fetch_field_row( Player[playerid][Name], "Name" );
	    mysql_fetch_field_row( Player[playerid][Password], "Password" );
	    mysql_fetch_field_row( Player[playerid][Kills], "Kills" );
	    mysql_fetch_field_row( Player[playerid][Deaths], "Deaths" );
	    mysql_fetch_field_row( Player[playerid][AdminLvl], "AdminLvl" );
	    mysql_fetch_field_row( Player[playerid][Money], "Money" );
	}
	
	GivePlayerMoney( playerid, Player[playerid][Money] );
}



Re: Problem with loading SQL - GlorifiedPig - 03.01.2018

Bump


Re: Problem with loading SQL - GlorifiedPig - 10.01.2018

Bump


Re: Problem with loading SQL - Misiur - 10.01.2018

Show your table structure and enum used by Player.


Re: Problem with loading SQL - GlorifiedPig - 10.01.2018

Quote:
Originally Posted by Misiur
View Post
Show your table structure and enum used by Player.
Code:
enum PlayerStats {
	Name[128],
	Password[128],
	Kills,
	Deaths,
	AdminLvl,
	Money,
}
new Player[MAX_PLAYERS][PlayerStats];