OnPlayerDisconnect Problem
#1

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?
Reply
#2

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


Код:
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; }
	    }
	  }
	}
Reply
#4

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

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.
Reply
#6

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()).
Reply
#7

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)