SQlite
#1

The SQlite saving system I'm using saves everything when onplayerdisconnect is called but doesn't save while in-game. Therefore, when a player changes his skin and is spawned or dies again. It will give him his skin back he had from when the database last saved him. Anyway around this?
Reply
#2

Код:
OnPlayerDisconnect
if (GetPVarInt(playerid, "LoggedIn"))
	{
		new string[1024],
		name[MAX_PLAYER_NAME];
		GetPlayerName(playerid, name, MAX_PLAYER_NAME);
		format(string, sizeof(string), "UPDATE `users` SET `name` = '%s', `password` = '%q', `salt` = '%q', `sec_question` = '%q', `sec_answer` = '%q', `kills` = %i, `deaths` = %i, `skin` = %i, `money` = %i, `adminlevel` = %i, `viplevel` = %i WHERE `id` = %i",
		name, eUser[playerid][e_USER_PASSWORD], eUser[playerid][e_USER_SALT], eUser[playerid][e_USER_SECURITY_QUESTION], eUser[playerid][e_USER_SECURITY_ANSWER],  eUser[playerid][e_USER_KILLS], eUser[playerid][e_USER_DEATHS], GetPlayerSkin(playerid), GetPlayerMoney(playerid), eUser[playerid][e_USER_ADMIN_LEVEL], eUser[playerid][e_USER_VIP_LEVEL], eUser[playerid][e_USER_SQLID]);
		db_query(db, string);
	}
Reply
#3

A general good practise is to save the skin already in the database when the user changes it. You would for example make your own stock function which does both the sqlite query saving and SetPlayerSkin.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)