SA-MP Forums Archive
OnPlayerDisconnect Problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: OnPlayerDisconnect Problem (/showthread.php?tid=117037)



OnPlayerDisconnect Problem - Laura - 30.12.2009

I need help, i try to everything, when i disconnect from any kind of reason kick, log off or crashed, only from interior more then 0, on login i spawn in interior 0 falling from sky. How to make to re spawn in same interior disconnect?


Re: OnPlayerDisconnect Problem - Calon - 30.12.2009

Show us the code you're using that saves their X, Y and Z.


Re: OnPlayerDisconnect Problem - Laura - 30.12.2009


Код:
public OnPlayerDisconnect(playerid, reason)
{
	gActivePlayers[playerid]--;
	numplayers--;
	if(reason == 0)
	{
	  PlayerInfo[playerid][pCrashed] = 1;
	  for(new slot = 0; slot != 12; slot++)
	  {
	    new wep, ammo;
	    GetPlayerWeaponData(playerid, slot, wep, ammo);

	    if(wep != 0 && ammo != 0)
	    {
	      if(PlayerInfo[playerid][pGun1] == 0) { PlayerInfo[playerid][pGun1] = wep; PlayerInfo[playerid][pAmmo1] = ammo; }
	      else if(PlayerInfo[playerid][pGun2] == 0) { PlayerInfo[playerid][pGun2] = wep; PlayerInfo[playerid][pAmmo2] = ammo; }
	      else if(PlayerInfo[playerid][pGun3] == 0) { PlayerInfo[playerid][pGun3] = wep; PlayerInfo[playerid][pAmmo3] = ammo; }
	      else if(PlayerInfo[playerid][pGun4] == 0) { PlayerInfo[playerid][pGun4] = wep; PlayerInfo[playerid][pAmmo4] = ammo; }
	    }
	  }
	}



Re: OnPlayerDisconnect Problem - Calon - 30.12.2009

There's nothing that saves, or even collects a player's location.


Re: OnPlayerDisconnect Problem - Laura - 30.12.2009

Well i removed all spawn position from faction, to re spawn in same on login. So when i'm in interior 0 on disconnect i re spawn in same position. But is something wrong whit interiors more then 0.


Re: OnPlayerDisconnect Problem - Calon - 30.12.2009

You need to paste the part of code that has "GetPlayerPos" (or something similar) and the part that saves it to a file (or unless it's a function you use to save to the files, so something like SaveAccount()).


Re: OnPlayerDisconnect Problem - Laura - 30.12.2009

i made haw you sad
Код:
public SaveAccounts()
{
  for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
            new Float: x, Float: y, Float: z; // here 
            GetPlayerPos(i, x, y, z); // and here
			OnPlayerUpdate(i);
			if(PlayerInfo[i][pJob] > 0)
	  	{
	  	  if(PlayerInfo[i][pContractTime] < 25)
	  	  {
					PlayerInfo[i][pContractTime] ++;
				}
	  	}
		}
	}
}
but no effect, is same