SA-MP Forums Archive
Weird Issue - 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: Weird Issue (/showthread.php?tid=651198)



Weird Issue - OmerKhan - 15.03.2018

So, some of the people's admin level saves whereas some admin levels aren't saved, IDK why is this happening ?


About code: Using Gadmin v2.3

I have uploaded the easydb.inc in pawno > include folder, one more thing. Score is saved of people but some of them aren't admins when they relog. How to fix this ? IDK which part of code to show


Re: Weird Issue - OmerKhan - 16.03.2018

BUMP, i really need help as this issue is getting on my nerves.


Re: Weird Issue - KaRToNiToS - 16.03.2018

Show us OnPlayerDisconnect


Re: Weird Issue - OmerKhan - 16.03.2018

There you go
Код:
public OnPlayerDisconnect(playerid, reason)
{
	KillTimer(gUser[playerid][u_updatetimer]);

    for(new i; i < 3; i++)
	{
		TextDrawHideForPlayer(playerid, gGlobal[s_locktd][i]);
	}
	#if defined REPORT_TEXTDRAW
		TextDrawHideForPlayer(playerid, gGlobal[s_reporttd]);
	#endif
	#if defined SPECTATE_TEXTDRAW
		PlayerTextDrawHide(playerid, gUser[playerid][u_spectxt]);
	#endif

	LOOP_PLAYERS(i)
	{
		if(IsPlayerSpectating(i))
		{
		    if(gUser[i][u_spec] && gUser[i][u_specid] == playerid)
		    {
		        UpdatePlayerSpectating(playerid, 0, true);
			}
		}
	}

    if(gUser[playerid][u_vehicle] != -1) EraseVeh(gUser[playerid][u_vehicle]);

	new key = DB::RetrieveKey(gGlobal[s_usertable], "username", ReturnPlayerName(playerid));
    if(key != DB_INVALID_KEY)
	{
	    if(GetPVarInt(playerid, "GAdmin_Loggedin") != PLAYER_VARTYPE_NONE)
	    {
	        new DATE[18], date[3];
			getdate(date[0], date[1], date[2]);
			format(DATE, sizeof(DATE), "%i/%i/%i", date[2], date[1], date[0]);

            PlayerConnectedTime(playerid, gUser[playerid][u_hours], gUser[playerid][u_minutes], gUser[playerid][u_seconds]);

			DB::SetStringEntry(gGlobal[s_usertable], key, "laston", DATE);
			DB::SetIntEntry(gGlobal[s_usertable], key, "kills", gUser[playerid][u_kills]);
			DB::SetIntEntry(gGlobal[s_usertable], key, "deaths", gUser[playerid][u_deaths]);
			DB::SetIntEntry(gGlobal[s_usertable], key, "score", GetPlayerScore(playerid));
			DB::SetIntEntry(gGlobal[s_usertable], key, "money", GetPlayerMoney(playerid));
			DB::SetIntEntry(gGlobal[s_usertable], key, "hours", gUser[playerid][u_hours]);
			DB::SetIntEntry(gGlobal[s_usertable], key, "minutes", gUser[playerid][u_minutes]);
			DB::SetIntEntry(gGlobal[s_usertable], key, "seconds", gUser[playerid][u_seconds]);
			DB::SetIntEntry(gGlobal[s_usertable], key, "", 0);
		}
	}

	#if defined ANTI_FLOOD
		gUser[playerid][u_chattime] = 0;
	#endif
	#if defined ANTI_SPAM
		format(gUser[playerid][u_chattext], 144, "");
	#endif

	new string[144], reasonstr[25];
	switch(reason)
	{
	    case 0: reasonstr = "Timeout";
	    case 1: reasonstr = "Quit";
	    case 2: reasonstr = "Kicked/Banned";
	}
	format(string, sizeof(string), "* %s[%i] have left the server! [%s]", ReturnPlayerName(playerid), playerid, reasonstr);
	SendClientMessageToAll(COLOR_GREY, string);
	return 1;
}