03.01.2014, 00:02
Explanation inside.
pawn Код:
stock LoadStats(playerid)
{
new pName[ MAX_PLAYER_NAME ]; //A new array with the size of MAX_PLAYER_NAME = 24.
GetPlayerName(playerid, pName, MAX_PLAYER_NAME); //Stores the player's name into the array we made 'pName'
mysql_query("SELECT * FROM `Your_Table` WHERE Names = '%s'", pName);
mysql_store_result(); //stores the result after using SELECT, etc..
new
_QuerySize[ 180 ] //Creates a new array with the size of 256 or increase the size if needed.
//Calculation PlayerName = 24 + Password = 129 + EXP = 11, Money = 11 All in all its 175 + 1 = 176, lets put
//180 to make sure.
;
if( mysql_fetch_row_format( _QuerySize ) )
{
//if you're using Whirpool use placeholder s(tring) with the size of 129. (Suggested)
//if you're using udb_hash use placeholder d(ecimal) or i(nteger). (Not suggested)
sscanf( _QuerySize, "p<|>s[24]s[129]ii", Your_name_enum, Your_pass_enum, Your_exp_enum, Your_money_enum);
}
mysql_free_result();//frees the result after we loaded everything, simple words lets the result go by it self.
}