Score Saving? (MySQL sscanf)
#1

Код:
stock LoadPlayerInfo(iPlayer)
{
	new
		Query[700];

	if(mysql_fetch_row(Query))
	{
		sscanf(Query, "e<p<|>s[24]s[35]ddddfffd>", PVar[iPlayer]); // Remember to update this if you add more info...
		mysql_free_result();
	}
	return 1;
}

stock SavePInfo(playerid)
{
	if(GetPVarInt(playerid, "LoggedIN") == 1)
	{
		new
			Query[600];

		format(Query, sizeof(Query), "UPDATE `playerinfo` SET `kills` = %d, `deaths` = %d, `money` = %d, `Level` = %d, `Last Pos X` = %f, `Last Pos Y` = %f, `Last Pos Z` = %f, `Interior` = %d WHERE `user` = '%s'", // Also remember to update this...

		PVar[playerid][pKills],
		PVar[playerid][pDeaths],
		GetPlayerMoney(playerid),
		PVar[playerid][pLevel],
		PVar[playerid][pLastX],
		PVar[playerid][pLastY],
		PVar[playerid][pLastZ],
		GetPlayerInterior(playerid),
		pName(playerid));

		mysql_query(Query);
		mysql_free_result();
		return 1;
	}
	else return 0;
}
How can I make this so it saves and loads score too?
Reply
#2

Make Sure You've a Column of PlayerScore in Your SQL File. otherwise it will not be saved

PHP код:
format(Querysizeof(Query), "UPDATE `playerinfo` SET `PlayerScore` = %d WHERE `user` = '%s'",You Enum Of Player Datawhich Saves Player Score
Reply
#3

I want the SAMP script to save and load the score. I already have the column in my MySQL Table.
Reply
#4

PHP код:
format(Querysizeof(Query), "UPDATE `playerinfo` SET `PlayerScore` = %d WHERE `user` = '%s'",You Enum Of Player Datawhich Saves Player Score
use this it works for me!
Reply
#5

But I already have a query, how do I make this save and load the score using the one I have posted.
Reply
#6

By adding it into the query.
Then set the score when they connect(GivePlayerScore(playerid, PlayerInfo[playerid][Score]);
Reply
#7

Thanks for trying, ended up fixing it myself through trial and error.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)