SA-MP Forums Archive
MySQL Problem - 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 Problem (/showthread.php?tid=581556)



MySQL Problem - AnoTek - 13.07.2015

I made a stock :

Код:
stock SavePlayer(playerid)
{
	new query[356], EncryptedPass[130];
	
	WP_Hash(EncryptedPass, sizeof(EncryptedPass), Player[playerid][pPassword]);

	GetPlayerPos(playerid, Player[playerid][pPosition][0], Player[playerid][pPosition][1], Player[playerid][pPosition][2]);
	
	format(query, sizeof(query), "UPDATE accounts SET pName = '%s', pPassword = '%s', pAdminLevel = %d, pPlayerPos = '%f %f %f', pMoney = %d, pVip = %d, pMuted = %d, pWarnings = %d, pWarningReasons = '%s|%s|%s', pJob = '%s' WHERE pid = %d", GetName(playerid), Player[playerid][pPassword], Player[playerid][pAdminLevel], Player[playerid][pPosition][0], Player[playerid][pPosition][1], Player[playerid][pPosition][0], 
	Player[playerid][pSkin], Player[playerid][pMoney], Player[playerid][pvStatus],Player[playerid][pMuted], Player[playerid][pWarnings], Player[playerid][pWarningReason1], Player[playerid][pWarningReason2], Player[playerid][pWarningReason3], Player[playerid][pID], Player[playerid][pJob]);
	mysql_query(query);
	mysql_store_result();

	printf("Player ID %d (%s) has been saved", playerid, GetName(playerid));
}
For example, if I go to a job and work the server gives me money i dissconect from the server and when i get back on it i have the money from register

How can I solve it?


Re: MySQL Problem - ikey07 - 13.07.2015

not sure about your issue, but remove mysql_store_result(); its not needed for UPDATE queries.

Hmm, about your issue, you want to know how to make LoadPlayer function ?


Re: MySQL Problem - AnoTek - 13.07.2015

Yes if you want