Earn $money if you help
#1

Okay so im currently connect to the database verything is fine.

Only that the player stats dont save.

Its on a public called under saveplayerstats.

But for some reason it wont save it, it saves the password at the begining but not anything else after

Код:
stock SavePlayerStats(playerid)
{
    if(PlayerInfo[playerid][LoggedIn] == false) return 0;
 	format(megastr,sizeof(megastr),"UPDATE `users` SET LastLogin = %d,AdminLevel = %d,VIPLevel = %d,eSex = %d WHERE Username = '%s'", gettime(),PlayerInfo[playerid][eAdminLevel],PlayerInfo[playerid][eVIPLevel],PlayerInfo[playerid][eSex],PlayerInfo[playerid],PlayerInfo[playerid][eRank], PlayerName(playerid));
	mysql_function_query(gSQLHandle, megastr, false, "SavePlayer", "ii", playerid, PlayerInfo[playerid][M_SYNC]);
	return 1;
}
Or is it to do with the loading?

Код:
function LoadPlayer(playerid, p_sync)
{
    if(PlayerInfo[playerid][M_SYNC] != p_sync)
	{
		printf("[ERROR] LoadPlayer called - Unsynced ID (%d)", playerid);
		return 1;
	}

    print("LoadPlayer called");
    new fields, rows, fetch[MAX_STRING];
    cache_get_data(rows, fields, gSQLHandle);

	if(rows)
	{
		PlayerInfo[playerid][Registered] = 1;

		cache_get_field_content(0, "ID", fetch, gSQLHandle, MAX_STRING);
		PlayerInfo[playerid][pID] = strval(fetch);

		cache_get_field_content(0, "AdminLevel", fetch, gSQLHandle, MAX_STRING);
		PlayerInfo[playerid][eAdminLevel] = strval(fetch);

		cache_get_field_content(0, "VIPLevel", fetch, gSQLHandle, MAX_STRING);
		PlayerInfo[playerid][eVIPLevel] = strval(fetch);

		cache_get_field_content(0, "eSex", fetch, gSQLHandle, MAX_STRING);
		PlayerInfo[playerid][eSex] = strval(fetch);

		cache_get_field_content(0, "Faction", fetch, gSQLHandle, MAX_STRING);
		PlayerInfo[playerid][eFaction] = strval(fetch);

		cache_get_field_content(0, "FactionLeader", fetch, gSQLHandle, MAX_STRING);
		PlayerInfo[playerid][eFactionLeader] = strval(fetch);

		cache_get_field_content(0, "Rank", fetch, gSQLHandle, MAX_STRING);
		PlayerInfo[playerid][eRank] = strval(fetch);

		cache_get_field_content(0, "Developer", fetch, gSQLHandle, MAX_STRING);
		PlayerInfo[playerid][eDev] = strval(fetch);

		Match_Load(playerid);

		SetTimerEx("SpawnPlayerEx",1,0,"i",playerid);
	}
	else
	{
		PlayerInfo[playerid][Registered] = 0;

		if(PlayerInfo[playerid][Spawned] == false && PlayerInfo[playerid][eSkin] >= 0)
		{
		    SetTimerEx("SpawnPlayerEx",1,0,"i",playerid);
		}
	}


	return 1;
}
I will pay you, if you help me find the right solution.
Reply
#2

Maybe add LoadStats(playerid)?
Reply
#3

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
 // your stuff
 SavePlayerStats(playerid);
}
Reply
#4

Okay 1) Done already had that there, and 2) It already saves, read what im posting before you answer. Its saving through the CMD but not actually saving
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)